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

how bagfile avoid to be rewritten [closed]

asked 2015-07-01 13:23:11 -0500

YiboLyu gravatar image

When I try to use bag file to store data, I find the bag file only store the data that I write last time. Last time means the last time to open the bag file and write data. Anybody knows how to add data to bag file?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by YiboLyu
close date 2015-07-02 12:44:17.186115


I do not know if this is possible. However, you can always save bags with different name and the reproduce them in a sequence with a script.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-07-01 14:03:36 -0500 )edit

Thank you for reply. Yes, I am doing exactly now as you say but I still want to see if adding data is possible. Anyway, thanks.

YiboLyu gravatar image YiboLyu  ( 2015-07-01 14:23:48 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-07-02 12:43:59 -0500

YiboLyu gravatar image

I find the solution. Just change the bag open mode as bag = rosbag.Bag('test.bag', 'a') Mode 'a' means add in the file.

edit flag offensive delete link more


I'm happy you found the solution. However, your question was incomplete as I assumed you wanted to it from terminal instead of programatically :) How do will you deal with the difference in timestamps? Will the be a problem?

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-07-02 15:31:41 -0500 )edit

No. I use it in program not terminal. Actually, in my program, I record two timestamps by myself and I just omit its timestamp. : ) Is it kind of cheating?

YiboLyu gravatar image YiboLyu  ( 2015-07-02 15:54:52 -0500 )edit

I don't think that is cheating. Most algorithms will not require the timestamp, other to check that a new message has arrived, or something like that.

Javier V. Gómez gravatar image Javier V. Gómez  ( 2015-07-03 01:51:45 -0500 )edit

Question Tools

1 follower


Asked: 2015-07-01 13:23:11 -0500

Seen: 75 times

Last updated: Jul 02 '15