eProsima ROS 2 Router, a.k.a DDS Router, is an end-user software application that enables the connection of distributed ROS 2 networks (see the documentation here <vulcanexus_router>
). That is, ROS 2 nodes such as publishers and subscriptions, or clients and services, deployed in one geographic location and using a dedicated local network will be able to communicate with other ROS 2 nodes deployed in different geographic locations on their own dedicated local networks as if they were all on the same network through the .
This tutorial explains how to apply some configurations to individual DDS Topics forwarded by the . In particular, we will configure two participants in different domains and communicate them with a . The will configure a specific Topic for one of the participants using this new topic settings option. In particular, in this tutorial, we will fix the maximum transmission rate (max-tx-rate
) of one of the topics for a specific participant, so that only this participant will apply this maximum publication rate only to this topic.
Note
This tutorial is similar to the tutorials_router_change_domain
tutorial, since we will launch a talker and a listener on different domains and connect them with a . The difference between both tutorials is that, in this one, we will limit the transmission rate for a participant on a topic to avoid clogging the connection.
The DDS protocol defines the Domain Id as a parameter for every DomainParticipant. Different entities in different Domain Ids will never discover each other, and thus they will not communicate with each other. The can be used as a bridge between ROS 2 Domains, so that every node in a domain can communicate with every other node on another domain, as illustrated in the following figure:
This tutorial will use the demo_nodes_cpp
package, available in the Vulcanexus Desktop distribution. Two ROS 2 nodes, a talker and a listener, will be launched on different ROS 2 Domains, so that they cannot communicate between each other. Then, the will be used as a bridge between the two Domains, allowing the listener to receive the messages from the talker.
To proceed, please install Vulcanexus with one of the following installation methods:
linux_binary_installation
linux_source_installation
docker_installation
Let us start by running the ROS 2 talker and listener nodes.
To run the nodes, we need to set up the Vulcanexus environment so that the demo_nodes_cpp
package is available. There are two ways to achieve this:
Running the Vulcanexus Docker image.
Run the Vulcanexus Docker image by executing:
docker run -it ubuntu-vulcanexus:iron-desktop
The Docker container will automatically setup the Vulcanexus environment on start up, but in case you installed Vulcanexus from binaries please do not forget to source the Vulcanexus installation first by executing:
source /opt/vulcanexus/iron/setup.bash
Setting up a development environment on the local host.
To do this, the
vucanexus-iron-desktop
package is needed, since it includes all the simulation tools, demos, and tutorials.Set up the Vulcanexus environment by executing:
source /opt/vulcanexus/iron/setup.bash
First, run the talker and listener to communicate using the default topic of the demo_nodes_cpp
ROS 2 package, that is, the chatter
topic.
Run a ROS 2 demo_nodes_cpp
talker on domain 0
:
ROS_DOMAIN_ID=0 ros2 run demo_nodes_cpp talker
Run a ROS 2 demo_nodes_cpp
listener on domain 1
:
ROS_DOMAIN_ID=1 ros2 run demo_nodes_cpp listener
So far, the listener will not receive anything as the ROS 2 publisher and the ROS 2 subscription are deployed on different ROS 2 Domains.
To deploy the , we need to create its configuration file.
The following YAML configuration file configures a with two Simple Participants in domains 0
and 1
, and a topic configuration to limit the transmission rate on one of the participants for a specific topic.
Note
This configuration enables listeners in domain 1
to subscribe to messages published in domain 0
, at a frequency of 1 Hz on topic secret
, and at an unlimited frequency on any other topic. It also enables listeners in domain 0
to subscribe to messages published in domain 1
at an unlimited frequency on any topic.
/resources/tutorials/cloud/conf_router_topic_qos/conf_router_topic_qos.yaml
The Simple Participants are configured with a name, a kind (local
), and a domain id (0
and 1
).
/resources/tutorials/cloud/conf_router_topic_qos/conf_router_topic_qos.yaml
We define the topic under the tag topics
. This topic is configured so that ROS_2_Domain_1
will publish at a maximum frequency of 1 Hz on topic secret
, and at an unlimited frequency on any other topic.
/resources/tutorials/cloud/conf_router_topic_qos/conf_router_topic_qos.yaml
Run the with the configuration file available at <path/to/file>/ros_2_router_with_manual_topics.yaml
.
ddsrouter -c <path/to/file>/ros_2_router_with_manual_topics.yaml
The output from the should be something like:
Starting DDS Router Tool execution.
DDS Router running.
If so, the has started correctly and it is currently running. In order to close the execution, press ^C or send a signal (SIGINT 2
or SIGTERM 15
) to close it.
The listener should now receive the messages sent by the talker at an unlimited rate as they are communicating through the chatter
topic.
Let us now run the ROS 2 talker and listener nodes on the topic secret
.
Run a ROS 2 demo_nodes_cpp
talker on domain 0
:
ROS_DOMAIN_ID=0 ros2 run demo_nodes_cpp talker --ros-args -r chatter:=secret
Run a ROS 2 demo_nodes_cpp
listener on domain 1
:
ROS_DOMAIN_ID=1 ros2 run demo_nodes_cpp listener --ros-args -r chatter:=secret
Since the has configured the secret
topic with a max-tx-rate
for the ROS_2_Domain_1
participant, the listener will receive messages at most at 1 Hz and it will print them in stdout
.
Run a ROS 2 demo_nodes_cpp
talker on domain 1
:
ROS_DOMAIN_ID=1 ros2 run demo_nodes_cpp talker --ros-args -r chatter:=secret
Run a ROS 2 demo_nodes_cpp
listener on domain 0
:
ROS_DOMAIN_ID=0 ros2 run demo_nodes_cpp listener --ros-args -r chatter:=secret
Since the does not have a specific topic configuration for the topic secret
on the ROS_2_Domain_0
participant, the listener will receive messages at an unlimited rate and it will print them in stdout
.
For all possible configurations that can be applied to the topics please refer to the Topic QoS section of the DDS Router documentation.