Skip to main content

RMW & ROS Domain ID

This guide explains how to change the ROS 2 middleware and domain ID used by AI Worker.

Environment Variables​

These settings are managed through environment variables inside the ai_worker container. The container image sets the following defaults in ~/.bashrc:

Environment variablePurposeDefault
RMW_IMPLEMENTATIONSelects the ROS 2 middleware implementation.rmw_zenoh_cpp
ROS_DOMAIN_IDSelects the ROS 2 domain.30

ROS 2 environments that need to communicate with each other must use the same domain ID and compatible middleware settings. Configure other participating environments, such as Cyclo Intelligence and external PCs, separately.

Change the Settings​

  1. Connect to the robot through SSH and enter the AI Worker container.

  2. Open the container's shell configuration:

    nano ~/.bashrc
  3. Find the existing lines and change the values as needed. For example, these are the defaults:

    export RMW_IMPLEMENTATION=rmw_zenoh_cpp
    export ROS_DOMAIN_ID=30

    To use Fast DDS, set RMW_IMPLEMENTATION to rmw_fastrtps_cpp. Choose a domain ID appropriate for your ROS 2 network.

  4. Save the file with Ctrl+O, press Enter, and exit with Ctrl+X.

  5. Exit the container and restart it from the robot PC to apply the changes to newly started services:

    exit
    docker restart ai_worker
  6. Enter the container again and check the values:

    echo "$RMW_IMPLEMENTATION"
    echo "$ROS_DOMAIN_ID"

    Bring up the robot again and check the service logs if needed. The commands above show the current shell's settings; other already-running processes retain the environment they started with.

note

Changes made only inside the container can be lost if it is removed and recreated. Repeat the configuration after recreating it.

For Zenoh connections from another PC, see External ROS 2 Communication. The Zenoh daemon and client configuration in that guide apply when using Zenoh RMW.