Skip to content

Important ROS Concepts

(under construction)


1. DDS (Data Distribution Service)

  • DDS is the communication system used under ROS 2 to let robots exchange data.
  • We can think of DDS like a post office for robots:
- One robot sends a message
- DDS delivers it to all robots that are interested
- No robot needs to know where other robots are
  • DDS is NOT a broker (unlike Publisher/Subscriber Model )
  • In a typical publisher/subscriber system, everything goes through a broker. For example, in MQTT or Kafka; However, in DDS there is direct communicatio between a two nodes.
Publisher → Broker → Subscriber
(in a broker-based system)


Publisher  ─────────▶ Subscriber
(In ROS: direct P2P)
  • DDS provides:
- discovery (find other nodes)
- message delivery rules
- reliability (guarantees / QoS)
- serialization of data

- But NOT routing through a broker.

2. DDS variants

  • We can think of ROS2 communication like messaging apps, where all robots need to “chat” with each other.
  • ROS2 gives them different “chat systems” to do it.
  • Lets consider that DDS is a kind of WhatsApp
  • DDS variant is Same WhatsApp idea, different companies making it. We can swap them like changing phone brands, not changing the app.
  • DDS variants = different implementations of the same communication system
(DDS from different vendors based on OMG)
(OMG = Object Management Group that defines the rules for software systems)


- Fast DDS (default in many ROS2 )
- Cyclone DDS (very common, simpler, stable)
- RTI Connext DDS (industrial / enterprise, very reliable)
- OpenSplice DDS (older, less common now)

3. Different ways to run ROS2 python programs

There are several ways to run Python-based ROS 2 applications, depending on the size and complexity of the project.

Method 1: Run a script directly

Run like a standard python script

Example

python3 my_node.py

or 
./my_mode.py

Method 2: Colcon and ros2 run

In this approach, the Python node is added to a proper ROS2 package and built using colcon. After building, the node becomes part of the ROS 2 infrastructure.

# Step 1: Build the workspace
colcon build

# Step 2: Source the workspace
source install/setup.bash

# Step 3: Run the node
ros2 run <package_name> <node_name>

Method 3: ROS2 launch files

  • Launch files are used for larger systems where multiple nodes, parameters, namespaces, and configurations must be started together.

  • ROS 2 supports several launch file formats:

    `. XML
    2. Python (most common and recommended)
    3. YAML
    
    # Example:
    ros2 launch my_package system.launch.xml
    

Comparision Table

Method Command Example Best For Complexity ROS2 Integration Main Advantage Main Limitation
Direct Python Script python3 my_node.py Quick testing, learning, prototyping Low Minimal Fast and simple Not integrated into ROS2 package system
Colcon + ros2 run ros2 run <package> <node> Standard ROS 2 development Medium Full Proper package and dependency management Requires package setup and build process
Launch Files ros2 launch my_package system.launch.py Large multi-node systems High Full orchestration Start and configure many nodes together Complex configuration

References

Publisher/Subscriber Model

What is ROS- A Brief Introduction