Skip to content

Instantly share code, notes, and snippets.

@cardboardcode
Last active August 11, 2024 00:58

Revisions

  1. cardboardcode revised this gist Aug 11, 2024. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion README.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    ## **What Is This?**
    ## **Minimal Proof:** Inter-ROS2 Distro Communication

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

  2. cardboardcode created this gist Aug 11, 2024.
    50 changes: 50 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    ## **What Is This?**

    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.

    ## **Run** :gear:

    1. Run ROS 2 Humble `talker` node:
    ```bash
    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"
    ```

    2. Run ROS 2 Jazzy `listener` node in a new terminal:
    ```bash
    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** :white_check_mark:

    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:

    ```bash
    [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]
    ...

    ```