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

Rosbag API C++ Reading and writing bag

asked 2012-10-09 05:44:55 -0600

Jep gravatar image

updated 2012-10-09 13:48:43 -0600

mjcarroll gravatar image

Hi all,

I've been trying for a while to write a script that reads a bag file and modifies it at the same time, but seems it's impossible with the C++ API. Does anyone know how to do this, or if there is the possibility to create a new bag file? The only way I can do what I want is having two copies of the bag. One for reading and the other one for writing on it...There must be a smarter way!



edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2012-10-09 22:35:06 -0600

Lorenz gravatar image

In my personal opinion, not allowing to change an existing bag is the smartest possible way because implementing the functionality to change existing bags is hard to get right. You needed to add synchronization (what if another program is reading from that bag at the same time), you needed to get the index and the stored topic headers right, ...

I think the best solution is really to read from one bag file and write to a new one.

edit flag offensive delete link more

Question Tools


Asked: 2012-10-09 05:44:55 -0600

Seen: 2,164 times

Last updated: Oct 09 '12