A Python-based DJI Tello interface which utilizes parallel processing.
Project description
SAC-Tello
A simple library for controlling a DJI Tello Drone. Built for educational use.
Dependencies
numpy>=1.23.4
opencv-python>=4.6.0.66
face_recognition>=1.3.0
pygame>=2.2.0
Install
SAC-Tello can be install by running the following command:
python3 -m pip install SAC-Tell0
for MacOS/Linux
Or
python -m pip install SAC-Tello
for Windows
How To Use
Tello Drone
The primary interface for the drone is the TelloDrone class.
Creating a TelloDrone object is a simple as the following:
from SAC_Tello import TelloDrone
drone = TelloDrone()
A created drone object does not connect to the tello drone. This merely sets up everything that needs to be in place before a connection is made.
To connect to the Tello, the TelloDrone class has a method called start()
once the Tello is connected remember to call the close()
method when
done. The start()
method returns True
if the connection worked and False
if not.
For example a simple takeoff and land program looks like this:
from SAC_Tello import TelloDrone
drone = TelloDrone()
drone.start()
drone.takeoff()
drone.land()
drone.complete()
drone.close()
The following are all commands that can be sent to the Tello:
Command | Method | Arguments |
---|---|---|
takeoff | takeoff | None |
land | land | None |
up | up | distance: int |
down | down | distance: int |
left | left | distance: int |
right | right | distance: int |
forward | forward | distance: int |
backward | backward | distance: int |
rotate cw | rotate_cw | degrees: int |
rotate ccw | rotate_ccw | degrees: int |
flip left | flip_left | None |
flip right | flip_right | None |
flip forward | flip_forward | None |
flip backward | flip_backward | None |
move | move | x: int, y: int, z: int, spd: int |
emergency | emergency | None |
Commands are run in parallel and put into a queue for execution. In order
to complete the remaining commands in the queue, simply call the complete()
method of the TelloDrone object.
Tello Heads-up Display
As an additional feature SAC-Tello gives access to a near-real time video stream while the Tello is connected. To make this stream more useful a HUD was added. This HUD shows the following:
- Current Battery life
- Current Time-of-Flight sensor reading
- Artificial Horizon indicating changes in pitch and roll
To use the HUD simply import and create a TelloDrone
object and link it
with a TelloHud
object:
from SAC_Tello import TelloDrone, TelloHud
drone = TelloDrone()
hud = TelloHud(drone)
drone.start()
hud.activate_hud()
hud.deactivate_hud()
drone.close()
The HUD will launch a separate window when activated. This window can be
closed at anytime by pressing the X
in the upper right-hand corner.
Note: Before the HUD is activated nothing will happen. Once the HUD is active you will need to deactivate before your program ends.
Tello Remote Control
SAC-Tello also comes with a class for using a ground station computer as
a remote control for the tello. This remote control can be combined with
the TelloHud
class just like the TelloDrone
class, but we will skip that
here.
To create and use the remote control simply include the following in your program:
from SAC_Tello import TelloRC
drone = TelloRC()
drone.start()
drone.control()
drone.close()
The control()
method begins polling loop for keyboard input. The controls
are as follows:
Key Press | Effect |
---|---|
T | Takeoff |
L | Land |
ESCAPE | Emergency Kill Switch |
BACKSPACE | End Remote Control |
Key Held | Effect |
---|---|
W | Increase Forward Velocity |
A | Increase Leftward Velocity |
S | Increase Backward Velocity |
D | Increase Rightward Velocity |
Q | Rotate Counterclockwise |
E | Rotate Clockwise |
Up Arrow | Increase Hover Height |
Down Arrow | Decrease Hover Height |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for sac_tello-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e919860a4235ddcd6ce7bb3b956fe9f5e195ea088301b126145257db78c343b |
|
MD5 | 07d4fd0787d791cae88cb9dc5d66dae0 |
|
BLAKE2b-256 | d5c599631966a16f8c008578cb63f8337ab92ffb276a8b4b7eef1588382e136c |