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

Listening to ROS messages in Docker containers

asked 2016-09-25 06:04:30 -0500

jrw gravatar image

I have been working with Docker as a host for my ROS nodes. It's a great way to do it, but I have hit a problem.

I can use docker-compose to spin up containers, and they all merrily talk to one another. But during the development phase I want to be able to listen in too, use something like RViz, etc. The nodes are on a headless machine. Developers can't really just spin up the containers on their own computers as the headless machine has the hardware like cameras attached to it.

So is there a cunning way to do this? I have got overlay networking going, but I can't see a good solution using that either. The only thing I could see to do with that is to join the overlay network, spin up a container and run RViz inside it and forward the X session out. However, joining the overlay network also doesn't work if you are ssh'ing into the main machine from behind a firewall/NAT.

edit retag flag offensive close merge delete

Comments

Do you have a single master? Is that running in a separate container, or as part of one of the node-containers? Also: can all containers communicate with all other containers, or are there partitions?

gvdhoorn gravatar image gvdhoorn  ( 2016-09-25 06:14:28 -0500 )edit

Single master. Every node (including master) is running in a separate container. Every container can communicate with every other one.

jrw gravatar image jrw  ( 2016-09-25 06:36:29 -0500 )edit

I have not used overlay networks, but apart from NAT, do you see any issues with 'just' setting ROS_MASTER_URI on your host to the IP of your roscore container and starting RViz (or whatever tools you need)?

gvdhoorn gravatar image gvdhoorn  ( 2016-09-25 08:09:51 -0500 )edit

I need a way to have my machine resolve the names of the other containers. I have done as you suggested on the host computer and it works if I spin up a resolver container. But it won't work from anywhere else - another PC on the LAN cannot resolve and talk to the IP addresses of the containers

jrw gravatar image jrw  ( 2016-09-25 08:21:29 -0500 )edit

Well, a non-Docker-onic solution / work-around could be to run a VPN server in one of the containers in your ROS network and connect to that from your remote host. That would make the remote host 'local' in a sense. Other work-around: IP routing the remote host into the containers' network.

gvdhoorn gravatar image gvdhoorn  ( 2016-09-25 08:30:16 -0500 )edit

Another work-around: set ROS_IP on all involved containers to their IP, and set ROS_MASTER_URI to the IP of the roscore container. That would avoid the DNS problem. Be sure to set ROS_IP on your remote host as well.

gvdhoorn gravatar image gvdhoorn  ( 2016-09-25 08:38:47 -0500 )edit

And as far as I understand overlay networks: would it work if your remote host is part of the same overlay network as all your ROS containers?

gvdhoorn gravatar image gvdhoorn  ( 2016-09-25 08:42:17 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-10-15 01:06:29 -0500

ruffsl gravatar image

updated 2016-10-15 01:06:56 -0500

I got around this issue by adding a Host-level DNS gateway for Docker (resolvable) running in a container that joins in on the same docker network you are trying to poke at.

See this related post:
Exposing ROS Containers to Host Machine

And my github gist where I wrote down what I found in a short example:
Small ROS Network Example

Hope this helps.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-09-25 06:04:30 -0500

Seen: 3,776 times

Last updated: Oct 15 '16