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.
The code added in #36 permits us to write open any YARP device as a dinrail device, i.e.:
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::IAxisInfointerface, 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::IAxisInfowithfakeMotionControl, even iffakeMotionControlonly implementedyarp::dev::IAxisInfo:This is probably possible by extending the interop plugins permitting them to also provide "bridge" between interface with similar functionality, and modifying
Device::viewto automatically instantiate such bridges if necessary.Implementing this functionality is tracked by this issue.