1. Echo Example

The following YAML configuration file configures a DDS Router to create a Simple Participant in Domain Id 0 and an Echo Participant that will print in stdout every message get in Domain 0.

##################################
# ALLOWED TOPICS
# Allowing FastDDS and ROS2 HelloWorld demo examples topics

allowlist:
  [
    {name: "HelloWorldTopic", type: "HelloWorld"},                    # 1
    {name: "rt/chatter", type: "std_msgs::msg::dds_::String_"},       # 2
  ]

##################################
# SIMPLE PARTICIPANT
# This participant will subscribe to topics in allowlist in specific domain and listen every message published there

SimpleParticipant:                                                    # 3
  type: local                                                         # 4
  domain: 0                                                           # 5

##################################
# ECHO PARTICIPANT
# This Participant will print in stdout every message received by the other Participants

EchoParticipant:                                                      # 6
  type: echo                                                          # 7

1.1. Configuration

1.1.1. Allowed Topics

This section lists the Topics 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 SimpleParticipant to EchoParticipant, that will print the message in stdout.

allowlist:
  [
    {name: "HelloWorldTopic", type: "HelloWorld"},                    # 1
    {name: "rt/chatter", type: "std_msgs::msg::dds_::String_"},       # 2
  ]

1.1.2. Simple Participant

This Participant is configured with a name, a type and the Domain Id, which is 0 in this case.

SimpleParticipant:                                                    # 3
  type: local                                                         # 4
  domain: 0                                                           # 5

1.1.3. Echo Participant

This Participant does not require further configuration than name and type.

EchoParticipant:                                                      # 6
  type: echo                                                          # 7

1.2. Execute example

For a detailed explanation on how to execute the DDS Router, refer to this section.

1.2.1. Execute with Fast DDS HelloWorld Example

Execute a Fast DDS HelloWorld example:

./DDSHelloWorldExample publisher

Execute DDS Router with this configuration file (available in <path/to/ddsrouter>/src/ddsrouter/resources/configurations/examples/echo.yaml). The expected output from the DDS Router, printed by the Echo Participant is:

Echo Participant: ParticipantId{EchoParticipant} has received from Endpoint: 01.0f.44.59.e6.de.2a.c8.01.00.00.00|0.0.1.3 in topic: Topic{HelloWorldTopic, HelloWorld} the following payload: <Payload{00 01 00 00 01 00 00 00 0b 00 00 00 48 65 6c 6c 6f 57 6f 72 6c 64 00 00}>
Echo Participant: ParticipantId{EchoParticipant} has received from Endpoint: 01.0f.44.59.e6.de.2a.c8.01.00.00.00|0.0.1.3 in topic: Topic{HelloWorldTopic, HelloWorld} the following payload: <Payload{00 01 00 00 02 00 00 00 0b 00 00 00 48 65 6c 6c 6f 57 6f 72 6c 64 00 00}>
...
Echo Participant: ParticipantId{EchoParticipant} has received from Endpoint: 01.0f.44.59.e6.de.2a.c8.01.00.00.00|0.0.1.3 in topic: Topic{HelloWorldTopic, HelloWorld} the following payload: <Payload{00 01 00 00 0a 00 00 00 0b 00 00 00 48 65 6c 6c 6f 57 6f 72 6c 64 00 00}>

1.2.2. Execute with ROS 2 demo nodes

Execute a ROS 2 demo_nodes_cpp talker in default domain 0:

ros2 run demo_nodes_cpp talker

Execute DDS Router with this configuration file (available in <path/to/ddsrouter>/src/ddsrouter/resources/configurations/examples/echo.yaml). The expected output from the DDS Router, printed by the Echo Participant is:

Echo Participant: ParticipantId{EchoParticipant} has received from Endpoint: 01.0f.44.59.33.e0.2b.cf.01.00.00.00|0.0.12.3 in topic: Topic{rt/chatter, std_msgs::msg::dds_::String_} the following payload: <Payload{00 01 00 00 0f 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 20 34 00 00}>
Echo Participant: ParticipantId{EchoParticipant} has received from Endpoint: 01.0f.44.59.33.e0.2b.cf.01.00.00.00|0.0.12.3 in topic: Topic{rt/chatter, std_msgs::msg::dds_::String_} the following payload: <Payload{00 01 00 00 0f 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 20 35 00 00}>
...