A could work as a TURN
Repeater to forward messages by the same Participant. If you are interested in understanding the use case of a Repeater please refer to the following section use_case_repeater
.
The version attribute is required, as the repeater
tag is only supported from v4.0 configuration version.
../../resources/examples/repeater_server.yaml
This section lists the Topics <Topic>
that the DDS Router will route from one Participant to the other. Topic HelloWorldTopic
with datatype HelloWorld
, and ROS 2 topic rt/chatter
with datatype std_msgs::msg::dds_::String_
will be forwarded from one domain to the other, allowing different DDS domains to interact with each other.
../../resources/examples/repeater_server.yaml
The Repeater Participant is the one that will be used to forward messages by the same Participant. It must be a WAN
Participant and be configured as so with WAN configuration <user_manual_wan_configuration>
.
../../resources/examples/repeater_server.yaml
Every Client can connect to a Repeater Participant as if it was a normal WAN
Participant. The Repeater admits as many edge connections as desired, so several can use the same or similar configuration to communicate across it.
../../resources/examples/repeater_client.yaml
Please refer to this section <user_manual_user_interface>
for a detailed explanation on how to execute the .
In order to run this example, there must be three different hosts located in different local networks:
- host HA with private IP
192.168.1.2
connected to network router RA with public IP1.1.1.1
. - host HB with private IP
192.168.2.2
connected to network router RB with public IP2.2.2.2
. - host HC with private IP
192.168.2.3
connected to network router RC with public IP3.3.3.3
.
This example could be run in localhost or with two hosts in the same LAN, but it will not use the WAN communication features of the .
This host runs the Repeater Server, which will receive data from both edges and redirect the messages between them. Execute using file <path/to/ddsrouter_tool>/share/resources/configurations/examples/repeater.yaml
. Remember to change the IP and port on the configuration file to the actual public IP of RA, and be sure that the port forwarding rules are configured in RA so HA is accessible from the outside.
These hosts run the WAN Clients, which will connect to the previously launched Repeater Server. Execute using file <path/to/ddsrouter_tool>/share/resources/configurations/examples/wan_client.yaml
. Remember to change the IPs and ports on the configuration file to the actual public IPs of RA and RB. In this example the port forwarding is not required, as the Repeater will allow the communication through it, and TCP protocol is being used..
Both clients can execute ROS 2 demo nodes, which will publish and subscribe in topic rt/chatter
. Execute a talker
in one of them and a listener
in the other. It is recommended to use different ROS_DOMAIN_ID
in each node, so in case both nodes are accessible (under same network) no loop is created. In order to do so, change the YAML configuration files to use different domains, and use the following ROS2 commands:
# Hb
ROS_DOMAIN_ID=0 ros2 run demo_nodes_cpp talker
# Hc
ROS_DOMAIN_ID=1 ros2 run demo_nodes_cpp listener
After executing the three applications in hosts, and talker and listener applications, the listener in HC will start receiving and printing data from the talker in HB. You are communicating DDS via WAN.
Note
If HB can access HC due to port forwarding or because both are under the same network, the listener
will receive duplicated messages, as one of them will arrive from HB and the other from HA.