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

does rosbag guarantee data will be published correctly everytime ?

asked 2016-01-21 01:06:05 -0500

dmngu9 gravatar image

updated 2016-01-21 01:06:44 -0500

Assume i have a bag file and run it multiple times. In those times, is the data the same ? ( i mean is there any data lost?)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-01-21 01:15:28 -0500

ahendrix gravatar image

No. rosbag may skip messages during playback to maintain the desired playback speed. If rosbag starts playing messages immediately, the first message or two may be missed by the subscriber, before the topic is set up.

You can use the -d option to have rosbag delay between advertising a topic and starting playback, to give subscribers time to connect.

You can slow down the publish rate with the -r option, and this can help prevent dropped message; this works particularly well when used with the --clock option and the use_sim_time parameter.

Have a look at the rosbag command line page for more interesting options that you can use with rosbag.

edit flag offensive delete link more

answered 2016-01-21 01:15:45 -0500

updated 2016-01-21 01:18:53 -0500

As described by @ahendrix, data apparently could be dropped if the desired playback time would otherwise not be reached. Two further potential caveats:

  • There will be some jitter/small differences in the publishing and arrival time of data at subscribers due to system CPU load and other random factors
  • If data is published at very high rates, it might exceed queue sizes, in which case some data could be dropped. This is true for both the publisher (i.e. rosbag play) and subscriber sides. For both, the queue size has to be set appropriately (See queue related params for rosbag (play) and for subscribers.
edit flag offensive delete link more


i can see the queue size of the rosbag and subscriber node affect the result of my algorithm which is not desirable. Thanks for your help

dmngu9 gravatar image dmngu9  ( 2016-01-21 17:46:58 -0500 )edit

i have 1 more question. when i filter one topic out of the bag into another bag and run the same nodes to process that topic. Everytime i run the new bag file, it gives me slightly different results . Why that happened?

dmngu9 gravatar image dmngu9  ( 2016-01-21 19:32:44 -0500 )edit

Question Tools

1 follower


Asked: 2016-01-21 01:06:05 -0500

Seen: 1,629 times

Last updated: Jan 21 '16