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 | ros @ Robotics Stack Exchange |
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.
Asked: 2017-08-28 08:45:00 -0500
Seen: 5,372 times
Last updated: Aug 28 '17
ROSBag C++ API -- reading message Header
Error with octomap_server: "process has died, exit code -6" [closed]
Bug? Rosbag filter and /tf_static
Understanding rosbag timestamps
Method for filtering out gps topic in a bag file
when I use the code copy from rosbag tutorials,there some wrong?
How to choose a fixed location for created bag files ?
Rosbag record in unexisting folder [closed]
Add to an bag you just created in
w
mode or add to a file by opening and appending? The latter is not possible