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, as well as information regarding discovery events.

##################################
# CONFIGURATION VERSION
version: v4.0                                                         # 0

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

allowlist:
  - name: HelloWorldTopic                                             # 1
    type: HelloWorld                                                  # 1
  - name: rt/chatter                                                  # 2
    type: std_msgs::msg::dds_::String_

##################################
# PARTICIPANTS
participants:

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

  - name: SimpleParticipant                                           # 3
    kind: local                                                       # 4
    domain: 0                                                         # 5

##################################
# ECHO PARTICIPANT
# This Participant will print in stdout every message received by the other Participants, as well as discovery information

  - name: EchoParticipant                                             # 6
    kind: echo                                                        # 7
    discovery: true                                                   # 8
    data: true                                                        # 9
    verbose: true                                                     # 10

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                                             # 1
    type: HelloWorld                                                  # 1
  - name: rt/chatter                                                  # 2
    type: std_msgs::msg::dds_::String_

1.1.2. Simple Participant

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

  - name: SimpleParticipant                                           # 3
    kind: local                                                       # 4
    domain: 0                                                         # 5

1.1.3. Echo Participant

This Participant is configured to display information regarding messages received, as well as discovery events. See Echo Participant Configuration for more details.

  - name: EchoParticipant                                             # 6
    kind: echo                                                        # 7
    discovery: true                                                   # 8
    data: true                                                        # 9
    verbose: true                                                     # 10

1.2. Execute example

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

Note

Internal entities for a specific topic are only created once a data receiver (Reader/Subscriber) is discovered. Hence, for these example to work, either substitute allowlist for builtin-topics in the configuration file, or launch a subscriber/listener in the same domain (0).

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_tool>/share/resources/configurations/examples/echo.yaml). The expected output from the DDS Router, printed by the Echo Participant is:

New endpoint discovered: Endpoint{01.0f.b8.d9.81.30.3d.a7.01.00.00.00|0.0.1.3;writer;DdsTopic{HelloWorldTopic;HelloWorld;Fuzzy{Level(20) TopicQoS{TRANSIENT_LOCAL;RELIABLE;SHARED;depth(5000)}}};SpecificEndpointQoS{Partitions{};OwnershipStrength{0}};Active;ParticipantId{SimpleParticipant}}.
In Endpoint: 01.0f.b8.d9.81.30.3d.a7.01.00.00.00|0.0.1.3 from Participant: ParticipantId{SimpleParticipant} in topic: DdsTopic{HelloWorldTopic;HelloWorld;Fuzzy{Level(20) TopicQoS{VOLATILE;BEST_EFFORT;SHARED;depth(5000)}}} payload received: 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} with specific qos: SpecificEndpointQoS{Partitions{};OwnershipStrength{0}}.
In Endpoint: 01.0f.b8.d9.81.30.3d.a7.01.00.00.00|0.0.1.3 from Participant: ParticipantId{SimpleParticipant} in topic: DdsTopic{HelloWorldTopic;HelloWorld;Fuzzy{Level(20) TopicQoS{VOLATILE;BEST_EFFORT;SHARED;depth(5000)}}} payload received: 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} with specific qos: SpecificEndpointQoS{Partitions{};OwnershipStrength{0}}.
...
In Endpoint: 01.0f.b8.d9.81.30.3d.a7.01.00.00.00|0.0.1.3 from Participant: ParticipantId{SimpleParticipant} in topic: DdsTopic{HelloWorldTopic;HelloWorld;Fuzzy{Level(20) TopicQoS{VOLATILE;BEST_EFFORT;SHARED;depth(5000)}}} payload received: 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} with specific qos: SpecificEndpointQoS{Partitions{};OwnershipStrength{0}}.

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_tool>/share/resources/configurations/examples/echo.yaml). The expected output from the DDS Router, printed by the Echo Participant is:

New endpoint discovered: Endpoint{01.0f.b8.d9.b6.3a.7d.95.01.00.00.00|0.0.1.3;writer;DdsTopic{ros_discovery_info;rmw_dds_common::msg::dds_::ParticipantEntitiesInfo_;Fuzzy{Level(20) TopicQoS{TRANSIENT_LOCAL;RELIABLE;SHARED;depth(5000)}}};SpecificEndpointQoS{Partitions{};OwnershipStrength{0}};Active;ParticipantId{SimpleParticipant}}.
New endpoint discovered: Endpoint{01.0f.b8.d9.b6.3a.7d.95.01.00.00.00|0.0.2.4;reader;DdsTopic{ros_discovery_info;rmw_dds_common::msg::dds_::ParticipantEntitiesInfo_;Fuzzy{Level(20) TopicQoS{TRANSIENT_LOCAL;RELIABLE;SHARED;depth(5000)}}};SpecificEndpointQoS{Partitions{};OwnershipStrength{0}};Active;ParticipantId{SimpleParticipant}}.
...
New endpoint discovered: Endpoint{01.0f.b8.d9.b6.3a.7d.95.01.00.00.00|0.0.12.3;writer;DdsTopic{rt/chatter;std_msgs::msg::dds_::String_;Fuzzy{Level(20) TopicQoS{VOLATILE;RELIABLE;SHARED;depth(5000)}}};SpecificEndpointQoS{Partitions{};OwnershipStrength{0}};Active;ParticipantId{SimpleParticipant}}.
In Endpoint: 01.0f.b8.d9.b6.3a.7d.95.01.00.00.00|0.0.12.3 from Participant: ParticipantId{SimpleParticipant} in topic: DdsTopic{rt/chatter;std_msgs::msg::dds_::String_;Fuzzy{Level(0) TopicQoS{VOLATILE;BEST_EFFORT;SHARED;depth(1000)}}} payload received: Payload{00 01 00 00 0f 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 20 31 00 00} with specific qos: SpecificEndpointQoS{Partitions{};OwnershipStrength{0}}.
In Endpoint: 01.0f.b8.d9.b6.3a.7d.95.01.00.00.00|0.0.12.3 from Participant: ParticipantId{SimpleParticipant} in topic: DdsTopic{rt/chatter;std_msgs::msg::dds_::String_;Fuzzy{Level(0) TopicQoS{VOLATILE;BEST_EFFORT;SHARED;depth(1000)}}} payload received: Payload{00 01 00 00 0f 00 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 3a 20 32 00 00} with specific qos: SpecificEndpointQoS{Partitions{};OwnershipStrength{0}}.
...