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

Revision history [back]

It would be nice if rosbag play could sync to an external /clock topic, but it doesn't- maybe there is another tool out there that provides this feature? Or adding that to rosbag play may not be too difficult.

You could make something work quickly with the rosbag python api http://wiki.ros.org/rosbag/Code%20API#Python_API - you could read every message of interest in a bag and put them in a dict with timestamp keys (which will be memory intensive for large bags), set up publishers for each topic, then wait for clock messages. Making it generic and highly configurable would be more work than hard coding a small number of topics and message types (but very useful if it was made open source).

There could be some logic that plays back all the messages since the last clock callback if the clock appears to be moving forward continuously, but if it jumps forward or backward in time don't publish all the intervening messages (it would be fun if bags could be played in reverse, but not really necessary), just skip to the new time and play back only messages from say 0.01 seconds before the new time up until it, then wait for next clock.