hardware_config documentation

The hardware_config package contains data structures to represent hardware configuration and a parser to fill these data structures from a xml configuration file. The file structure has been redesigned to better fit the driver structures und allow for type safety. A goal is to enforce compliance of xml file and driver meaning attributes defined in xml but not read by the driver or the other way round lead to an exception.

The most important class is Config. It represents a key value store for all supported types. There are getters for all supported types like getUint for UInt. Lists and matrices are also supported. A getter for a 2 by 3 Float matrix is getMatrix<2,3,float>, a getter for a Int list is getIntList.

Config objects are passed as a reference to Device constructors (in the device driver) and have to be read in the constructor. After the constructor returns it is checked, if all keys have been read in the Config object.

xml file structure (informal description):

<HardwareConfig robotName="...">
Profiles...
Device...
</HardwareConfig>

Profiles:

<Profiles>
SlaveProfile...
DeviceProfile...
</Profiles>

SlaveProfile:

<Slave type="..." profilename="...">
(Identifier)
(Config)
</Slave>
DeviceProfile:
```xml
<Device type="..." profilename="...">
(Config)
Controller...
</Device>

Device:

<Device type="..." name="..." (profile="...")>
(Config)
Controller...
Subdevice...
</Device>

Identifier (only needs to be complete after identifiers of profile and slave have been merged):

<Identifier>
<VendorID>...</VendorID>
<ProductID>...</ProductID>
<Serial>...</Serial>
</Identifier>

Config:

<Config>
ConfigContent
</Config>

Controller:

<Controller type="...">
ConfigContent
</Controller>

Subdevice:

<Subdevice name="..." type="..." (profile="...")>
(Config)
Controller...
</Subdevice>

ConfigContent:

Float...
Int...
UInt...
LinearConvertedValue...
String...
FloatList...
IntList...
UIntList...
FloatMatrix...
IntMatrix...
UIntMatrix...

Float:

<Float name="...">...</Float>

Int:

<Int name="...">...</Int>

UInt:

<UInt name="...">...</UInt>

LinearConvertedValue:

<LinearConvertedValue name="..." (factor="...") (factorAbs="...") (factorSign="+/-") (offset="...")/>

String:

<String name="...">...</String>

FloatList:

<FloatList name="...">... ... ... ... ...</FloatList>

IntList:

<IntList name="...">... ... ... ... ...</IntList>

UIntList:

<UIntList name="...">... ... ... ... ...</UIntList>

FloatMatrix:

<FloatMatrix rows="..." columns="...">... ... ... ... ...</FloatMatrix>

IntMatrix:

<IntMatrix rows="..." columns="...">... ... ... ... ...</IntMatrix>

UIntMatrix:

<UIntMatrix rows="..." columns="...">... ... ... ... ...</UIntMatrix>

Some explanations:

  • ...: a floating point, integer or string value (depending on context)
  • SomeName...: 0..n instances of SomeName
  • (SomeName): 0..1 instances of SomeName
  • Device profiles can be used by Devices or Subdevices, Slave profiles can be used by Slaves.