Best way to add a topic to an existing rosbag?
What would be the best way to add a topic to an existing rosbag?
Play the bag and publish the topic while doing a rosbag record -a?
Thanks!
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org |
What would be the best way to add a topic to an existing rosbag?
Play the bag and publish the topic while doing a rosbag record -a?
Thanks!
Use the rosbag API to open the bag, and write it out while adding the new messages for the topic.
Edit: if you already have a bag that has the other topic(s) (or can easily create one), you could attempt a merge instead. No official tools afaik, but there have been some people that implemented similar things. See #q122761 fi.
Based on the rosbag API link (which only provides the 'w'
option for writing, and this erases an existing bag) and the merge code, which reads the old bag and re-writes to a new one... the answer is actually "you can't add a topic to an existing bag," right?
I believe "misleading" is a bit strong: only very few storage formats that support streaming interfaces / infrastructure will allow you to append data to the end and still have everything work correctly (ie: stream the contents in chronological order). It's simply not something that ..
For the answer, it seems simpler to write the details of the method in addition to linking vs. just linking with ambiguous phrasing. This suggests the links could hold the answer. I know how to re-write... and I was hoping to append, so I expected to be enlightened.
So that's what I meant by misleading. The answer isn't wrong, it just dangled hope before me but when I looked at the links I realized it's what I've already been doing (and could have been spared time reading). Python can append to files, so it's reasonable to think bags might allow it, too.
Please start posting anonymously - your entry will be published after you log in or create a new account.
Asked: 2017-08-28 08:45:00 -0500
Seen: 4,641 times
Last updated: Aug 28 '17
ROSbag c++ boost compiling problems
How to use rosbag play to paly multiple rosbags which are in a folder with a single command ?
Record bag file for use with time synchronizer
How to open IMU and GPS data from previous flights in robot_localization ROS2?
What are rosbag --split and --chunksize useful for?
Grep rosbag for the time a particular message was published?
Add to an bag you just created in
w
mode or add to a file by opening and appending? The latter is not possible