Hello Tello Pilot!
Join our DJI Tello community & remove this banner.
Sign up

Sending a stream of commands without time.sleep

kross787

New member
Joined
Jul 10, 2019
Messages
3
Reaction score
1
Hi All,

I wanted to know what is your approach to sending commands to the tello. currently I always have to pause the program to give the tello time to react before sending the next command. Is this how it is supposed to work? or is there a better way?

for example:

tello.sendTello('takeoff')
time.sleep(3)
tello.sendTello('forward 50')
time.sleep(3)
tello.sendTello('back 50')
time.sleep(3)
tello.sendTello('left 50')
time.sleep(3)
tello.sendTello('land')

Thanks!
 
Hi All,

I wanted to know what is your approach to sending commands to the tello. currently I always have to pause the program to give the tello time to react before sending the next command. Is this how it is supposed to work? or is there a better way?

for example:

tello.sendTello('takeoff')
time.sleep(3)
tello.sendTello('forward 50')
time.sleep(3)
tello.sendTello('back 50')
time.sleep(3)
tello.sendTello('left 50')
time.sleep(3)
tello.sendTello('land')

Thanks!

According to many users on this forum - Yes. Otherwise Tello may miss commands altogether.

I use the Gobot implementation at home and most of my commands are punctuated with a minimum of one second of sleep. does your time.sleep(3) refer to 3 seconds or 3 milliseconds?
 
According to many users on this forum - Yes. Otherwise Tello may miss commands altogether.

I use the Gobot implementation at home and most of my commands are punctuated with a minimum of one second of sleep. does your time.sleep(3) refer to 3 seconds or 3 milliseconds?

Thanks, it refers to 3 seconds. Yesterday I implemented a different approach where I use a thread to receive the UDP messages and send the next command as soon as I receive the 'OK' from the previous. It's working very well at the moment. I know this solution will not be 100% reliable as I might never get the OK meesage but so far its working. at the moment I'm writing my own python library for commands, video, and telemetry and will upload to github if people would find it useful.

Khris
 
  • Like
Reactions: Samuel
... at the moment I'm writing my own python library for commands, video, and telemetry and will upload to github if people would find it useful.

Khris

I'm sure they will, Will you be including "Taking Pictures" as I believe that is where tello really shines.
 
I'm sure they will, Will you be including "Taking Pictures" as I believe that is where tello really shines.
I will, that bit I got working. Following inspiration from another post here I just tried some photogrammetry with my students and things are looking good. Will upload examples after we finish our sessions.
 
Thanks, it refers to 3 seconds. Yesterday I implemented a different approach where I use a thread to receive the UDP messages and send the next command as soon as I receive the 'OK' from the previous. It's working very well at the moment. I know this solution will not be 100% reliable as I might never get the OK meesage but so far its working. at the moment I'm writing my own python library for commands, video, and telemetry and will upload to github if people would find it useful.

Khris
Hi, Kross
I'm new in this TelloPilots forum. I'm interested in sending commands and accessing video stream to/from Tello through python codes. Would you mind sharing you python codes or github library to me ? That would be highly appreciated.
 
Yes! there's a much better way - asynchronous Python.

Have a look at my tello-asyncio library which makes it easy to use Python asyncio's await so each command gets sent when OK arrives back from the last one, without any sleeping at all

Python:
import asyncio
from tello_asyncio import Tello

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

asyncio.run(main())
 

New Posts

Members online

No members online now.

Forum statistics

Threads
5,690
Messages
39,934
Members
17,023
Latest member
Repiv

New Posts