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

How do I append/add to a rosbag file without overwriting it in Python?

asked 2016-05-19 09:07:47 -0500

newbsaibot gravatar image

Basically I was testing recording data to a rosbag using a timestamp.

I noticed that every time I open and close the file it just rewrites the data, so I just leave the file open when the program starts and close it when it ends. However if I want to write to that same file it just overwrites all of the data.

How can I just append/add onto the same bag file?

edit retag flag offensive close merge delete


I use rosbag to open a new bag file in append mode and it throws an ROSBagException : empty file any inputs how to solve this ?

sai krishna gravatar image sai krishna  ( 2019-03-14 14:49:41 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-05-19 11:51:49 -0500

ahendrix gravatar image

I don't think the rosbag file format or the API supports appending to a file.

Instead, the rosbag API supports seamlessly opening and reading from multiple bag files, so if I have multiple logging sessions, I record one bag file during each and then open all of them together when I want to analyze the data.

edit flag offensive delete link more

answered 2019-01-14 13:44:48 -0500

Appending might not be in the command line interface, but the C++ Interface supports opening the bag file in a specific mode, Append being an available mode. It's probably too much work for most people to write a specific script to append each specific type of data to a bagfile, but if you need the ability to append, it's there.

edit flag offensive delete link more

Question Tools


Asked: 2016-05-19 09:07:47 -0500

Seen: 2,371 times

Last updated: Jan 14 '19