Skip to content

About

๐Ÿ›ธ A Playground with various exercises for Tello Drones

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

ย 

History

63 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ธ DJI Tello Drone Playground

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.

๐Ÿš€ Getting Started

  1. Git clone or download this repository to your computer.
  2. Setup your development environment.
  3. Connect to the drone.
  4. Try controlling the drone manually with your smartphone. See this guide
  5. See the example exercises in the src folder
  6. Try some of the other more advanced exercises in the src folder
  7. Get creative and make your own scripts
  8. Have fun!

๐Ÿ“ก Setup Drone Connection

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):

  1. Power on your DJI Tello drone.

  2. Connect your computer to the drone's WiFi network.

    Connecting to Tello WiFi

    The WiFi network typically appears as TELLO-XXXXXX. Default password is usually 12345678.

๐Ÿ“‚ Folder Structure

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 for sanity_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.

๐Ÿ“ Exercises

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>.py

Replace <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

๐Ÿ” Troubleshooting

  • 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.

Port Already in Use Error

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:

  1. 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>
  2. 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
  3. Restart your computer if the above doesn't work - this will clear all stuck processes.

  4. 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.py has the same debug/no-takeoff behavior, but as constants you edit in the script instead of an environment variable โ€” see src/example_exercises/README.md.

๐Ÿž Debugging with Visual Studio Code

To enhance your coding and debugging experience, we recommend using the launch configurations with Visual Studio Code (VS Code).

๐Ÿ“š Other Resources

About

๐Ÿ›ธ A Playground with various exercises for Tello Drones

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages