robagar / tello-asyncio

A library for controlling and interacting with the Tello EDU drone using modern asynchronous Python.
GNU Lesser General Public License v2.1
29 stars 6 forks source link
asyncio drone python tello

tello-asyncio

A library for controlling and interacting with the Tello EDU drone using modern asynchronous Python. All operations are implemented as awaitable coroutines, completed when the drone sends acknowledgment of the command message.

Package tello-asyncio on PyPi.

(If Rust is more your thing, there is also an equivalent asynchronous Rust library tello-edu)

$ pip3 install tello-asyncio
import asyncio
from tello_asyncio import Tello

async def main():
    drone = Tello()
    try:
        await drone.connect()
        await drone.takeoff()
        await drone.turn_clockwise(360)
        await drone.land()
    finally:
        await drone.disconnect()

asyncio.run(main())

See the examples directory for more usage example scripts.

Requires Python 3.6+. Developed and tested with Python 3.9.4 in Mac OS and 3.6.9 in Ubuntu 18.04 on a Jetson Nano. The tello_asyncio package has no other dependencies (and never will have any), but some examples need other things to be installed to work.

Full documentation is available on Read the docs

Tello SDK Support

A Note on Awaiting

The Tello SDK command/response model is a natural fit for the asynchronous python awaitable idea, but the drone will get confused if commands are sent before it's had a chance to respond. Each command should be awaited before sending the next.

It works best sequentially like this...

await drone.takeoff()
await drone.land()

...but not concurrently (which will not work as expected)

await asyncio.gather(
    drone.takeoff(), 
    drone.land()
)

Version History

1.0.0

Basic drone control

1.1.0

Drone state

1.2.0

Advanced drone control

Video

Error handling

1.3.0

Complete SDK

Video

Error handling

1.3.1

1.3.2

1.4.0

1.4.1

1.5.0

1.6.0

2.0.0

2.1.0

2.1.1

2.1.2

2.1.3