Closed PeterBowman closed 4 years ago
Please note that while DeviceDriverImpl.cpp
has been populated with this kind of string comparisons, I'd much rather all to be moved to their corresponding classes and reached via polymorphism.
The only reason there are string comparisons in the first place is actually my fault, a hack I think we could do better now (there was some issue related to passing a pointer in a Property
, but since a while ago we know this can be passed as a blob):
https://github.com/roboticslab-uc3m/yarp-devices/blob/08f6a4162ef0af342ff9489c21901d062fc88e8f/libraries/YarpPlugins/CanBusControlboard/DeviceDriverImpl.cpp#L170-L172
Work on https://github.com/roboticslab-uc3m/yarp-devices/issues/211 might shed some light regarding how class inheritance is going to be shaped.
Probably blocked by https://github.com/roboticslab-uc3m/yarp-devices/issues/74.
Originally a subtask of https://github.com/roboticslab-uc3m/questions-and-answers/issues/49, I'm opening this to deal with the issues that led to https://github.com/roboticslab-uc3m/yarp-devices/commit/6467003079ffe5c468b5b082dd3ce76df3c7b4d5 (rollback commit of https://github.com/roboticslab-uc3m/yarp-devices/commit/3fcf1b5aeda71a234c2a61b2b7905213ca8d5f85).
https://github.com/roboticslab-uc3m/yarp-devices/issues/175#issuecomment-375351186
https://github.com/roboticslab-uc3m/yarp-devices/blob/08f6a4162ef0af342ff9489c21901d062fc88e8f/libraries/YarpPlugins/CanBusControlboard/DeviceDriverImpl.cpp#L301
Looks like
getValue
performs a lookup on the monitor instance (not on options passed throughopen
), ref.https://github.com/roboticslab-uc3m/yarp-devices/issues/175#issuecomment-375406583
From PolyDriver.cpp:
The
system_resource
member is a local instance ofYarpDevMonitor
(which extendsSearchMonitor
). However, we don't use it at all if theconfig
parameter toPolyDriver::open
already has a monitor object attached to itself:The monitor linked to
config
registers adevice
key incoreOpen
. If this is not the local monitor instantiated inopen
,getValue
won't return what we actually expect.https://github.com/roboticslab-uc3m/questions-and-answers/issues/49#issuecomment-375959740
To sum up,
PolyDriver::getValue
does not work as expected when the instance has been configured and opened with aSearchable
object to which a monitor has been attached to (usually viaoptions.setMonitor(config.getMonitor())
). See https://github.com/roboticslab-uc3m/yarp-devices/issues/175#issuecomment-375406583 for full explanation. Might need to circumvent the way we usegetValue
in that repo (example) or enhance the value lookup mechanism upstream.https://github.com/roboticslab-uc3m/questions-and-answers/issues/49#issuecomment-375966543
There is no simple way to sort this out on the upstream side without proposing a breaking change of the (undocumented)
SearchMonitor
interface, which lacks option getters (check sources).On our end, the CanBusControlboard device might hold a vector of
Property
instances besides the existing one forPolyDriver
objects (ref) in order to store and access device configurations. This is a hack.