noetic_docker - Field-Robotics-Lab/dave GitHub Wiki
- The notes cover options for both with and without NVIDIA GPU support. Where the instructions diverge, you will see options
a) NVIDIA
andb) Non-NVIDIA
. Both variants use the sameDockerfile
, but - These notes are based on using an anecdotal testing
- NVIDIA variant tested on both Ubuntu 20.04 and Ubuntu 18.04 hosts.
- Non-NVIDIA variant tested on Ubuntu 20.04 using Virtualbox. Using this setup the sim reported a real-time factor of 1.0 and a frame rate of ~2 FPS.
Official NVIDIA-Docker Install Guide
-
Select and install NVIDIA driver at Software & Updates of Ubuntu
From
Software & Updates
at Ubuntu, go toAdditional Drivers
and select the NVIDIA driver from the list.Using X.Org X server
is selected at defaults and it is recommended to select a version withproprietary, tested
flag. When you select the NVIDIA driver, it will install. Graphical tutorial -
Enroll MOK key for secure boot
If secure boot option is on at the computer BIOS settings, as it is more often set to defaults at modern computers, you will be asked to type a password during the NVIDIA driver installation. After the installation, reboot the machine. When you do so, you will be prompted with a blue screen to select
Enroll MOK
and select a saved key. You will be able to enroll with the password you typed during NVIDIA driver installation. -
If something went wrong If something went wrong, revert to
Using X.Org X server
at Software & Updates and re-select the NVIDIA driver.
sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update && sudo apt-get install docker-ce docker-ce-cli containerd.io
sudo systemctl enable docker && service docker start
sudo usermod -aG docker $USER
newgrp docker
check docker installation with docker -v
.
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) \
&& curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - \
&& curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo systemctl restart docker
check installation with
sudo docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
Install docker on your host. E.g., for Ubuntu 20.04 here are instructions.
Make sure you pass the test...
sudo docker run hello-world
Use apt
as described in the rocker README.md.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt update
sudo apt-get install python3-rocker
Also required
sudo apt install python3-distutils
For development, we recommend rocker
and mounting the user's home directory. The requisite source repositories can then reside directly on the host - and be accessed from within the running container. See Clone-Dave-Repositories.
- Install vcstool
curl -s https://packagecloud.io/install/repositories/dirk-thomas/vcstool/script.deb.sh | sudo bash
sudo apt-get update
sudo apt-get install python3-vcstool
- Use vcstool to clone dependent repositories
mkdir -p ~/uuv_ws/src
cd ~/uuv_ws/src
git clone https://github.com/Field-Robotics-Lab/dave.git
vcs import --skip-existing --input dave/extras/repos/dave_sim.repos .
cd ~/uuv_ws/src/dave/extras/docker
./build.bash dave_noetic
which should generate output that ends with something like...
Successfully built ae7e6aa86be9
Successfully tagged dave_nvidia:2021_07_01_1052
Built dave_nvidia:2021_07_01_1052 and tagged as dave_nvidia:latest
Use rocker to start a container from the image.
The run.bash
script wraps the rocker
interface...
./run.bash dave_nvidia:latest
rocker --devices /dev/input/js0 --dev-helpers --x11 --user --home --git dave:latest
Note that the argument for the devices
option should be the path to the joystick device on the host. This can be omitted if a joystick is not needed.
You will probably want to have multiple terminal within the container. To do so, you can execute an interactive bash session in the running container. A short bash script is supplied which will find the running container by image name and open a new shell in that container.
First, you need to find the ID of the image generated by rocker
. You can get this from the last line of the rocker
output, or you can run:
docker ps
and copy the hash of the image corresponding to the container you want to join. Then run the join.bash
script with this image hash as the argument, as follows:
cd dave/docker
./join.bash <IMAGE_HASH>
e.g.,
cd dave/docker
./join.bash dave_nvidia_runtime
Inside a container with ./run.bash dave_nvidia:latest
source /opt/ros/noetic/setup.bash
cd ~/uuv_ws
catkin_make
source ~/uuv_ws/devel/setup.bash
You may add two source
command at the end of ~/.bashrc
Test by running one of the Dave demo
roslaunch dave_demo_launch dave_demo.launch
If the simulator does not close promptly with Ctrl-C, use command pkill gzclient && pkill gzserver
at another terminal window to force close.