Subscribe to remote topic without slowing down the remote machine
Hi all
I am using ROS 2 humble in an academic context. We have a model car equiped with a motor and some sensors including a camera. The camera is used for lane detection. All image-processing happens on the car. Within the car's system, data transfer happens via local inter-process-communication faciliated by image_transport::CameraPublisher
and the default eProsima Fast DDS.
During development, it is helpful to view the camera output while the car is moving. To achieve this, we rely on ROS 2's integrated network capabilities. On another machine (a laptop) we simply open up an image viewer like rqt. The machines are connected via wireless LAN.
Camera Node ─┬─► Computer Vision Node ──► Motor Control Node
(wifi)
└─► Image Viewer
Now for the problem: If the wireless network is saturated, the publisher in the Camera Node starts slowing down. The overall frame-rate decreases to the point the control loop becomes unstable and the car crashes into things. This shows: Subscribing to the remote topic comes with some nasty side-effects – a Heisenbug, but in reverse.
It does not matter if I use rmw_qos_profile_default
with RMW_QOS_POLICY_RELIABILITY_RELIABLE
or rmw_qos_profile_sensor_data
with RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT
. I even adjusted the deadline
and lifespan
to match the desired frame-rate, but it makes no difference. If the network is too busy, I receive no frames at all. I expected frames to be dropped, but at least one frame every couple of seconds should be doable.
I understand that I cannot have reliable real-time wireless data transfer, but connecting a remote subscriber should never affect its internal communication this way. How can I subscribe to the camera without affecting the car's performance?
Kind Regards