from djitellopy import tello
import cv2
# Create instances for each Tello drone
drone1 = tello.Tello(ip='192.168.10.2') # Replace with your first Wi-Fi adapter's IP
#drone2 = tello.Tello(ip='192.168.10.3') # Replace with your second Wi-Fi adapter's IP
# ... Add more instances for additional drones
# Connect to drones
drone1.connect()
#drone2.connect()
# ... Connect other drones
# Send commands to drones
# drone1.takeoff()
# drone2.takeoff()
# ... Send other commands
# Clean up
drone1.streamon()
# while True:
# img = drone1.get_frame_read().frame
# img = cv2.resize(img, (360, 240))
# cv2.imshow("results", img)
# if cv2.waitKey(1) & 0xFF == ord('q'):
# break
Whenever I try to call the streamon function I get this error, tried asking ChatGPT but would not give me an answer
Traceback (most recent call last):
File "C:\Users\origi\PycharmProjects\DroneProject\venv\Interface.py", line 4, in <module>
drone1 = tello.Tello(ip='192.168.10.2') # Replace with your first Wi-Fi adapter's IP
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\origi\PycharmProjects\DroneProject\venv\Lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
TypeError: Tello.__init__() got an unexpected keyword argument 'ip'
Exception ignored in: <function Tello.__del__ at 0x000001FAE5924720>
Traceback (most recent call last):
File "C:\Users\origi\PycharmProjects\DroneProject\venv\Lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\origi\PycharmProjects\DroneProject\venv\Lib\site-packages\djitellopy\tello.py", line 1028, in __del__
self.end()
File "C:\Users\origi\PycharmProjects\DroneProject\venv\Lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\origi\PycharmProjects\DroneProject\venv\Lib\site-packages\djitellopy\tello.py", line 1023, in end
host = self.address[0]
^^^^^^^^^^^^
AttributeError: 'Tello' object has no attribute 'address'
Process finished with exit code 1
I am using multiple network adapters to connect to multiple ryze drones but can't even get the streamon fn to work for the first one
For the IP address of the first tello drone, i specified my network adapters ip adress as tellos have the same IP
Any response is appreciated :)
The main problem in your code is not the
AttributeError, it's theTypeErrorin the constructor:You are either using an outdated version of the library, or ChatGPT just hallucinated and generated invalid code. If you take a look at the constructor of the
Telloclass (here), you can see that it accepts these parameters:So you should use
hostinstead ofipwhen creating theTelloinstance.