ROS2 Image publisher slows down on subscription
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.
Asked by nplan on 2020-10-22 11:38:58 UTC
Answers
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.
Asked by JLBuenoLopez-eProsima on 2020-10-27 01:46:47 UTC
Comments
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.
Asked by nplan on 2020-10-27 12:50:59 UTC
Have you tried these troubleshooting solutions?
Asked by JLBuenoLopez-eProsima on 2020-10-29 04:26:50 UTC
I tried those - no change.
Asked by nplan on 2020-10-31 14:59:25 UTC
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.
Asked by swiz23 on 2022-11-02 17:05:05 UTC
Comments
Do you have any update on this? We currently encountered the same issue, we did not find a solution yet.
Asked by siposcsaba89 on 2021-04-13 06:37:25 UTC