Communication btw ROS docker container and Jetson bot

asked 2022-08-15 13:19:35 -0500

doplidoob gravatar image

I created a container that runs ROS melodic, and I want it to communicate with a robotic rover, which has a Jetson onboard and runs melodic as well. Both my computer and my rover are in the same network, as ping and netcat are working fine as advised here.

When I run roscore in the container, I can successfully run my pkgs on my rover after setting


But nothing coming in when running rostopic echo /rosout in the container. The same command prints normal outputs on the rover. Also, rostopic list on both sides gives the same list. On interesting thing is, when nothing is publishing to a topic, running rostopic echo in the container shows

WARNING: topic [/xxxx] does not appear to be published yet

but it shows nothing when there is something publishing to the topic.

When I run roscore on the rover, I set ROS_MASTER_URI in the container to http://ip.of.the.rover:11311. This time, running rostopic list in the container gives the error

ERROR: Unable to communicate with master!

I tried to set up ROS_IP as suggested in this post, but that doesn't help. Can anyone give me some hints of how to make the communication working fine?

My script for running the docker container:



sudo docker run -it \
 --runtime=nvidia \
 -v $HOME/.Xauthority:/root/.Xauthority \
 -v $PWD/ros_dev:/ros_dev \
 -v $PWD/data:/data \
 -p 11311:11311 \
 --privileged \
 --net=host \
 --name=melodic \
 ros:melodic "$@"

And my Dockerfile is:

FROM osrf/ros:melodic-desktop-full

# nvidia-container-runtime

# Minimal setup
RUN echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
RUN source ~/.bashrc
edit retag flag offensive close merge delete


Ahoy! What does your firewall for both machines look like? ROS1 uses a range of nondeterministic for message transport that won't be predefined, this most firewalls can interfere with ROS1 connectivity. BTW, you shouldn't need to port forward 11311 if you arr already using the host network interface. Also, rather than sourcing the setup or bashrc script from your Dockerfile, you'd want to add that to the container entrypoint instead:

ruffsl gravatar image ruffsl  ( 2022-09-20 05:26:15 -0500 )edit