Ask Your Question
8

Is there a way to merge bag files?

asked 2011-07-21 05:55:19 -0500

I have data across multiple bag files, but I don't care about absolute timestamps, just relative time. I would like to merge the separate bag files into one bag file. For example, if I was recording images to a bag file, then later recorded more images to a different bag file, I would like to combine these bag files into a single one. Right now, I am playing them back and recording them into another bag file, but this seems clunky.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2011-07-21 07:13:31 -0500

tfoote gravatar image

updated 2011-07-21 07:13:53 -0500

You can checkout the rosbag Code API and associated cookbook you should be able to do exactly what you want pretty quickly.

edit flag offensive delete link more

Comments

3
Thanks! I ended up doing just that. I just felt like there should be a nice way to merge two bag files with the same topics. I can see this being helpful for many different types of data. Something like rosbag merge *.bag /topic
cmansley gravatar imagecmansley ( 2011-07-21 08:59:13 -0500 )edit
7

answered 2016-02-10 03:43:20 -0500

bchr gravatar image

updated 2016-02-10 03:43:39 -0500

bagedit provides a script that does just that: bagmerge.py

$ bag_merge.py --help
usage: bagmerge.py [-h] [-o output_file] [-t topics] [-i] main_bagfile bagfile

Merges two bagfiles.

positional arguments:
  main_bagfile    path to a bagfile, which will be the main bagfile
  bagfile         path to a bagfile which should be merged to the main bagfile

optional arguments:
  -h, --help      show this help message and exit
  -o output_file  name of the output file
  -t topics       topics which should be merged to the main bag
  -i              reindex bagfile
edit flag offensive delete link more

Comments

The link seems to be broken. A copy of this script seems to be here: https://github.com/udacity/self-drivi...

moooeeeep gravatar imagemoooeeeep ( 2019-09-16 05:33:40 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2011-07-21 05:55:19 -0500

Seen: 10,293 times

Last updated: Feb 10 '16