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

I believe that what is happening is that ROS on the subscribe side is taking both the publisher node and topic name into account. Messages arriving from a particular publisher node are queued and passed to the callback in order. ROS is being careful not to reorder or simultaneously process messages from a particular publisher.

I believe that what ROS is happening serializing the messages on the subscribe side. ROS is that ROS on careful not to reorder messages from a publisher node. But the dispatch behavior is different between rospy and roscpp if there are multiple publishers to a topic.

For roscpp, by default, the messages received from all publishers to a topic are serialized. The messages are passed to the callback one at a time. If the queue is full, the earliest-in-time message is discarded.

For rospy, the subscribe side is taking both the publisher node and topic name into account. Messages arriving from a particular publisher node are queued and passed to the callback in order. ROS is being careful not order, but rospy will execute the callback in parallel to reorder or simultaneously process multiple messages on a topic if they are from a particular publisherdifferent publisher nodes.

Update: rewrote this answer to clarify that rospy and roscpp can have different behavior. For roscpp, @gvdhoorn points out in the comments that it's possible to change the default behavior to request parallel execution of the callback.