A simple library to interface with the DJI Tello drone
Project description
RKTelloLib
In light of the many poorly-designed libraries to interact with the DJI (Ryze) Tello drone that either do way more than they should or don't do enough, I have taken the initiative to create this small library. It's a simple interface built upon the official Tello SDK that allows you to control and interact with the drone with minimal effort.
Installation
Install using PIP
$ pip install rktellolib
Install from Source
$ git clone https://github.com/ramujin/rktellolib.git
$ cd rktellolib
$ pip install -e .
Example Usage to Fly in a Square Pattern
from rktellolib import Tello
drone = Tello(debug=True, has_video=False)
drone.connect()
drone.takeoff()
drone.forward(100)
drone.cw(90)
drone.forward(100)
drone.cw(90)
drone.forward(100)
drone.cw(90)
drone.forward(100)
drone.cw(90)
drone.land()
drone.disconnect()
Example Usage to Stream Video
from rktellolib import Tello
import cv2
drone = Tello(debug=True, has_video=True)
drone.connect()
while True:
frame = drone.get_frame()
if frame is None:
break
cv2.imshow('rktellolib', frame)
if cv2.waitKey(1) == 27: # ESC key
break
drone.disconnect()
Available Commands
# Operational Commands
connect()
disconnect()
takeoff()
land()
# Discrete Action Commands
up(distance: int)
down(distance: int)
left(distance: int)
right(distance: int)
forward(distance: int)
back(distance: int)
cw(degree: int)
ccw(degree: int)
# RC Control Command
rc(v_lr: int, v_fb: int, v_ud: int, v_yaw: int)
# Camera Command
get_frame()
# Retrieve All Drone State Information
get_states()
# Retrieve a Specific State
get_state(field: str)
# Retrieve System & Environment States
get_battery()
get_flight_time()
get_temp()
get_barometer()
# Retrieve Positional States
get_height()
get_distance_tof()
get_ax()
get_ay()
get_az()
get_vx()
get_vy()
get_vz()
# Retrieve Rotational States
get_roll()
get_pitch()
get_yaw()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rktellolib-1.0.4.tar.gz
(8.8 kB
view details)
Built Distribution
File details
Details for the file rktellolib-1.0.4.tar.gz
.
File metadata
- Download URL: rktellolib-1.0.4.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62add37501111f65f42e9145a95a75bc9d8c6e1f252c16ba18fc4c1ef219bd02 |
|
MD5 | 4eef5d8bc92836e1cb575a640770ebff |
|
BLAKE2b-256 | 3bdbd4609cb15908d39c70bf6fe48025d427dc37dda4b6046f9f11dafb53cba0 |
File details
Details for the file rktellolib-1.0.4-py3-none-any.whl
.
File metadata
- Download URL: rktellolib-1.0.4-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfe87ffd0543546f12e7cbac7b752643e43a8e97217399e9fe7bc712bcb77ab4 |
|
MD5 | 8c250982633d19ca5b49e948f34fe549 |
|
BLAKE2b-256 | 6ef7d33778adc35d1401c70c57cd44e47d202892899b77db2c4ecb9cacc222da |