6. Python Programming

6.1. Python Setup

You may actually use any programming language that can establish a UDP connection to send commands to the Tello drone, however, in this book, we will use Python to send commands to the drone. Python programming is an intermediate to advanced subject. Make sure you are comfortable and familiar with Python programming. Start learning Python today by going to our online book. The Python code is adapted from the DJI GitHub repository.

To be able to run the Python programs, you will need to have Python 3.x or higher. The use of Miniconda or Anaconda is highly recommended. Setting up the environment you will need to get the Python drone programming examples working is rather involved. We recommend you select your favorite Python environment and follow the installation instruction. Additionally, please stop by One-Off Coder for hands-on help.

6.2. Tello Software Development Kit

You may establish a UDP connection to the Tello on port 8889 and send commands. There are versions 1.0 and 2.0 to communicate with the Tello and Tello EDU, respectively. We will be using version 1.0. The following are manuals listing the commands that may be sent.

We list the Tello 1.0 commands in the following table.

Tello 1.0 Commands

Command

Description

Response

command

Enter command mode

OK|False

takeoff

Auto takeoff

OK|False

land

Auto landing

OK|False

up xx

Fly upward [20, 500] cm

OK|False

down xx

Fly downward [20, 500] cm

OK|False

left xx

Fly left [20, 500] cm

OK|False

right xx

Fly right [20, 500] cm

OK|False

forward xx

Fly forward [20, 500] cm

OK|False

cw xx

Rotate clockwise [1, 360] degrees

OK|False

ccw xx

Rotate counter-clockwise [1, 360] degrees

OK|False

flip x

Flip [l, r, f, b]

OK|False

speed xx

Set speed [1, 100] cm/s

OK|False

Speed?

Get current speed

xx

Battery?

Get current battery percentage

xx

Time?

Get current flight time

xx