0
$\begingroup$

Good day all,

I have a pair of cameras each publishing images at 30Hz. The resolution of each is 640x480.

System details:
RaspberryPi 5
Ubuntu 24.04
ROS JAZZY

When launching the camera publishers and viewing the image streams in RViz, everything looks fine: there doesn't appear to be any images dropped/missed and a very small latency.

However, when I record a bag file, after around 20 seconds, images start to drop out. This appears to get worse as time goes on. I am only recording the two image_raw topics, no other topics.

Here is a screenshot from rqt_bag, where one can see the messages begin to drop: dropping messages after around 20 seconds

A very similar question was asked here: https://answers.ros.org/question/389347/ros-dropping-messages-how-to-predict-it/

My CPU cores are all well under 30%. I am writing to disk at about 30Mb/s. So my issue does not seem to be CPU power.

I also played around a bit with QoS using the --qos-profile-overrides-path argument in ros2 bag record. I tried setting the same QoS as what was in RViz and also tried different settings for history, reliability and durability. But no improvement. I also have the argument --max-cache-size 0.

Does anyone have some suggestions please for things I could try? As far as I can see, the system does not seem to be limited and should be able to successfully record all the images.

$\endgroup$

2 Answers 2

1
$\begingroup$

Are you recording on the same host that is running the camera driver? If so then try using composable nodes. The idea is to load the camera driver and the rosbag recorder into the same address space, so the transport is eliminated as a source of trouble. This also cuts down on memory copies, leading to a much more performant system.

$\endgroup$
5
  • $\begingroup$ Thanks @Bernd that is a great suggestion. I will try it in the coming days and report back. And yes, same host that is running the camera driver. $\endgroup$
    – BryanGD123
    Commented Aug 31 at 8:51
  • $\begingroup$ Had a chance to implement today. Not quite working yet. A bagfile is made but it is always empty. I have the following yaml recorder: ros__parameters: use_sim_time: false record: all: true is_discovery_disabled: false topic_polling_interval: sec: 0 nsec: 10000000 start_paused: false storage: uri: "/path/to/bag_file" max_cache_size: 200000000 I will continue to work on it, but if you have any tips, please do let me know, thanks! @Bernd $\endgroup$
    – BryanGD123
    Commented Sep 3 at 13:49
  • $\begingroup$ Okay it seems my camera driver needs to be set up correctly with intra-process communication $\endgroup$
    – BryanGD123
    Commented Sep 3 at 15:09
  • $\begingroup$ okay it's working now and the recording is much better! Thanks for the help. FYI there is a mistake in their documentation of the parameters, all should be all_topics $\endgroup$
    – BryanGD123
    Commented Sep 3 at 17:42
  • $\begingroup$ Glad to hear you got it working and thanks for pointing out the docs error. Pull request for fixing the docs is here $\endgroup$ Commented Sep 4 at 22:54
0
$\begingroup$

Is there any reason for using the --max-cache-size 0 CLI option with the rosbag2 recorder?

Cache usually helps a lot to avoid messages being lost during recording.

$\endgroup$
1
  • $\begingroup$ from the documentation for ros2 bag record: If the value specified is 0, then every message is directly written to disk. $\endgroup$
    – BryanGD123
    Commented Sep 6 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.