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

Force subscriber to process messages in the right order

asked 2013-08-17 07:33:50 -0500

philippp625 gravatar image

updated 2013-08-17 08:06:28 -0500

I have a single publisher that publishes messages at high frequency (1800 Hz), and a subscriber in another node. I realized that the messages are not always processed sequentially. I verified this by doing the following: in the callback function, I output a warning every time the seq number of the processed message is lower than the seq number of the message processed in the previous call of the callback.

My question: is there a way to force a subscriber to process the incoming messages exactly in the order of the seq numbers in their header? (up to now I thought this would be the case by default with a single subscriber/publisher system, but apparently it isn't...)

Any help is greatly appreciated!

edit retag flag offensive close merge delete


I just realized that my problem only exists if I use a tf::MessageFilter when subscribing. Nevertheless, I don't understand why the messages are not processed in the order of their time stamps, since they all have the same frame_id, so the transforms should be available for older messages first.

philippp625 gravatar image philippp625  ( 2013-08-19 01:53:07 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-12-05 18:45:09 -0500

tfoote gravatar image

The message filter is specifically designed to cache and potentially return messages when they're ready and doesn't keep the order internally. You could write a specialization which would return them only in the incoming order.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-08-17 07:33:50 -0500

Seen: 786 times

Last updated: Dec 05 '17