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

answered 2015-12-21 12:06:17 -0500

joq gravatar image

I agree with your thinking. Best practice usually involves writing a hardware-specific library or class interface which can be wrapped in a relatively small ROS node.

The ROS-agnostic library needs to be careful how it reports errors, since it lacks direct access to the ROS logging and diagnostic services. There are various reasonable solutions: throwing C++ exceptions; using return codes; providing error status and diagnostic status interfaces; etc.

Sometimes, when data copying overhead is significant, it's worth providing access to ROS messages from within the library. For example, a camera driver may want to return its data directly in a sensor_msgs/Image structure. Depending on how it's done, that might or might not require the library to include some ROS message headers.

I agree with your thinking. Best Unless the device interface is very simple, best practice usually involves writing a hardware-specific library or class interface which can be wrapped in a relatively small ROS node.

The ROS-agnostic library needs to be careful how it reports errors, since it lacks direct access to the ROS logging and diagnostic services. There are various reasonable solutions: throwing C++ exceptions; using return codes; providing error status and diagnostic status interfaces; etc.

Sometimes, when data copying overhead is significant, it's worth providing access to ROS messages from within the library. For example, a camera driver may want to return its data directly in a sensor_msgs/Image structure. Depending on how it's done, that might or might not require the library to include some ROS message headers.

I agree with your thinking. Unless the device interface is very simple, best practice involves writing a hardware-specific library or class interface which can be wrapped in a relatively small ROS node.

The ROS-agnostic library needs to be careful how it reports errors, since it lacks direct access to the ROS logging and diagnostic services. There are various reasonable solutions: throwing C++ exceptions; using return codes; providing error status and diagnostic status interfaces; etc.

Sometimes, when data copying overhead is significant, it's worth providing access to ROS messages from within the library. For example, a camera driver may want to return its data directly in a sensor_msgs/Image structure. Depending on how it's done, that might or might not require the library to include some ROS message headers.

You are welcome to join the ROS drivers special interest group. It has been active for several years, discussing these and similar questions on a relatively low-volume mailing list.