YARP
Yet Another Robot Platform

This tutorial covers how to write and read XML files that are used by yarprobotinterface tool and by the libYARP_robotinterface C++ library.

+ Collaboration diagram for YARP robotinterface XML files:

This tutorial covers how to write and read XML files that are used by yarprobotinterface tool and by the libYARP_robotinterface C++ library.

A minimal XML file

Here is a minimal config file, let's call it "config.xml":

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE robot PUBLIC "-//YARP//DTD yarprobotinterface 3.0//EN" "http://www.yarp.it/DTD/yarprobotinterfaceV3.0.dtd">
<robot name="robotinterfaceExample" portprefix="/icub" build="0" xmlns:xi="http://www.w3.org/2001/XInclude">
<devices>
<device name="fake_motor_device" type="fakeMotionControl">
<group name="GENERAL">
<!-- Number of joints of the fake_motor_device -->
<param name="Joints"> 3 </param>
</group>
</device>
<device name="fake_motor_nws_yarp" type="controlBoard_nws_yarp">
<!-- See https://www.yarp.it/latest/classControlBoard__nws__yarp.html for parameter documentation -->
<param name="name"> ${portprefix}/body </param>
<param name="period"> 0.01 </param>
<action phase="startup" level="5" type="attach">
<!-- This is the same name that we specified with the name attribute of the device element of a previously created device -->
<param name="device"> fake_motor_device </param>
</action>
<action phase="shutdown" level="5" type="detach" />
</device>
</devices>
</robot>

This configuration files create two devices: One fake_motor_device, that creates a fake motor control board. One fake_motor_nws_yarp, that creates a Network Wrapper Server (NWS) that exposes fake_motor_device functionality over YARP ports.

Reference documentation of XML format.

robot Element

The robot element is the root element of the XML file. It contains the following attributes: name: The name of the robotinterface instance. portprefix: The portprefix to be used by the port created by the robotinterface instance. It can be used as ${portprefix} when specifying a parameter. It must start with a /. build: Not used.

devices Element

The devices element is a child element of robot element.

It is a collector of YARP devices that are spawned by the robotinterface instance.

device Element

The device element is a child element of devices element.

It is used to specify a YARP device that is spawned by the robotinterface. It contains the following attributes: name: The name of the specific instance of YARP device that is created. type: The name of the type of YARP device to instantiate.

group Element

The group element is a child element of device or action element.

It is a collector of parameters under a specific group name.

param Element

The param element is a child element of device, action or group element.

This element it is used to specify a specific configuration parameter. It contain the following attributes: name: The name (i.e. key) of the attribute.

The inner text of the element represents the value of the parameter. If the inner text contains the string ${portprefix}, it will be substituted with the portprefix parameter specified in the portprefix attribute of the robot element.

action Element

This element still needs to be documented.