ROS2 communication between a docker container on AWS and a local Desktop environment

0

Hello, I have started recently a ROS2 project that operates remotly in a docker development container on AWS. My objective is to establish a direct bidirectional communication between ROS2 in this container and another ROS2 environment that was installed on a local Jetson. For additional context, ros2 will be used as part of isaac-sim ros2 bridge to communicate data from and to a robot placed in the simulation environment as part of a robotic digital twin project. In the docker container: Ubuntu version: 20.04 ROS2 version: foxy ROS2 Environment variables: ROS_MASTER_URI=http://172.17.0.1:11311 ROS_IP=52.60.66.162 ROS_DOMAIN_ID=0 FASTRTPS_DEFAULT_PROFILES_FILE=/.ros/fastdds.xml “172.17.0.1” is the IP address found on the local computer that I am supposed to communicate with using the <ifconfig> terminal command. This IP address appears under docke0 inet (I used this local IP address since the docker container was created on top of the host network stack as you will later see in the command that created the container). 11311 was assumed to be the port that ROS2 uses (I might be wrong so feel free to correct me) (I also tried port 11511) “52.60.66.162” is the public IP address of the AWS EC2 instance that I am connected to on both the computer that is starting the remote docker container on AWS and the local Jetson The fastdds.xml file was created in the </.ros> directory with the following content:

<?xml version="1.0" encoding="UTF-8" ?>

<license>Copyright (c) 2022, NVIDIA CORPORATION.  All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto.  Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.</license>

<profiles xmlns="http://www.eprosima.com/XMLSchemas/fastRTPS_Profiles" >
    <transport_descriptors>
        <transport_descriptor>
            <transport_id>CustomUdpTransport</transport_id>
            <type>UDPv4</type>
        </transport_descriptor>
    </transport_descriptors>

    <participant profile_name="udp_transport_profile" is_default_profile="true">
        <rtps>
            <userTransports>
                <transport_id>CustomUdpTransport</transport_id>
            </userTransports>
            <useBuiltinTransports>false</useBuiltinTransports>
        </rtps>
    </participant>
</profiles>

After pulling the following isaac-sim docker using the following command:

docker pull nvcr.io/nvidia/isaac-sim:2022.2.1

The docker container is created as follows in VSCode:

docker run --name isaac-ros-bridge-3 --entrypoint bash -it --gpus all -e "ACCEPT_EULA=Y" --network=host --ipc=host --pid=host     -v ~/docker/isaac-sim/cache/kit:/isaac-sim/kit/cache/Kit:rw     -v ~/docker/isaac-sim/cache/ov:/root/.cache/ov:rw     -v ~/docker/isaac-sim/cache/pip:/root/.cache/pip:rw     -v ~/docker/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw     -v ~/docker/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw     -v ~/docker/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw     -v ~/docker/isaac-sim/data:/root/.local/share/ov/data:rw     -v ~/docker/isaac-sim/documents:/root/Documents:rw          -v /dev/shm:/dev/shm     public.ecr.aws/nvidia/isaac-sim:2022.2.1

On local Jetson: Ubuntu version: 20.04 ROS2 version: foxy ROS2 Environment variables: ROS_MASTER_URI=http:// 52.60.66.162:11311 (I also tried port 11511) ROS_IP= 172.17.0.1 ROS_DOMAIN_ID=0 FASTRTPS_DEFAULT_PROFILES_FILE=~/.ros/fastdds.xml The fastdds.xml was the same as previously discussed and tried with and without it on the local Jetson.

When I start a simple talker node in the docker container using the following command: ros2 run demo_nodes_py talker and list the ros2 topic using: <ros2 topic list> , I can see the topic /chatter listed.

But when I start a simple listener on the local machine using the following command: ros2 run demo_nodes_py listener I do not received the published messages and other way around gives the same behaviour (i.e. Talker started on local machine and listener started in the docker container on AWS). For additional information: when I change the ROS_DOMAIN_ID to another number like 2 or 42… (while keeping it the same on both the container and the local Jetson environment)  I cannot see the /chatter topic listed anymore. Also, when I start the talker on the Jetson I cannot see the /chatter topic listed in the AWS container Any insights or guidance to help me solve this problem? Thanks in advance.

Abed
asked 8 months ago499 views
2 Answers
0

From the issue, I understand that ROS2 communication from the docker container is being established to the ROS2 on local Jetson which is hosted locally. However from local machine connecting to ROS2 on docker container hosted on AWS, the connection is failing.

The following things can be verified which can help for this issue:

  1. Connectivity to the AWS Machine which is having docker container running from local Jetson machine.
  2. We need to check if the machine is backed in a private subnet or public subnet. If is it backed by private subnet, please try changing the machine to a public subnet and verify the setup.
  3. Please verify if the docker container is exposed on any port number of host machine. Please refer the document [1] to expose the container on a port number.

I request to please verify the above steps which might help in resolving your issue.

References:

[1] https://docs.docker.com/engine/reference/commandline/run/#publish

AWS
SUPPORT ENGINEER
answered 8 months ago
0

Thank you for your answer.

1- The connection to AWS is well established: i can ping the public IP address of the AWS EC2 instance from a terminal in Jetson. But it is worth noting that i don't know how to ping the local Jetson from the container running on AWS.

2- Here is the output for <ifconfig> in my AWS EC2 docker container:

docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
        inet6 fe80::42:86ff:fe61:d021  prefixlen 64  scopeid 0x20<link>
        ether 02:42:86:61:d0:21  txqueuelen 0  (Ethernet)
        RX packets 54927  bytes 3403097 (3.4 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 58546  bytes 831783306 (831.7 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

ens5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 9001
        inet 172.31.29.173  netmask 255.255.240.0  broadcast 172.31.31.255
        inet6 fe80::8:77ff:fed6:4bea  prefixlen 64  scopeid 0x20<link>
        ether 02:08:77:d6:4b:ea  txqueuelen 1000  (Ethernet)
        RX packets 2283142  bytes 2372429596 (2.3 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1255472  bytes 330288429 (330.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 657439  bytes 1488374869 (1.4 GB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 657439  bytes 1488374869 (1.4 GB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

3- I already created the docker container with argumet: --network=host to expose all the container ports (I also tried --network=bridge)

Abed
answered 8 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions