====== Configuration File ====== The external hardware is decribed by means of a configuration file in [[http://json.org|JSON]] format. Every available hardware must be grouped into device, subdevice and channel. A device could be a data acquisition card, an external FPGA, or a pointing device such as a mouse. The subdevice denotes a certain function such as a group of digital-to-analog outputs or a bank of digital inputs. Finally, a channel is one of such a group of inputs or outputs. The complete list of available keywords can be found at [[eeros_architecture:hal:configuration_file#available_keywords|Available Keywords]].\\ Let's consider a first example { "device0": { "library": "libcomedieeros.so", "devHandle": "/dev/comedi0", "subdevice1": { "type": "DigIn", "channel0": { "signalId": "emergency" "inverted": true } }, "subdevice5": { "type": "AnalogOut", "channel0": { "signalId": "aOut0", "scale": [ { "id" : "aOut0", "minIn": 2000, "maxIn": 64000, "minOut":-9.787, "maxOut": 9.923 }, ], "range": [ { "id" : "aOut0", "minIn": 0, "maxIn": 65536, "minOut": -10.0, "maxOut": 10.0 }, ], "safe": 0.0, "unit": "V" } } } } } Every element is composed of a key / value pair. The key must be unique for every hierachy level. The key for devices, subdevices, and channels contains the number of the device, subdevice, or channel, respectively. ===== Library ===== A device must contain a ''library'' key. The system can then search for the necessary library. This library must be present in the system and will be loaded dynamically upon parsing the configuration file. For available libraries check [[eeros_architecture:hal:hardware libraries|]] ===== Type ===== A subdevice must contain a ''type'' key. This type must coincide with the subdevice type of the hardware library in use. Some subdevices contain channels of different types, e.g. a subdevice might hold several digital i/o's. Some will work as inputs while some other will be outputs. In this case you define the subdevice as being of type ''DigIn''. A single input channel inherits its type from the subdevice. If it is an output you can redefine the type for the channel. "subdevice5": { "type": "DigIn", "channel0": { "type": "DigOut", "signalId": "enableDrv" }, "channel1": { "signalId": "readySig1" } } ===== SignalId ===== Every channel must contain a ''signalId'' key. This is an indentification string. The HAL manager registers the channel under this name and you have to request an input or output from your EEROS application with this name. ===== Scale and Range ===== Channels carrying an analog signal or channels with counter inputs must be assigned a ''scale'' and ''range'' key. With these values the HAL is able to translate between the analog signal and its digital value as this digital value is necessary when accessing the hardware converter (counter, adc, dac). For examples in how to setup the scale and range properly see [[eeros_architecture:hal:scaling|]]. There are cases where the HAL should account for several stages on a scalable input or output, see [[eeros_architecture:hal:scaling_multi|]]. ===== Safe Value for Analog Output ===== An analog output can have an associated //safe// value. If a //NAN// of //INF// value would be written to its output, the output value will instead be set to its //safe// value. This helps to guarantee that a drive will not get out of control. //NAN// or //INF// can occur, if a connection between blocks is open, if a block does not run or if an algorithm within a block produces this result due to an error. If the configuration does not specify a //safe// value, it is set to //NAN//. ===== Available Keywords ===== ^ Keyword ^ Type ^ Remarks ^ | deviceX | object | device, X is the device number | | library | string | EEROS wrapper library, give full name of library including file ending and version (e.g. *.so.0.1.2) | | devHandle | string | device node which will be used for this device/group of subdevices, must correspond to device file | | subdeviceY | object | subdevice, group of channels with specific type | | type | string | describes the type of this subdevice group, name has to be the same as the library-name in your wrapper library | | channelZ | object | describes one channel of this type | | signalId | string | unique signal id for this channel, with this name you can claim the signal in your EEROS application | | inverted | bool | invert value of this channel (for digital in/outputs) | | scale | object/array | scale for scalable channel | | range | object/array | range values for scalable channel | | id | string | used to name each scale and range array element, every scale element needs a range element with the same id | | minIn | double | minimum input value, used to set scale or range of scalable in-/outputs, describe your hardware! | | maxIn | double | maximum input value, used to set scale or range of scalable in-/outputs | | minOut | double | minimum input value, used to set scale or range of scalable in-/outputs | | maxOut | double | maximum output value, used to set scale or range of scalable in-/outputs | | scale | double | scale value to set scale of scalable in-/output directly, do not mix with scale object! | | offset | double | offset value to set offset of scalable in-/output directly | | safe | double | safe value, used for scalable outputs| | unit | string | unit of this in-/output, used for scalable in-/outputs| | additionalArguments | string | used for communicating with ROS, see [[hardware_libraries#ros|ROS]], configuration file for ROS see [[config_ros]]|