Sentient Beings

ROS 2 Communication and Networking: A Brief Introduction

How the ROS2 Comm works ?

Lets talk about ROS2 Daemon

Network settings

Optimize your data before transfer over the network

ROS2 Quality of Service

Lets talk about ROS2 Discovery Configuration

Simple Discovery

Discovery Server

Lets dive into Simple Discovery and Discovery Server and see how they work

ROS is built on DDS

Lets dive a bit more deep into the ROS middleware

There are three main parts to the ROS middleware:

  1. CMake Module Packages:
  2. RMW (ROS middleware) implementation package:
  3. ROSIDL type support: Remember how we have to include rosidl generator commands in the package.xml when writing a ROS2 interface?

CMake modules help you link to the specific DDS vendor that you are trying to use, to include the DDS libraries.

CMAKE module -> link to Dependencies ( DDS libs )

RMW is the package where the actual communication API for the middleware is written, it is the part that allows ROS to interact with the middleware like Fast DDS, cyclone DDS etc.

RMW package -> implements ROS middleware api (C++) -> provides the communication functions for ROS

ROSIDL type support package allows to convert the data types messages between ROS and DDS. More specifically, they generate the necessary code to serialize (convert data to a byte stream for transmission) and deserialize (convert the byte stream back to data) messages for a specific DDS implementation. It makes sure that your sensor data can be properly interpreted by the ROS and DDS.

In short:

Your node -- (communicates with) --> rclcpp - ros client library -> RMW implementation (e.g rmw_fastrtps) -> DDS or Middleware
+---------------------+         +-----------------------+         +-----------------------+
|    Your ROS Node    |-------> |   rclcpp/rcl (API)   | ------> |    RMW Implementation |
|                     |         |                       |         | (e.g., rmw_fastrtps)  |
+---------------------+         +-----------------------+         +-----------|-----------+
                                                                              |
                                                                   +----------v----------+
                                                                   |  DDS / Middleware  |
                                                                   | (e.g., Fast DDS)   |
                                                                   +--------------------+
                                                                   |  Serialization     |
+---------------------+         +-----------------------+          | (ROSIDL generated) |
|    package.xml      |-------> |   ROSIDL generator   | ------>   |   .dds (IDL file)  |
| (Dependencies, etc.)|         |   (e.g., rosidl_     |           +--------------------+
+---------------------+         |  generator_dds_idl)  |
                                +-----------------------+