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

ROS2 Image publisher slows down on subscription

asked 2020-10-22 11:38:58 -0500

nplan gravatar image

When I run cam2image demo on one machine and subscribe to published image topic on another machine (connected over WiFi) using ros2 topic hz the frequency of the publisher drops from 30 Hz to 6 Hz.

I'm using ROS2 Foxy on Raspberry Pi 4 with Pi OS Buster (first machine) and Ubuntu 20.04 inside a VirtualBox (second machine).

1) I run cam2image demo on the first machine:

ros2 run image_tools cam2image --ros-args -p reliability:=best_effort -p height:=480 -p width:=640 -p frequency:=30.0 -p depth:=1

2) I subscribe on the first machine:

ros2 topic hz image

The frequency is 30 Hz as it should be. The CPU usage of cam2image is 30%.

3) Now I subscribe on the second machine:

ros2 topic hz image

The frequency of the publisher drops to 6 Hz, as measured by subscribers on both machines. The CPU usage of cam2image drops to 17%.

I find the drop of cam2image CPU usage very counterintuitive. If the frequency drops, one would assume CPU usage would increase.

I tried switching DDS from default Fast RTPS to Cyclone DDS on the Raspberry, but it doesnt make any difference.

edit retag flag offensive close merge delete


Do you have any update on this? We currently encountered the same issue, we did not find a solution yet.

siposcsaba89 gravatar image siposcsaba89  ( 2021-04-13 06:37:25 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2020-10-27 01:46:47 -0500

JLBuenoLopez-eProsima gravatar image

It seems related with this issue opened in rmw_fastrtps. Please, try the configurations suggested there and see if it is enough to solve your issue.

edit flag offensive delete link more


I tried your suggestion (xml profile here) but it didn't help. (you are missing a " in your xml in line 14 though)

It seems my issue is not related to Fast RTPS, since I get the same behaviour with Cyclone DDS.

nplan gravatar image nplan  ( 2020-10-27 12:50:59 -0500 )edit

Have you tried these troubleshooting solutions?

JLBuenoLopez-eProsima gravatar image JLBuenoLopez-eProsima  ( 2020-10-29 04:26:50 -0500 )edit

I tried those - no change.

nplan gravatar image nplan  ( 2020-10-31 14:59:25 -0500 )edit

I've run into this issue as well, and have not figured out a way to solve it yet. Though in my case, even having two subscriptions on the same machine caused the issue.

swiz23 gravatar image swiz23  ( 2022-11-02 17:05:05 -0500 )edit

Question Tools

1 follower


Asked: 2020-10-22 11:38:58 -0500

Seen: 2,206 times

Last updated: Oct 22 '20