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
Asked by fhwedel-hoe on 2022-12-06 14:30:57 UTC
Answers
DDS was never intended be be used over wireless networks. I've used the zenoh dds bridge before, and it works really well. You may consider trying that: https://github.com/eclipse-zenoh/zenoh-plugin-dds.
This setup will look like camera node -> zenoh_bridge -> wifi -> zenoh_bridge -> rqt
This way you have localhost traffic between all your on-vehicle nodes, then a separate node just to push that traffic out. Be sure to ensure your laptop's rqt isn't still trying to talk directly to your on-vehicle nodes. You can change your laptops domain id to help.
Asked by ChuiV on 2022-12-16 13:16:14 UTC
Comments
Thank you for your suggestion. Yet I hope there is a better solution. For us, the inherent transparent network capabilities always were a significant feature of ROS 1. If those were no longer usable in ROS 2, that would be a huge disappointment.
Asked by fhwedel-hoe on 2022-12-19 05:29:20 UTC
I totally agree. I wish that dds would work better over wireless networks.
The zenoh dds bridge does help with that by specifically forwarding the ros2 discovery information (with some slight modifications) through the zenoh network. This makes the bridge nearly transparent,
If you're still wanting to do this "pure" ros2, you could take a look at the fastdds "Large Data Rates" document (https://fast-dds.docs.eprosima.com/en/latest/fastdds/use_cases/large_data/large_data.html) and see if any of those suggestions help you.
Asked by ChuiV on 2022-12-19 07:16:43 UTC
Comments