![]() * Block rmw_send_response if response reader unknown The client checks using rmw_service_server_is_available whether the request it sends will be delivered to service, but that does not imply that the (independent, as far as DDS is concerned) response reader of the client has been discovered by the service. Usually that will be the case, but there is no guarantee. Ideally DDS would offer an interface that allows checking the reverse discovery, but that does not yet exist in either the specification or in Cyclone. This commit works around that by delaying publishing the response until the number of request writers matches the number of response readers. Signed-off-by: Erik Boasson <eb@ilities.com> * Change request headers to use rmw_request_id_t on the wire Signed-off-by: Erik Boasson <eb@ilities.com> * Precise check for matched client/service Assign a unique identifier to each client/service on creation, add it to the USER_DATA QoS of the reader and writer and use it for the request ids. This allows: * rmw_service_server_is_available to only return true once it has discovered a reader/writer pair of a single service (rather than a reader from some service and a writer from some service); and * rmw_send_response to block until it has discovered the requesting client's response reader and to abandon the operation when the client has disappeared. The USER_DATA is formatted in the same manner as the participant USER_DATA, this uses the keys "serviceid" and "clientid". This is still but a workaround for having a mechanism in DDS to ensure that the response reader has been discovered prior by the request writer prior to sending the request. Signed-off-by: Erik Boasson <eb@ilities.com> * Address review comments Signed-off-by: Erik Boasson <eb@ilities.com> * Backwards compatibility * Revert commit fb040c5db6c05be7698f05969f9bb48b8740f0fe to retain the old wire representation; * Embed the publication_handle of the request inside rmw_request_id_t, possible because reverting to the old wire representation frees up enough space, and use this in rmw_send_response to check for the presence of the client's reader; * Clients and services without a client/service id in the reader/writer user data are treated as fully matched at all times. * Replace ERROR by FAILURE to because of windows.h Signed-off-by: Erik Boasson <eb@ilities.com> * Timeout rmw_send_response after waiting 100ms for discovery The discovery will eventually result in the client's reader being known or its writer no longer being known, so a timeout is not necessary for correctness. However, if it ever were to block for a longish time (which is possible in the face of network failures), returning a timeout to the caller is expected to result in less confusion. Signed-off-by: Erik Boasson <eb@ilities.com> * Make iterators "const auto &" Signed-off-by: Erik Boasson <eb@ilities.com> * Add TODO for eliminating rmw_send_response blocking Signed-off-by: Erik Boasson <eb@ilities.com> Co-authored-by: eboasson <eb@ilities.com> |
||
---|---|---|
.github | ||
rmw_cyclonedds_cpp | ||
CONTRIBUTING.md | ||
LICENSE | ||
README.md |
ROS2 RMW for Eclipse Cyclone DDS
Easy, fast, reliable, small Eclipse Cyclone DDS middleware for ROS2. Make your 🐢 run like a 🚀 Eclipse Cyclone DDS has great adopters and contributors in the ROS community and is an Eclipse Foundation open source project of Eclipse IoT and OpenADx (autonomous driving).
This package lets ROS2 use Eclipse Cyclone DDS as the underlying DDS implementation. Cyclone DDS is ready to use. It seeks to give the fastest, easiest, and most robust ROS2 experience. Let the Cyclone blow you away!
-
Install:
apt install ros-eloquent-rmw-cyclonedds-cpp
or
apt install ros-dashing-rmw-cyclonedds-cpp
-
Set env variable and run ROS2 apps as usual:
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
-
Confirm RMW: In Eloquent and later, to confirm which RMW you're using:
ros2 doctor --report
Performance recommendations
With large samples (100s of kilobytes), excessive latency can be caused by running out of space in the OS-level receive buffer. For this reason, on Linux, we recommend increasing the buffer size:
- Temporarily (until reboot):
sudo sysctl -w net.core.rmem_max=8388608 net.core.rmem_default=8388608
- Permanently:
echo "net.core.rmem_max=8388608\nnet.core.rmem_default=8388608\n" | sudo tee /etc/sysctl.d/60-cyclonedds.conf
Debugging
So Cyclone isn't playing nice or not giving you the performance you had hoped for? That's not good... Please file an issue against this repository!
The ddsperf
tool distributed with Cyclone DDS can be used to check that communication works without ROS. Run ddsperf sanity
on two different machines - if the "mean" value is above 100000us
, there are likely network issues.
If you're having trouble with nodes discovering others or can't use multicast at all on your network setup, you can circumvent discovery:
export CYCLONEDDS_URI='<Discovery><Peers><Peer Address='myroshost.local' /><Peer Address='myroshost2.local' /></></>'
Here are some ways to generate additional debugging info that can help identify the problem faster, and are helpful on an issue ticket:
-
Configure Cyclone to create richer debugging output:
-
To see the output live:
export CYCLONEDDS_URI='<Tracing><Verbosity>trace</><Out>stderr</></>'
-
To send to
/var/log/
:export CYCLONEDDS_URI='<Tracing><Verbosity>trace</><Out>/var/log/cyclonedds.${CYCLONEDDS_PID}.log</></>'
-
-
Create a Wireshark capture:
wireshark -k -w wireshark.pcap.gz
Building from source and contributing
The following branches are actively maintained:
master
, which targets the upcoming ROS version, Foxy.dashing-eloquent
, which maintains compatibility with ROS releases Dashing and Eloquent
If building ROS2 from source (ros2.repos), you already have this package and Cyclone DDS:
cd /opt/ros/master
rosdep install --from src -i
colcon build
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp