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

Can't control Tello through Python

stoop

New member
Joined
Nov 1, 2021
Messages
1
Reaction score
0
i am having a hard time trying to control Tello via Python on a variety of PC and Mac machines. I connect OK to the drone's WiFi but running the code gives me errrors. I'm using the djitellopy library - here is the simple code I am trying:

from djitellopy import tello
from time import sleep

drone = tello.Tello()
drone.connect()
sleep(5)

print(drone.get_battery())
drone.takeoff()
sleep(3)
drone.rotate_clockwise(90)
sleep(3)
drone.land()

And here is the output from my Mac. Could it be the Python version?

PS: Flies just fine using my iPhone as controller


/Users/stoop/PycharmProjects/Tello/venv/bin/python /Users/stoop/PycharmProjects/Tello/BasicControls.py
[INFO] tello.py - 122 - Tello instance was initialized. Host: '192.168.10.1'. Port: '8889'.
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 973, in _bootstrap_inner
self.run()
File "/usr/local/Cellar/[email protected]/3.9.7_1/Frameworks/Python.framework/Versions/3.9/lib/python3.9/threading.py", line 910, in run
self._target(*self._args, **self._kwargs)
File "/Users/stoop/PycharmProjects/Tello/venv/lib/python3.9/site-packages/djitellopy/enforce_types.py", line 54, in wrapper
return func(*args, **kwargs)
File "/Users/stoop/PycharmProjects/Tello/venv/lib/python3.9/site-packages/djitellopy/tello.py", line 164, in udp_state_receiver
state_socket.bind(("", Tello.STATE_UDP_PORT))
OSError: [Errno 48] Address already in use
[INFO] tello.py - 437 - Send command: 'command'
[INFO] tello.py - 461 - Response command: 'ok'
Traceback (most recent call last):
File "/Users/stoop/PycharmProjects/Tello/BasicControls.py", line 5, in <module>
drone.connect()
File "/Users/stoop/PycharmProjects/Tello/venv/lib/python3.9/site-packages/djitellopy/enforce_types.py", line 54, in wrapper
return func(*args, **kwargs)
File "/Users/stoop/PycharmProjects/Tello/venv/lib/python3.9/site-packages/djitellopy/tello.py", line 546, in connect
raise Exception('Did not receive a state packet from the Tello')
Exception: Did not receive a state packet from the Tello

Process finished with exit code 1
 

New Threads

Members online

No members online now.

Forum statistics

Threads
5,229
Messages
37,784
Members
14,357
Latest member
TelloJohn48