> ## Content Index
> Fetch the complete content index at: https://whatimade.today/llms.txt
> Use this file to discover other available public pages before exploring further.

# Installing ROS docker with GPU support, for controlling DJI's Tello drone.
- URL: https://whatimade.today/installing-ros-docker-with-gpu-support-for-controlling-djis-tello-drone/
- Published: 2020-06-05T19:24:37.000Z
- Updated: 2020-06-06T12:25:12.000Z
- Author: GalBrandwine
- Tags: docker, ROS, TelloPy, Tello, tello-driver, Dockerfile, #Import 2026-11-07 09:43

# Hey, its been a while.

That probably because I'm *knees deep* in Technion's Autonomous & Perception course,  
of the Aerodynamics & Space faculty.

As for the final project, we ought to implement (and improve):  
**Sampling-based robotic information gathering algorithm**,  
By Geoffrey A. Hollingerand Gaurav S. Sukhatme.

We aim to demonstrate our work in a real life example, where a drone [(my beloved Tello drone)](https://whatimade.today/getting-started-with-docker/) will use **GIL** algorithms for planning and executing an optimal trajectory between two points, while avoiding obstacles.

In this post I'll focus on the platform well use for developing and testing our project.

## Installations

Using [ros docker tutorial](http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration?ref=whatimade.today), We can create a ros docker with Hardware Acceleration.

- We create a Dockerfile, with NVIDIA support, and all dependencies for [TelloPy](https://github.com/hanyazou/TelloPy?ref=whatimade.today):

```shell
FROM osrf/ros:melodic-desktop-full

# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
    ${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
    ${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics
# Set the working directory
# WORKDIR /usr/src/app

# Install any needed packages specified in requirements.txt
RUN apt-get update  
RUN apt-get install -y pkg-config  
RUN apt install -y python3-dev  
RUN apt-get install -y python3-pip

# AV library dependencies
RUN apt-get install -y libavformat-dev libavdevice-dev  
RUN apt-get install -y libsm6 libxext6 libxrender-dev

# Tello library dependencies
RUN pip3 install av==6.1.2

# OpenCV
RUN pip3 install opencv-python

```

- Then we build

```shell
docker build -t ros_tello .

```

- Now we create a script to run the image called *run\_my\_image.bash*:

```shell
# Exposing Tellos ports.
XAUTH=/tmp/.docker.xauth
if [ ! -f $XAUTH ]
then
    xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
    if [ ! -z "$xauth_list" ]
    then
        echo $xauth_list | xauth -f $XAUTH nmerge -
    else
        touch $XAUTH
    fi
    chmod a+r $XAUTH
fi

xhost + && docker run -it \
    --privileged \ # Needed to access display, otherwise
    --network host \
    --env="DISPLAY=$DISPLAY" \
    --env="QT_X11_NO_MITSHM=1" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    -env="XAUTHORITY=$XAUTH" \
    --volume="$XAUTH:$XAUTH" \
    --runtime=nvidia \
    --name tello_ros \
    ros_tello \
    bash

```

- Make the script executable

```shell
$ chmod a+x run_my_image.bash

```

- Execute the script

```shell
$ ./run_my_image.bash

```

- **Flags explanations:**

  - `--privleged`: [Otherwise](https://answers.ros.org/question/301056/ros2-rviz-in-docker-container/?ref=whatimade.today)
  - `--network host`: Will be using ports to communicate with the Tello. So well expose all host's ports.
  - `--env="DISPLAY=$DISPLAY"`: Point to which display to to show context.
  - `--env="QT_X11_NO_MITSHM=1"`: IDK
  - `--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw"`: Point to the **X11** server, unix graphics server.
  - `-env="XAUTHORITY=$XAUTH"`: Point to config that gives authority for controlling graphics.
  - `--volume="$XAUTH:$XAUTH"`: Point to the volume of that config.
  - `--runtime=nvidia`: Run with external GPU's capabilities.
  - `--name tello_ros`: Name of the new container.
  - `ros_tello`: Name of the Image, that will creates our container.
  - `bash`: Start command.
- Test if everything work fine (within the container):

```shell
roscore > /dev/null & rosrun rviz rviz

```

**RVIZ should open, with ros in the background.**

### Installing tello-driver

Assuming we're out of the container

- Start container

```shell
docker container start tello_ros

```

- Attach container

```shell
docker container attach tello_ros

```

- Make a `catkin_ws`:

```shell
mkdir -p /home/catkin_ws/src 
cd /home/catkin_ws && catkin_make # Create workspace for the first time.

```

- Download the `tello-driver`

```shell
cd ./src
git clone --recursive https://github.com/appie-17/tello_driver.git

```

- Making the package

```shell
cd .. # Go back to /catkin_ws
rosdep install --from-paths src --ignore-src -r -y  # Install package dependencies.
catkin_make

```

That will build the project.

## Now we run `tello-driver`:

```shell
source ./devel/setup.bash

#### Before, we make sure we're connected to Tello's wifi.
roslaunch tello_driver tello_node.launch 

```

## Testing connection

In another terminal:

```shell
docker exec -it tello_ros bash
cd home/catkin_ws/
source devel/setup.bash
rviz

```

### Results:

![RVIZ should show stream from camera](https://whatimade.today/content/images/2020/06/Screenshot-from-2020-06-05-18-39-02.png)

We have ROS docker. with Tello driver. And GPU capabilities.

## New we can start our project :)

Here's some *raw* High Level overview of our project:  
![](https://whatimade.today/content/images/2020/06/Untitled-Diagram--1-.png)

### Installing Pycharm inside Docker

Epilogue.  
It took me *tonne* of work just to make the *ros-tello-driver* to run within **ROS container**, when that being said, developing with python against a container, is somewhat a painful process. Pycharm isn't using python interpreter within a docker. It is possible to get it to work, but I had enough, thus installed **ROS2** on my laptop, and started from scratch. Ditching the docker part.

Till next time.  
Gal