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

Is it more "rossy" to publish to one topic and later distinguish msgs?

asked 2018-07-09 03:33:16 -0600

JayDe gravatar image

Hi!

I guess I have a quite general question. Imagine the following: You have a list of sensors that all publish some sort of status message. What is the more "rossy" way of publishing and subscribing to this status message?

  1. All the sensors publish to the same topic and a potential subscriber later filters for its messages of interest?
  2. Each sensor publishes to an individual topic and a later subscriber will actually have one subscriber for each sensor of interest?

What do you consider "better" and why? Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2018-07-09 04:43:15 -0600

mgruhler gravatar image

updated 2018-07-09 04:43:42 -0600

When talking about a "status message" in terms of "sensors", I would actually use approach 1, name the topic /diagnostics and use a diagnostic_aggregator to do the separation.

For exactly this use-case the diagnostics system has been designed:

The diagnostics system is designed to collect information from hardware drivers and robot hardware to users and operators for analysis, troubleshooting, and logging. The diagnostics stack contains tools for collecting, publishing, analyzing and viewing diagnostics data.

The diagnostics toolchain is built around the /diagnostics topic. On this topic, hardware drivers and devices publish diagnostic_msgs/DiagnosticArray messages with the device names, status and specific data points.

The diagnostic_updater and self_test packages allow nodes to collect and publish diagnostics data. The diagnostic_aggregator can categorize and analyze diagnostics at runtime. Operators and developers can view the diagnostics data using the rqt_robot_monitor package. The diagnostic_analysis package can convert diagnostics logs to CSV files for examination and after-the-fact analysis.

edit flag offensive delete link more

Comments

What is a good package to reference for how to do this?

shoemakerlevy9 gravatar image shoemakerlevy9  ( 2018-07-19 00:21:11 -0600 )edit

Click on Used By on the right side of the page of any package on the ROS wiki, e.g. http://wiki.ros.org/diagnostic_update... to see which other (released) packages use this. Maybe have a look at the urg_node.

mgruhler gravatar image mgruhler  ( 2018-07-19 01:26:02 -0600 )edit
0

answered 2018-07-09 08:17:43 -0600

ashwath1993 gravatar image

ROS logging uses approach 1. All log messages are passed to /rosout.

The first approach is simple to implement as well. You just need a single subscriber topic and each node has to publish to one topic making the debugging easy as well if there is an issue.

Approach 2 may take up more bandwidth. Each new topic will take up a certain amount of bandwidth which may not be ideal if you are also passing bandwidth heavy information such as pointclouds/images.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-07-09 03:33:16 -0600

Seen: 188 times

Last updated: Jul 09 '18