Ask Your Question

Unable to setup Kinetic on docker

asked 2017-10-17 10:35:29 -0500

kotoko gravatar image

updated 2017-10-18 03:41:47 -0500

Hello all,

I'm working on having a docker container to use later on the robot. My approach is to have a multiple machine setup where the master is in the container and Gazebo and all sorts of other GUI intensive stuff can work from outside the container.

So I started by following the Multiple Machines tutorial inside the container (just to see how far I could get). It turns out that if I start a roscore on one bash and call rosrun from another they do not hear each other.

According to docker documentation,

you can supply -P or --publish-all=true|false to docker run which is a blanket operation that identifies every port with an EXPOSE line in the image’s Dockerfile

sudo docker run -P -it osrf/ros:kinetic-desktop-xenial Start docker container (using -P )
roscore It went straight into the container so this is already inside the container, on the first bash
docker exec -it <name> this is done in another terminal to open another bash for the same container
Here name is just a placeholder for the name of the container (like optimistic_aryabhata)
Inside this second bash, I set up for the tutorial

source /opt/ros/$ROS_DISTRO/setup.bash
apt-get update
apt-get install wget
wget -O - |  apt-key add -
apt-get update
apt-get install python-catkin-tools

And follow the tutorial instructions for multiple machines

export ROS_MASTER_URI=http://<name>:11311
rosrun rospy_tutorials

The last command gives me

Unable to register with master node [http://<name>:11311]: master may not be running yet. Will keep trying.

I was asked what was the ROS_HOSTNAME. I was not aware of the ROS_IP / ROS_HOSTNAME environmental variables. Neither is set. (I'm exploring this right now)

Another question was about NetworkSetup. I did not follow this tutorial yet under the assumption that first I need to be able to make roscore discoverable between terminals of the same machine to go into this part of the setup.

edit retag flag offensive close merge delete



Are you literally using the host name <name> or is this some place holder that you're using for your question? Also, what do you have for ROS_HOSTNAME?

jayess gravatar image jayess  ( 2017-10-17 10:39:29 -0500 )edit

Does your docker container expose the master port 11311. What is your Dockerfile? If you look at the ros networking page, these and a couple of environment variables are required to allow external computers connect to a ros master.

PeterMilani gravatar image PeterMilani  ( 2017-10-17 17:59:15 -0500 )edit

You should definitely set the environment variables and try running everything again. Please read this carefully

jayess gravatar image jayess  ( 2017-10-18 02:01:09 -0500 )edit

@jayess I updated the answer. I was not aware of these variables, will look into it now. If you have any advice it is most welcome :D @PeterMilani Also updated the answer to reflect the information you asked for. Thanks for the input!

kotoko gravatar image kotoko  ( 2017-10-18 02:03:41 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2017-10-18 04:22:55 -0500

kotoko gravatar image

Turns out I need to do export ROS_MASTER_URI=http://containerIP:11311/ at every bash console that I open.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2017-10-17 10:35:29 -0500

Seen: 687 times

Last updated: Oct 18 '17