The environment verified this time is as follows.
Hardware cpu - AMD Ryzen 9 3900X gpu - Geforce RTX 2060 super ram - 32G
Software os - ubuntu 20.04.1 kernel - Linux define 5.4.0-48-generic docker - 19.03.13 nvidia-driver - 450.66 cuda version - 11.0
I have attached the output of nvidia-smi
.
$ nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.66 Driver Version: 450.66 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce RTX 206... Off | 00000000:0E:00.0 On | N/A |
| 38% 40C P8 11W / 175W | 916MiB / 7979MiB | 1% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
First install nvidia-container-runtime.
#apt related settings
$ curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | sudo apt-key add -
$ distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
$ curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | sudo tee /etc/apt/sources.list.d/nvidia-container-runtime.list
# nvidia-container-runtime installation
$ sudo apt update
$ sudo apt install nvidia-container-runtime
#Restart docker service
$ sudo systemctl restart docker.service
Then register your UID in docker group. I think people using docker are doing it, but just in case.
$ sudo usermod -a -G docker `id -un`
$ sudo systemctl restart docker.service
Next, build the docker image.
$ git clone https://github.com/chikuta/chikuta-dockerfiles.git
$ cd chikuta-dockerfiles
$ ./docker/ros-bionic-melodic/build-docker-image.bash
Next, you can start the container of the built image by executing the following command. The content of the script is a wrapping of the processing around xhost and the arguments of docker. You can create your own environment by editing it as needed, so let's actively customize it.
$ cd chikuta-dockerfiles
$ ./docker/ros-bionic-melodic/run-docker-container.bash
When you execute the script, terminator will be launched. Since this is a terminal application running on the docker container, all commands executed here will be processed on the docker container.
It's fashionable to change the console from the default red to blue.
The idea of starting terminator is based on the dockerfile of shadow-robot. Since the head family is an excessive specification that executes ansible on the docker file, I extracted only the necessary parts and summarized it compactly.
Finally, let's launch a basic GUI application.
# 1st terminal
$ roscore
# 2nd terminal
$ rviz
# 3rd terminal
$ gazebo
Recommended Posts