ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is it a good or bad idea to publish & subscribe directly inside the hardware interface

A "bad" one, as it violates separation of concerns.

hardware_interface implementations should be responsible for interacting with the hw only, not providing ROS interfaces. hardware_interfaces expose a number of resources, manage data conversion from whatever the hw needs to more generic representations and vice-versa and some related activities. Layering a ROS interface on-top of that is the responsibility of other entities in a ros_control stack.

This was already not really a "good idea" in ros_control (ie: the ROS 1 version), but many hardware_interface implementations did do it (the realtime_tools package made this too easy).

or should i try to get this information trough joints and handle it in the custom controller?

No need to "get this information trough joints": there is work underway to allow for arbitrary resources to be exposed, which could then be claimed by broadcasters (new name for something which does not actually control anything) or controllers. Those two would then expose services and actions and publish to topics.