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

Something like rosbag but it keeps a rolling buffer and saves a file only when you want to

asked 2019-10-08 19:02:45 -0600

Jari gravatar image

Is there any existing tool that will record a bag file but instead of continuing to record would instead discard any data past some set time threshold (so if the threshold is 1 hour, at any given point it has the data up to one hour before the current time). Ideally this would allow one to call a service to save this data into a proper bagfile which can be then used for deeper investigation.

The usecase in mind is situations where some extraordinary event has happened to a robot (e.g. massive localization failure) and a bag file of data leading up to the event would be useful for fixing whatever bug may have caused the problem. I have thoughts about how something like this could be made but want to check if maybe something already exists.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-10-08 19:13:15 -0600

sloretz gravatar image

For ROS 1, there is a pull request adding a rosbag snapshot command that sounds like it does what you'd like. Maybe it will take less time to pick it up than to start from scratch?

edit flag offensive delete link more


Thank you!

Jari gravatar image Jari  ( 2019-10-08 19:38:42 -0600 )edit

The snapshot command is good, but personally I've been eying something like strands-project/mongodb_store#245 (MongoDB with a "capped collection", which would essentially be a "rolling buffer").

gvdhoorn gravatar image gvdhoorn  ( 2019-10-09 03:16:12 -0600 )edit

There is also the --split and --max-splits option for rosbag record. I usually set the split to 1m and the max splits to 2 or 3. This has the effect of saving the last 2-3 minutes of topics. Recording to a tmpfs partition removes the disk I/O performance hit. I also found record_ros to programmatically start and stop rosbag recordings. You can modify record_ros to provide more options such as split and max_splits.

jeremya gravatar image jeremya  ( 2019-10-12 10:37:29 -0600 )edit

answered 2021-08-21 08:42:00 -0600

rex-schilasky gravatar image

For ROS2 you could use this RMW rmw_ecal and then make use of the powerful recording tools (GUI and command line) from the eCAL project. There are many options like prebuffering, splitting, synchronized decentral recording over multiple host and so on ...

Introduction can be found here and a detailed documentation here. We use that for massive, synchronized data recording in the area of autonomous driving.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-10-08 19:02:45 -0600

Seen: 1,155 times

Last updated: Aug 21 '21