CodeTheRobot

Ubuntu Linux for Robotics · Lesson 27 of 96

Understanding DDS networking: Fast DDS and Cyclone DDS

Choosing an RMW, domains, interfaces and reading discovery problems.

Estimated time · 60–90 min

Learning goals

What you will understand

  • Explain understanding dds networking: fast dds and cyclone dds in your own words
  • Use it in a small workstation example
  • Verify the result instead of assuming it worked

Understand the idea first

The mental model

ROS 2 sends data with DDS, using UDP. Two open-source implementations are common: eProsima Fast DDS (rmw_fastrtps_cpp) and Eclipse Cyclone DDS (rmw_cyclonedds_cpp). Pick one with RMW_IMPLEMENTATION and make sure every machine in the system uses the same. ROS_DOMAIN_ID (0–101) isolates groups of nodes: nodes in different domains cannot see each other.

Discovery uses multicast on the local network, then unicast for data. When nodes cannot see each other: check the domain ID, the RMW, that the machines are on the same subnet, and that multicast is allowed. Use ros2 doctor and tcpdump to see whether discovery packets are sent and received.

Guided lesson

Work through these steps

  1. 1.

    Open a terminal and record the current state before changing anything.

  2. 2.

    Read the understanding dds networking: fast dds and cyclone dds commands and predict what each one does.

  3. 3.

    Run the commands one at a time and compare each output with your prediction.

  4. 4.

    Write the commands that worked in a setup note you can repeat later.

Worked example

Read it before you run it

sudo apt install ros-lyrical-rmw-cyclonedds-cpp
# Install Cyclone DDS support.
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
# Use Cyclone DDS in this terminal.
export ROS_DOMAIN_ID=30
# Use domain 30, isolating this system from others.
ros2 doctor --report | grep -i middleware
# Confirm which middleware is active.
ros2 multicast receive
# On one machine: listen for multicast test packets.
ros2 multicast send
# On another machine: send them; if received, multicast works.

What the example is doing

  1. 1.Lines without sudo only inspect or change files you own; sudo authorizes a system-wide change.
  2. 2.Read command output before moving to the next line. Stop if names, versions, disks, or paths differ from the lesson.
  3. 3.Comments beginning with # explain safety checks and are not executed by the shell.

Watch it run · Messages between nodes

See what this code does

The terminal types this lesson's practice solution and runs it. The scene shows the kind of robot behaviour that code drives. It plays by itself and loops.

/topicpublishersubscribersubscribermessages delivered: 0MESSAGES BETWEEN NODES

Demo for Understanding DDS networking: Fast DDS and Cyclone DDS. Expected result: Received: a multicast message from the other machine

Practice code

Now type it yourself

Open a terminal, run the starter line by line (or save it as practice.sh and run bash practice.sh), and replace every TODO with your own command.

# Machine A
ros2 multicast receive
# Machine B
# TODO: send a multicast test message with the ros2 multicast tool

Expected output

Received: a multicast message from the other machine
Stuck? Show the full solution (try it yourself first)
# Machine A
ros2 multicast receive
# Machine B
ros2 multicast send

Expected result

How you know it worked

  • Each command completes without an unexplained error.
  • Your notes contain the command, the important output, and what it proves.

Practical exercise

Apply the lesson

Run a talker on one computer and a listener on another with both RMWs, then change the domain ID on one side and observe the failure. Use ros2 multicast to test the network first.

Before you continue

  • You recorded the starting state
  • Every command and output is understood
  • The change can be repeated from your notes

If something goes wrong

A command says permission denied.

Check ownership and permissions first. Do not add sudo unless the command changes a documented system location.

A command or package is not found.

Check spelling, Ubuntu version, enabled repositories, and whether the previous installation command succeeded.