Skip to content

Permit to interop plugins to define glue code to be automatically applied between requested interface and available interface #39

Description

@traversaro

The code added in #36 permits us to write open any YARP device as a dinrail device, i.e.:

#include <dinrail/Device.h>
#include <dinrail/Parameters.h>
#include <yarp/dev/IAxisInfo.h>

dinrail::Parameters options;
options.put("device", "fakeMotionControl");
options.addGroup("GENERAL").put("Joints", 3);

dinrail::Device device;
device.open(options);

// Native yarp::dev::* interfaces of the wrapped device are resolved by view().
yarp::dev::IAxisInfo* axisInfo = nullptr;
device.view(axisInfo);

However, this is still not ideal, as while we do not depend on YARP anymore for opening the device, we need it for using the yarp::dev::IAxisInfo interface, and all YARP devices only implement YARP interfaces.

A better alternatives would be that the following worked, and it was possible to directly use dinrail::IAxisInfo with fakeMotionControl, even if fakeMotionControl only implemented yarp::dev::IAxisInfo:

#include <dinrail/Device.h>
#include <dinrail/Parameters.h>
#include <yarp/dev/IAxisInfo.h>

dinrail::Parameters options;
options.put("device", "fakeMotionControl");
options.addGroup("GENERAL").put("Joints", 3);

dinrail::Device device;
device.open(options);

// Native yarp::dev::* interfaces of the wrapped device are resolved by view().
dinrail::IAxisInfo* axisInfo = nullptr;
device.view(axisInfo);

This is probably possible by extending the interop plugins permitting them to also provide "bridge" between interface with similar functionality, and modifying Device::view to automatically instantiate such bridges if necessary.

Implementing this functionality is tracked by this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions