Getting Started with Tello Drone Programming
In this series, I’ll be diving into various Tello drone projects, and in this post, I’ll walk through the basics of setting up a Tello drone programming environment and share my system setup.
Setting Up Your Project in PyCharm
I use PyCharm Community Edition 2024 as my IDE.
- Create a New Project: Open PyCharm and create a new project.
- Set Project Interpreter: Ensure your project interpreter is correctly set.
- Navigate to
File → Settings → Project → Project Interpreter
. - Click the
+
button to add a new package. - Search for
djitellopy
and install it.
- Navigate to
The djitellopy
library is a wrapper for the Tello SDK. You can add any additional modules to your virtual environment from this page. Here are the packages I’ve installed for my project:
- djitellopy: 2.5.0
- numpy: 2.0.0
- opencv-python: 4.10.0.84
- pillow: 10.4.0
- pip: 23.2.1
- pygame: 2.6.0
These packages are installed within your virtual environment. If you start a new project, you’ll need to reinstall these packages. Alternatively, you can reuse the same project folder for different experiments before settling on a final setup.
Connecting to the Tello Drone
To control your Tello drone, connect your PC to the drone’s WiFi network:
- Power on your Tello drone.
- Go to your PC’s WiFi settings and connect to the network named something like “TELLO-XXXXXX”.
Basic Tello Commands
Here’s a simple script to make the Tello drone take off, hover, and land:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from djitellopy import Tello
import time
# Create a Tello object
tello = Tello()
# Connect to the Tello drone
tello.connect()
# Display the battery level
print(f"Battery: {tello.get_battery()}%")
# Take off
tello.takeoff()
# Move right with maximum speed for 2 seconds
tello.send_rc_control(100, 0, 0, 0)
time.sleep(2)
# Move forward at half speed for 3 seconds
tello.send_rc_control(0, 50, 0, 0)
time.sleep(3)
# Move up with maximum speed for 1 second
tello.send_rc_control(0, 0, 100, 0)
time.sleep(1)
# Rotate clockwise with maximum speed for 2 seconds
tello.send_rc_control(0, 0, 0, 100)
time.sleep(2)
# Stop all movement
tello.send_rc_control(0, 0, 0, 0)
# Land
tello.land()
Explanation of the Example
- Move right: The drone moves to the right at maximum speed (
100
on the left/right channel) for 2 seconds. - Move forward: The drone moves forward at half speed (
50
on the forward/backward channel) for 3 seconds. - Move up: The drone ascends at maximum speed (
100
on the up/down channel) for 1 second. - Rotate clockwise: The drone rotates clockwise at maximum speed (
100
on the yaw channel) for 2 seconds. - Stop all movement: The drone stops all movement by setting all velocity values to
0
. - Land: The drone lands safely.
These velocity commands provide precise control over the drone’s movements, allowing for smoother and more intricate flight patterns.