Connect to robots from ROS Docker Container

asked 2019-06-21 16:04:07 -0500

KKKKKyle gravatar image

Hi,

Thanks in advance to anyone that may help me with this. I was working on my mac to set up a ROS Docker container that can connect to my robot under the same local network. However, it seems like Docker will somehow create a subnet that is separated from the host (my Mac) so that the ROS in the docker container cannot communicate with robots under the same local network with the host. I have been searching for solutions for a long time and I find out that the official page about the network is missing here: http://wiki.ros.org/docker/Tutorials/...

Has anyone tried this before and succeeded? I can't image I'm the first one trying to connect to a robot from a ROS Docker container.

Thanks!

edit retag flag offensive close merge delete

Comments

I can't image I'm the first one trying to connect to a robot from a ROS Docker container.

No, but unless things have changed on Macs with Docker (I don't use one, so I don't know), Docker on mac runs (ran?) in a VM. That complicates things even further, as you're now essentially setting up a multi-host ROS network, potentially with NAT between your Docker containers and your host.

I would suggest to first verify whether the VM is still used, if it is, how it's network is setup, make sure you can reach remote resources from the container (ie: ping ip.of.your.robot) and then start looking into setting up your ROS application(s) for that.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-22 02:09:34 -0500 )edit

Hi, thanks for helping. I actually got stuck at that first step. I was trying to ping my host from the VM, which couldn't reach the server. Sorry that I should be more clear. I tried "ifconfig" on my Mac (host) and the VM, which my Mac returned something like "192.168.1.xxx" (which is under the same local network ig, as my robot's ip address is also 192.168.1.xxx) and VM returned "172.xxx.x.xxx". What I was trying to do is to set up the VM to share the same ip address with the host (or subnet if that would work), so that I can set up a single host ROS network between VM and my robot. I don't know if this is the way things normally done though.

KKKKKyle gravatar image KKKKKyle  ( 2019-06-22 16:00:39 -0500 )edit

I would suggest to first understand how Docker-on-Mac networking is setup. After that, start looking into setting up ROS.

gvdhoorn gravatar image gvdhoorn  ( 2019-06-23 06:12:31 -0500 )edit