ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Since I don't see you specifically setting the rmw implementation (underlying dds vendor) you're using the default of rmw_cyclonedds_cpp. CycloneDDS (as of time of writing) only supports a single network interface. So since your container 1 has two networks (and thus two network interfaces) then cyclone is randomly selecting one. So it just so happens that container 1 and 3 talk because in container 1 cyclone happened to select the "rob_net" interface.

By adding an ENV RMW_IMPLEMENTATION=rmw_fastrtps_cpp to your Dockerfile, I was able to see:

Recreating rosquestions_robot_container_1_1 ...
Recreating rosquestions_robot_container_1_1
Recreating rosquestions_robot_container_2_1 ...
Recreating rosquestions_robot_container_3_1 ...
Recreating rosquestions_robot_container_2_1
Recreating rosquestions_robot_container_1_1 ... done
Attaching to rosquestions_robot_container_3_1, rosquestions_robot_container_2_1, rosquestions_robot_container_1_1
robot_container_1_1  | [INFO] [1654049287.167726590] [talker]: Publishing: 'Hello World: 1'
robot_container_3_1  | [INFO] [1654049287.168634709] [listener]: I heard: [Hello World: 1]
robot_container_2_1  | [INFO] [1654049287.168630309] [listener]: I heard: [Hello World: 1]
robot_container_1_1  | [INFO] [1654049288.167636021] [talker]: Publishing: 'Hello World: 2'
robot_container_3_1  | [INFO] [1654049288.167958630] [listener]: I heard: [Hello World: 2]
robot_container_2_1  | [INFO] [1654049288.167959462] [listener]: I heard: [Hello World: 2]
robot_container_1_1  | [INFO] [1654049289.167876872] [talker]: Publishing: 'Hello World: 3'
robot_container_2_1  | [INFO] [1654049289.168433694] [listener]: I heard: [Hello World: 3]
robot_container_3_1  | [INFO] [1654049289.168491234] [listener]: I heard: [Hello World: 3]
robot_container_1_1  | [INFO] [1654049290.167690598] [talker]: Publishing: 'Hello World: 4'
robot_container_2_1  | [INFO] [1654049290.168346310] [listener]: I heard: [Hello World: 4]
robot_container_3_1  | [INFO] [1654049290.168400415] [listener]: I heard: [Hello World: 4]
robot_container_1_1  | [INFO] [1654049291.167796768] [talker]: Publishing: 'Hello World: 5'
robot_container_3_1  | [INFO] [1654049291.168506268] [listener]: I heard: [Hello World: 5]
robot_container_2_1  | [INFO] [1654049291.168487552] [listener]: I heard: [Hello World: 5]