Ask Your Question
1

Detect messages dropped by ros2 bag record

asked 2021-11-23 09:29:29 -0500

simong gravatar image
  • Platform: Ubuntu 20.04
  • ROS version: ROS2 foxy

I'm using ros2 bag record to record data published by my own nodes. I know the expected message rate of my nodes and can therefore calculate the expected number of messages in the bag file given the "duration" and "message count" provided by ros2 bag info.

My node publishes data on a single topic. When I run a single node and record the data published on its topic, I'm getting the expected number of messages in the bag file. If I instantiate two nodes and record the data from both topics, there are less messages in the bag file than expected.

I'm assuming this is some performance issue as the data rate of such a topic is rather high (~120 MB/s). Before starting to tune performance, I want to find a reliable way to detect if ros2 bag record is unable to record any of the incoming data. For my application, dropping data is not allowed and therefore this needs to be at least detected to avoid ending up with a bag file with missing data.

Is there any way to detect messages being dropped by ros2 bag record? Can this be somehow controlled by setting QoS appropriately? I have tried setting QoS of my publishing node to KeepAll but this has not prevented drops.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-11-26 05:52:50 -0500

simong gravatar image

I was able to solve this issue by overriding the QoS settings of ros2 bag record by using the --qos-profile-overrides-path option. I'm using the following QoS settings for each topic I'm recording:

<topic name>:
  durability: volatile
  history: keep_all
  reliability: reliable

The QoS of my publishers is rclcpp::QoS(10). Using these QoS overrides prevents ros2 bag record to drop any messages.

Note that the ros2 bag performance of the foxy package is not very good. This will cause the data to pile up in memory if ros2 bag record is not able to save to disk quickly enough, eventually running out of memory. To solve this issue, use ros2 bag from the foxy-futurebranch, see https://github.com/ros2/rosbag2/tree/...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-11-23 09:29:29 -0500

Seen: 250 times

Last updated: Nov 26 '21