Does rosbag.write will overwrite the whole file ?

asked 2018-12-27 03:44:40 -0500

yueweiliang gravatar image

updated 2018-12-27 04:37:07 -0500

gvdhoorn gravatar image

Nowdays I am using rosbag to save the msgs in my programs.I want to just change some of topic msgs in a saved bags, but keep the other msgs as what they once been.But when the program start, the first rosbag.read output is original saved msgs, but after the first rosbag.write is finished, the original saved msgs have been cleared, and just what the first rosbag.write write in the rosbag.I don't know how to edit the code in this, they are always Confused.

what I say is for example: here is a rosbag which save a under topic A, b under topic B. Now a new process start! After call rosbag.write(c to Topic B). The rosbag only have c under topic B,and a-A is removed.Does it a bug?How can I keep the a-A still alive.

edit retag flag offensive close merge delete

Comments

Rosbag creates a new blank bag for each time, it's not intended to be able to update an existing bag file. There are complications with time stamps which make what you're trying to do complicated.

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-12-27 06:31:00 -0500 )edit

Thx for reply. Now I just copy the saved rosbag before rosbag.write, and then write the new rosbag with the copy msgs and new time stamp.

yueweiliang gravatar image yueweiliang  ( 2018-12-27 19:49:13 -0500 )edit

Glad you've found a solution

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2018-12-29 05:51:52 -0500 )edit

Can you share the code pls

anonymous userAnonymous ( 2022-03-31 03:21:51 -0500 )edit