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

Replay rosbags recorded with --split option

asked 2014-08-18 09:08:14 -0500

AsifA gravatar image

Hi,

I have recorded number of rosbags using --split option, say "file_0.bag", "file_1.bag", "file_2.bag" and so on to build a map. My question is: how to play them back one after the other. Using $ rosbag play file_0.bag file_1.bag file_2.bag plays all files at the same time. Whereas, I want to play one after another.

Thanks.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
7

answered 2014-08-18 16:35:46 -0500

tfoote gravatar image

If you load 3 sequential bag files recorded with --split they will playback according to the timestamps that they were received. So although they will actually be playing back simultaneously. At any given timestep data will only come from one of the bags.

edit flag offensive delete link more

Comments

Thanks! I was (embarrassingly) oblivious of timestamps when I thought of the problem.

Murilo F. M. gravatar image Murilo F. M.  ( 2014-08-18 16:59:00 -0500 )edit

Thanks Tully. It works. :)

AsifA gravatar image AsifA  ( 2014-08-19 06:29:19 -0500 )edit
2

answered 2014-08-18 10:45:09 -0500

Murilo F. M. gravatar image

updated 2014-08-18 16:59:11 -0500

UPDATE: Tully's answer is the correct way of doing it, also because (after thinking more about my suggestion) the command below would result in a lag between playing one bag and starting to play the next one (lag which, from my experience, varies according to the size of the bag).


AFAIK, rosbag does not implement such a feature.

However, you can easily take advantage of the Linux shell by running the following command:

$ rosbag play file_0.bag && rosbag play file_1.bag && rosbag play file_3.bag

The result will be a sequential execution of those 3 commands, provided the previous finished execution successfully. If you do not care about whether the previous command finished successfully, replace '&&' with ';'.

See this link for more info.

edit flag offensive delete link more

Comments

Thanks Murilo :)

AsifA gravatar image AsifA  ( 2014-08-18 16:59:41 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2014-08-18 09:08:14 -0500

Seen: 2,237 times

Last updated: Aug 18 '14