Setup a docker container for the Turtlebot3 ROS master. The container uses the host's network and the end-user should be aware that this may present some security issues.
- Commands with
[host]
are to be run on the host machine (where you are going to execute the docker commands) - Commands with
[dckr]
are to be run in the docker container (running on the host machine) - Commands with
[tb]
are to be run on the turtlebot
- Install docker
- Setup permissions for docker
*
Setup nvidia environment- Enable port forwarding for X11
*
-only applies if you have an nvidia graphics card available for hardware acceleration.
Execute the following command to allow docker to do x11 forwarding:
[host] echo "xhost +local:docker" >> ~/.bashrc
Crucial bit for networking to work:
Add the following line to your /etc/docker/daemon.json
file on the host:
"bridge": "none"
This disables docker's bridge network adapter which appears to mess with communication between the ros master and the pi.
The raspberrypi setup follows the normal steps; see the instructions.
Note: the intel
is provided as a reference only. It should work as-is, but it has not been formally tested.
First, choose which image you want to build: intel
or nvidia
, then symlink
it to Dockerfile
. For example, if you wish to use the intel
version, do the following:
[host] ln -sf Dockerfile.intel Dockerfile
Finally, build the image:
[host] docker build --network=host -t turtlebot3-docker .
Run the following and record the output: Note: wlp3s0
is a network device-id and may be different on your machine. Look for your wireless network adapter id.
[host] ifconfig
Record the value under inet
(it will look like 192.168.xxx.xxx) as HOST_IP
.
Next, set the value in the Turtlebot:
[host] ssh pi@{pi_hostname}
[tb] ifconfig # record value as PI_IP
[tb] echo "ROS_MASTER_URI=http://{HOST_IP}:11311" >> ~/.bashrc
[tb] echo "ROS_HOSTNAME={PI_IP}" >> ~/.bashrc
Note: the intel
option follows similarly, just use launch-docker-intel.sh
instead.
[host] launch-docker-nvidia.sh
It's a little kludgy, but to get another terminal open, do the following:
[host] docker exec -it {your_container_id} /bin/bash
your_container_id
is the hash listed under the PORTS
column associated with your running container. Note: I couldn't get the NAMES
field to work correctly here.
You need two additional windows open on the host
machine to follow along with the ROBOTIS demos.
You should now be able to follow all steps from Turtlebot manual and see an image like the following:
All steps marked for execution on the REMOTE_PC
will be executed in the running docker container.
- Make sure that the container and the pi have synchronized clocks. Use ntpdate on both the host and the pi to sync their clocks. The
*.sh
run scripts forward the host's clock state to the container.