Skip to content

Instantly share code, notes, and snippets.

@cardboardcode
Last active May 19, 2026 03:17
Show Gist options
  • Select an option

  • Save cardboardcode/b27e160def624dfad6a02b4d9ddd596d to your computer and use it in GitHub Desktop.

Select an option

Save cardboardcode/b27e160def624dfad6a02b4d9ddd596d to your computer and use it in GitHub Desktop.
Minimal Proof: Inter-ROS2 Distro Communication

Minimal Proof: Inter-ROS2 Distro Communication

Warning

Be warned that it is still not recommended to mix different ROS 2 distributions within the same application due to ROS 2 message checksum inter-distro differences.

Would suggest keeping ROS 2 distro version homogenous throughout one's architecture to help reduce uncertainty during system debugging.

This is a minimal proof that different ROS 2 distribution can communicate succesfully with each other.

In this example, a ROS 2 Humble talker node is able to communicate to a ROS 2 Jazzy listener node between their individualized docker containers.

Instructions 📘

  1. Run ROS 2 Humble talker node:
docker run -it --rm \
    --name humble_publisher_c \
    -v /dev/shm:/dev/shm \
    osrf/ros:humble-desktop-full bash -c \
    "ros2 run demo_nodes_cpp talker"
  1. Run ROS 2 Jazzy listener node in a new terminal:
docker run -it --rm \
    --name jazzy_subscriber_c \
    -v /dev/shm:/dev/shm \
    osrf/ros:jazzy-desktop-full bash -c \
    "ros2 run demo_nodes_cpp listener"

Verify

One terminal should show:

[INFO] [1723337403.404742853] [talker]: Publishing: 'Hello World: 1'
[INFO] [1723337404.404783647] [talker]: Publishing: 'Hello World: 2'
[INFO] [1723337405.404901389] [talker]: Publishing: 'Hello World: 3'
[INFO] [1723337406.404994499] [talker]: Publishing: 'Hello World: 4'
[INFO] [1723337407.405056425] [talker]: Publishing: 'Hello World: 5'
...

The other terminal should show:

[INFO] [1723337403.404988153] [listener]: I heard: [Hello World: 1]
[INFO] [1723337404.404993844] [listener]: I heard: [Hello World: 2]
[INFO] [1723337405.405100274] [listener]: I heard: [Hello World: 3]
[INFO] [1723337406.405191427] [listener]: I heard: [Hello World: 4]
[INFO] [1723337407.405250046] [listener]: I heard: [Hello World: 5]
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment