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

Tello auto landing after running code using djitellopy module

mumkyy

New member
Joined
Dec 21, 2022
Messages
3
Reaction score
0
I recently got hold of a Tello drone in order to use it in an AI project of mine. So far, I have been testing it and trying to control the drone using the djitellopy module that has been created for python. At first, everything was fine, but now when running simple code, the drone automatically lands with a blinking red light and no error message, the code continues to run until it realizes it cannot land because it already has. Could this be an issue with the battery slot or something else? Here is the code I'm trying to run...

from djitellopy import Tello
import cv2, math, time

tello = Tello()
tello.connect()

tello.streamon()
frame_read = tello.get_frame_read()

tello.takeoff()
time.sleep(3)

while True:
# In reality you want to display frames in a seperate thread. Otherwise
# they will freeze while the drone moves.

img = frame_read.frame
cv2.imshow("drone", img)

key = cv2.waitKey(1) & 0xff
if key == 27: # ESC
break

tello.land()
 
Your program sleeps too long.

When the drone does not receive a command within a certain amount of time, it lands for safety reasons (e.g. when your program crashed or connection broke).
 
  • Like
Reactions: JPeterson4
Your program sleeps too long.

When the drone does not receive a command within a certain amount of time, it lands for safety reasons (e.g. when your program crashed or connection broke).
Thanks for the reply, I'm afraid I tried to remove the sleep command entirely and nothing changed. It takes off fine and begins to show the camera, but then after a few seconds of hovering it autolands and gives a flashing red light, indicating a critical error of some sort. I can run the program again and it the light goes away, only to persist after takeoff.
 
The reason is the same: Tello did'nt receive further commands for some time and so decides to land. This is also explained in the SDK documentation (chapter "safety function"). You should make sure to keep the communication alive at least every 2-3 seconds or so e.g. by sending the "command" command.
 
The reason is the same: Tello did'nt receive further commands for some time and so decides to land. This is also explained in the SDK documentation (chapter "safety function"). You should make sure to keep the communication alive at least every 2-3 seconds or so e.g. by sending the "command" command.
Thank you so much, this wokrs great!
 

New Posts

Members online

No members online now.

Forum statistics

Threads
5,676
Messages
39,895
Members
16,943
Latest member
muertesilencio147@outlook

New Posts