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

Utility to Record Sensor Data after Safety Event

asked 2020-10-30 13:06:42 -0600

JackB gravatar image

updated 2020-10-30 13:52:43 -0600

During robot operations there may be a safety event that interrupts the process and should be documented. The prior 10-20 seconds of sensor data (lidar, odom, vision) would be good documentation about the event and we would like to have this data saved to the disk after the safety event is triggered.

Is there any pre-existing utility (particularly related to bag files) that can be used to produce this behavior (i.e. save the last 20 seconds of sensor data to disk after a boolean condition is triggered)?

Thanks so much!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2020-10-31 09:48:19 -0600

gvdhoorn gravatar image

updated 2020-10-31 10:16:26 -0600

It's not safety-rated, but ros/rosbag_snapshot seems like it would cover your use-case:

Solution for this ros_comm issue which acts similarly to the deprecated rosrecord -s command but with additional features. It is added as a new package here rather than patching rosbag based on the discussion here.

It subscribes to topics and maintains a buffer of recent messages like a dash cam. This is useful in live testing where unexpected events can occur which would be useful to have data on but the opportunity is missed if rosbag record was not running (disk space limits make always running rosbag record impracticable). Instead, users may run snapshot in the background and save data from the recent past to disk as needed.

Note: rosbag_snapshot has been released into both Kinetic, Melodic and Noetic, so no need to build it from source (sudo apt install ros-*-rosbag-snapshot should work on supported platforms).

edit flag offensive delete link more
1

answered 2020-10-30 14:55:06 -0600

I would go about that using http://wiki.ros.org/mongodb_log. The use-case you describe is similar to what they describe under "Application in fault Analysis" on their project page. Using mongodb for storage of time-stamped messages clearly provides you with more flexibility in terms of retrieval than a sequentially written bag file. Assuming that mongodb_log already indexes their collection by __recorded you should be able to retrieve the last X seconds easily and also regularly delete anything older than that.

edit flag offensive delete link more

Comments

Yes, Mongo DB is a good tool for this. Also not ROS-specific, so could be useful for other things as well.

gvdhoorn gravatar image gvdhoorn  ( 2020-10-31 09:49:09 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-10-30 13:06:42 -0600

Seen: 267 times

Last updated: Oct 31 '20