Welcome to the DJI Tello Drone Playground! This project is designed for enthusiasts and learners who want to explore the capabilities of the DJI Tello drone through a series of practical exercises.
- Git clone or download this repository to your computer.
- Setup your development environment.
- Connect to the drone.
- Try controlling the drone manually with your smartphone. See this guide
- See the example exercises in the
srcfolder - Try some of the other more advanced exercises in the
srcfolder - Get creative and make your own scripts
- Have fun!
To interact with the drone, you must first establish a WiFi connection (see the full connection guide for the power-on button press and status-light sequence):
-
Power on your DJI Tello drone.
-
Connect your computer to the drone's WiFi network.
The WiFi network typically appears as
TELLO-XXXXXX. Default password is usually12345678.
The src folder contains the core modules and components of the project. Below is an overview of each subfolder and file:
-
example_exercises/
Provides sample scripts and exercises that demonstrate how to use the various components of the repository. These examples can serve as learning resources or starting points for new features. -
controller_adapters/
Contains modules that act as adapters between various input devices (e.g., joysticks, keyboards) and the Tello drone control logic. These adapters standardize control inputs so the drone can interpret commands regardless of the input source. Most files primarily expose classes for use in other scripts, but also include a__main__block for standalone manual testing. -
face_tracking/
Includes code for detecting and tracking faces using computer vision techniques. This module may be used for features such as autonomous following or interactive behaviors based on face detection. Most files contain classes to be used in other scripts, except forsanity_check.py, a standalone script for testing face detection against a local webcam without a drone. -
object_detection/
Houses functionality related to detecting objects in images (currently demoed on static sample images). This could be useful for obstacle avoidance, target recognition, or other advanced drone behaviors. Most files can be run directly as standalone demo scripts. -
joysticks/
Contains modules for interfacing with different joystick and game controller types. This folder enables the project to support multiple controller configurations for manual drone operation. Most files primarily expose classes for use in other scripts, but also include a__main__block for standalone manual testing. -
services/
Implements the core services for interacting with the Tello drone, such as establishing connections, sending commands, and managing the droneโs state. The files contain classes to be used in other scripts but not executed directly.
Dive into various example exercises located in the src folder. Each script guides you through different functionalities of the DJI Tello drone.
Several exercises import shared modules such as services, face_tracking, and controller_adapters, so run them from the repository root with src on your PYTHONPATH:
# macOS/Linux
PYTHONPATH=src python3 ./src/<folder>/<script_name>.py:: Windows Command Prompt
set PYTHONPATH=src && python ./src/<folder>/<script_name>.py# Windows PowerShell
$env:PYTHONPATH = "src"; python ./src/<folder>/<script_name>.pyReplace <script_name> with the script you wish to run and <folder> with the folder/s the script is located in, e.g. PYTHONPATH=src python3 ./src/example_exercises/2_simple_takeoff_land.py.
For More info checkout the README
- See the drone status indicator states here
- There are some instances where the drones IMU may need to be calibrated. See the calibration video guide
- The firmware on the Tello drone may need to be updated. See the firmware update video guide
- To position itself, the drone uses a downward-facing camera. Ensure the surface is well-lit and has distinct features for the drone to detect. Poor lighting or a lack of distinct patterns on the floor may cause the drone to drift or lose position.
If you encounter an error like client_socket.bind(("", Tello.CONTROL_UDP_PORT)) when trying to connect to the drone, it means another process is using the Tello UDP port (usually port 8889).
Solutions:
-
Find and kill the process using the port:
# Find the process ID (PID) using the port lsof -i :8889 # Kill the process (replace <PID> with the actual process ID) kill -9 <PID>
-
Check for stuck Python processes:
# List all Python processes ps aux | grep python # Kill stuck Python processes if found killall python3 # โ ๏ธ WARNING: kills ALL Python 3 processes, not just the one on port 8889 โ prefer targeted kill -9 <PID> above
-
Restart your computer if the above doesn't work - this will clear all stuck processes.
-
Use debug mode for testing without connecting to the drone. The circle-detector exercise reads this from an environment variable:
DEBUG_MODE=true PYTHONPATH=src python3 ./src/example_exercises/15_circle_dectector.py
16_color_contour_detector.pyhas the same debug/no-takeoff behavior, but as constants you edit in the script instead of an environment variable โ seesrc/example_exercises/README.md.
To enhance your coding and debugging experience, we recommend using the launch configurations with Visual Studio Code (VS Code).
