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

Take certain parts of multipe rosbags and merge these to one rosbag

asked 2014-01-27 01:09:48 -0600

jringel77 gravatar image

Is it possible to take different parts from a rosbag (multiple rosbags) and put them all together at the end to one final rosbag?

So for example: take from 1.bag: 30s - 55s take from 2.bag: 75s - 90s take from 3.bag: 40s - 60s

merge these 3 parts to final.bag

all of these bags have the same topic

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-02-11 00:28:32 -0600

demmeln gravatar image

updated 2014-02-11 09:13:12 -0600

I believe you will have to write your own tool. It should be quite easy with the rosbag python api. I have small scripts for time filtering and merging and of bag files and they are all quite straight forward.

Edit: Here are the scripts. The time filtering is actually just a hacky invocation of a rosbag filter, but the merge script is gerneral purpose and you can even select only wanted topics with wildcards.

edit flag offensive delete link more



alex.filgueira gravatar image alex.filgueira  ( 2014-02-11 00:31:51 -0600 )edit

hey Demmeln could you explain how to properly use This tool seems to be exactly what I need, but I can't seem to get time filtering to work and ended up with a 2.7 gb bag file spanning multiple days

davelkan gravatar image davelkan  ( 2015-07-09 14:49:42 -0600 )edit

It is not a general purpose tool, but just an example of how you might want to use "rosbag filter". You will have to adapt it to your use case.

demmeln gravatar image demmeln  ( 2015-07-19 17:02:02 -0600 )edit

Question Tools

1 follower


Asked: 2014-01-27 01:09:48 -0600

Seen: 3,192 times

Last updated: Feb 11 '14