Almost drop-in replacement for "devices" part of YARP, used to run robots in Generative Bionics.
The main goal is to implement an almost drop-in replacement for the "devices" part of YARP, with additional planner properties and features:
- lightweight (no heavy dependencies for the code part)
- compact (easy to mantain and extend)
- with support for writing devices in non-C++ languages, like Python
To achieve easy transition, the goal of dinrail is to automatically support opening YARP devices as dinrail devices, and viceversa.
The project is a fairly standard CMake project. Once it is installed, a basic example is:
find_package(dinrail REQUIRED)
target_link_libraries(target PRIVATE dinrail::dinrail)Configure and open a fake device, then query it through a typed interface:
#include <dinrail/Device.h>
#include <dinrail/IAxisInfo.h>
#include <dinrail/Parameters.h>
dinrail::Parameters opts;
opts.put("device", "dr_controlboard_fake");
opts.put("number_of_joints", 3);
opts.put("joint_names", std::vector<std::string>{"shoulder", "elbow", "wrist"});
opts.put("joint_type", std::vector<std::string>{"revolute", "prismatic", "revolute"});
dinrail::Device device;
device.open(opts);
dinrail::IAxisInfo* axisInfo = nullptr;
device.view(axisInfo);
int axes = 0;
axisInfo->getAxes(&axes); // axes == 3
std::string name;
axisInfo->getAxisName(0, name); // name == "shoulder"
device.close();import dinrail
opts = dinrail.Parameters()
opts.put("device", "dr_controlboard_fake")
opts.put("number_of_joints", 3)
opts.put("joint_names", ["shoulder", "elbow", "wrist"])
opts.put("joint_type", ["revolute", "prismatic", "revolute"])
device = dinrail.Device()
device.open(opts)
axis_info = device.view(dinrail.IAxisInfo)
axes, ok = axis_info.getAxes() # axes == 3
name, ok = axis_info.getAxisName(0) # name == "shoulder"
device.close()Python methods return C++ output parameters first, followed by the success flag (bool or Status). Outputs are None if the call fails.
To know which devices are available in your install, just run:
dinrail dev --list
to see the available devices.
See the following links for more documentation on the dinrail project:
- dinrail::Parameters — how to use the hierarchical key-value configuration container
- Adding Python interfaces — how to bind and register interfaces from a device plugin
- Plugin discovery — how device and interop plugins are discovered at runtime
- Interoperability plugins — how to write plugins for foreign device systems
- YARP migration guide — guides for migrating parameters, logging, devices, and sensor adapters
- Convention and Guidelines - convention and guidelines for dinrail code
Examples documentation (including Pixi commands) is available at:
These dinrail devices are part of the dinrail-devices package.
- dr_battery_fake README — parameters accepted by the
dr_battery_fakeplugin - dr_controlboard_fake README — parameters accepted by the
dr_controlboard_fakeplugin - dr_multiplenalogsensors_fake README — parameters accepted by the
dr_multiplenalogsensors_fakeplugin
All bult-in devices in dinrail-devices are also available as yarp devices with the same names and parameters, inside the dinrail-yarp-devices package.
Furthermore, in dinrail-yarp-devices the following YARP-only devices are available:
- dr_controlboard_nwc_yarp README — parameters for connecting to a remote control board over the YARP network
- dr_controlboard_nws_yarp README — parameters for exposing an attached control board over the YARP network
Any ABI, API or network protocol incompatible change will result in a minor (at least) release bump.
For internal developement, this repos uses pixi.
Whenever you work on it, run:
pixi run test
to run the test suite and:
pixi run format
to format the source code.