Hello,
I have had the same issue with this pip repo. I decided to manually connect to the drone via websockets. The thing is that the documentation is very sparse and I just recently found this github repo:
GitHub - cozmobotics/tellTello: a console program for the Ryze Robotics Tello quadrocopter
I will try to reverse engineer it to build a more modern way to communicate with the
Tello.
My python class basically looks like this:
import socket
import numpy as np
class DjiTello:
def __init__(self, video=False, log=None, verbose=False):
self.TELLO_IP = "192.168.10.1"
self.TELLO_PORT = 8889
self.TELLO_VIDEO_PORT = 11111
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.sock.bind(('', 9000))
self.sock.settimeout(0.5)
self.log = log
self.verbose = verbose
self.rc_store=[0,0,0,0]
def _internal_log(self, msg):
if self.verbose and self.log is not None:
self.log.info(msg)
def _handle_response(self):
try:
data, server = self.sock.recvfrom(1024)
print(f"Response: {data.decode('utf-8')}")
except socket.timeout:
print(f"Timeout")
def send_command(self, command):
"""Standard-Befehle (takeoff, land), die eine Bestätigung 'ok' erfordern."""
try:
self.sock.sendto(command.encode('utf-8'), (self.TELLO_IP, self.TELLO_PORT))
# Setze einen kurzen Timeout, damit wir nicht ewig hängen
self.sock.settimeout(2.0)
data, server = self.sock.recvfrom(1024)
print(f"Response: {data.decode('utf-8')}")
except socket.timeout:
print(f"Timeout: {command}")
except Exception as e:
print(f"{e}")
def set_rc(self, side, fw, altitude, yaw):
# Werte runden und begrenzen
side = int(np.clip(side, -100, 100))
fw = int(np.clip(fw, -100, 100))
altitude = int(np.clip(altitude, -100, 100))
yaw = int(np.clip(yaw, -100, 100))
# Nur senden, wenn sich Werte geändert haben oder periodisch (optional)
command = f"rc {int(side)} {int(fw)} {int(altitude)} {int(yaw)}"
try:
self.sock.sendto(command.encode('utf-8'), (self.TELLO_IP, self.TELLO_PORT))
except Exception as e:
print(f"{e}")
def setup(self):
self.send_command("command")
def get_battery(self):
self.send_command("battery?")
def get_speed(self):
self.send_command("speed?")
def get_flight_time(self):
self.send_command("time?")
def get_wifi(self):
self.send_command("wifi?")
def get_video(self):
pass
It doesn't work perfectly yet but in the next week I will fork the tellTello github repo to have a python library that is up to date.
FYI: You certainly need the documentation to use the python class: