Skip to content
gbionicsPublic

About

Experimental prototype drop-in replacement for "devices" part of YARP, used to run robots in Generative Bionics.

Resources

Stars

4 stars

Watchers

3 watching

Forks

Repository files navigation

dinrail

Image

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.

Install and usage

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)

Basic API

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();

Python bindings

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.

Basic CLI

To know which devices are available in your install, just run:

dinrail dev --list

to see the available devices.

Additional documentation

See the following links for more documentation on the dinrail project:

Examples

Examples documentation (including Pixi commands) is available at:

Built-in device documentation

These dinrail devices are part of the dinrail-devices package.

YARP network devices

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:

Versioning policy

Any ABI, API or network protocol incompatible change will result in a minor (at least) release bump.

Development

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.

About

Experimental prototype drop-in replacement for "devices" part of YARP, used to run robots in Generative Bionics.

Resources

Stars

4 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages