Description
@saikishor Let's continue the discussion here as in #1476 there was clearly a misunderstanding on my side regarding the right terminology.
Description
Let's assume a hardware_interface::SystemInterface
which handles multiple servo axes. Each of the axis has three modes (position, velocity, torque). These interfaces have to be used exclusive ( The servo can only be in one of those modes)
Currently the only solution I see is to have a list in the hardware_interface
where the started
interfaces for each axis are tracked. The issue with this solution is: When a controller is does not activate properly it will start the interfaces but will never stop the interfaces. So afterwards no other controller can ever start these interfaces again.
Workaround
Allow a controller to always activate successfully but check in the update
method if the system is in a state where we can/want to control.
Possible solution
Quick and Dirty - make sure to stop interfaces
Make sure that if a controller starts any interface it will stop it in case it can not be configured/activated.
Advantage would be that the hardware interface has still the maximum amount of flexibility
Allow to mark interfaces as exclusive
In the export_command_interfaces
of a hardware_interface we could introduce the concept of an ExclusiveGroup
. Afterwards it is probably the job of the resource manager to handle this kind of resource lock.
Additional thoughts
What happens if one controller wants to switch from one interface to another in the same ExclusiveGroup
? (I actually have a use case where I would really like to do that)
@saikishor I can probably provide a test that reproduces this issue but it will take some time to setup as I need to implement a demo hardware_interface + a demo controller which takes some time to setup.