Skip to content
Sepehr MohaimenianPour edited this page Jul 12, 2018 · 16 revisions
-[Note]

This page is a modified version of Testing in Simulator · NVIDIA-Jetson/redtail Wiki that covers preparing the system to run ArduCopter on Gazebo Simulator with SITL.

+[Note]

We are planning to upgrade the Gazebo from version 8 to 9 so that we can use trail maps directly from Gazebo

Introduction

Testing the code in the simulator is generally a good idea that helps to avoid expensive hardware failures. In this page, we will introduce how to use the provided Docker image to have Gazebo simulation platform that enables SITL Simulator (Software in the Loop) testing of the project's code on ArduCopter.

It is recommended to use the provided Docker image that installs all the requirements on a separate isolated virtual machine, however, if you prefer installing the components on your computer we will list the required components.

  • Using Docker
  • [Required Components][#requred-components-list)

Ardupilot Docker

Docker is the preferred way to set up a simulation environment as it allows the user to completely isolate all software changes from the host system, as well as have multiple simulation environments on the same machine.

The current configuration assumes all components are installed on an x86 host platform running Ubuntu 16.04. It is also possible to install some components on Jetson while others (like Gazebo etc) - on the host machine. The system should be equipped with GPU and Cuda toolkit installed on it so that you can run Redtail DNN models.

We take advantage of NVIDIA Container Runtime for Docker to passthrough GPU to the docker so that we can build and run Docker containers leveraging NVIDIA GPUs.

Install Docker CE

To be abble to use Nvidia Docker, you need to install one of the supported Docker versions based on NVIDIA Docker supported Docker packages. It is rocommended to install Docker CE on your system, here's minimal commands you need to install Docker CE on Ubunru 16.04. If you need more details please refer to Get Docker CE for Ubuntu | Docker Documentation.

Make sure there is no other/older version of Docker installed on your system:

$ sudo apt-get remove docker docker-engine docker.io

Install Docker CE using Docker Repository

$ sudo apt install apt-transport-https ca-certificates curl 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 update
$ sudo apt install docker-ce

[Optional] You can check if your installation is successful:

$ sudo docker run hello-world  

Install NVIDIA Docker to passthrough GPUs

The original Rdtail documents suggests installing v1 for full-featured experience.

Note that this setup was tested with NVIDIA Docker v1. There are known issues with v2 (e.g. no OpenGL drivers etc) so, if possible, try using v1 for full-featured experience.

$ wget -P /tmp https://github.com/NVIDIA/nvidia-docker/releases/download/v1.0.1/nvidia-docker_1.0.1-1_amd64.deb
$ sudo dpkg -i /tmp/nvidia-docker*.deb && rm /tmp/nvidia-docker*.deb

[Optional] I personally prefer not to have to run Docker as su evrytime, if you like you can you Ubuntu user to docker and nvidia-docker groups so that you don't need to run containers with sudo anymore:

$ sudo usermod -a -G docker $USER
$ sudo usermod -a -G nvidia-docker $USER

You need to log out and in again for these changes to take effect.

[Optional] You can check if your NVidia Docker in successfully installed and you can access your GPU from inside a container by testing nvidia-smi in a Docker image:

$ nvidia-docker run --rm nvidia/cuda nvidia-smi
Clone this wiki locally