Hi everyone!
I am trying to follow along Murtaza's Workshop YouTube "Drone Programming With Python Course | 3 Hours | Including x4 Projects | Computer Vision" course:
However I have hit a wall at the imageCapture section.
The Tello drone connects to the computer and I can use the basic movements commands without any difficulty, having the drone take off / move around with commands issued from the laptop. However when I try to run the code below to get a video stream:
from djitellopy import tello
import cv2
me = tello.Tello()
me.connect()
print(me.get_battery())
me.streamon()
while True:
img = me.get_frame_read().frame
img = cv2.resize(img, (360, 240))
cv2.imshow("Image", img)
cv2.waitKey(1)
the code returns the error:
If you debug look at the return value for the Frame = "None" so there is no stream is coming back to the computer. Also seen in the returned "raise Exception('Failed to grab first frame from video stream')".
I have tried to turn the firewall completely off and also to create special inbound rules to allow the UDP port 11111 to come through, however that has not solved the issue.
I am using Windows 10, pycharm, and have tried this with Python 3.7 and 3.9. Additionally I have tried it with djitello and djitello2, am using opencv-python 4.5.2.52.
The issue isn't with the Tello drone - it can send a video to my phone, and my friend ran the same code on his laptop (running on Linux) and it opened up a live stream.
Does anyone have any idea how to troubleshoot this or what may be wrong? Thanks in advance!
I am trying to follow along Murtaza's Workshop YouTube "Drone Programming With Python Course | 3 Hours | Including x4 Projects | Computer Vision" course:
However I have hit a wall at the imageCapture section.
The Tello drone connects to the computer and I can use the basic movements commands without any difficulty, having the drone take off / move around with commands issued from the laptop. However when I try to run the code below to get a video stream:
from djitellopy import tello
import cv2
me = tello.Tello()
me.connect()
print(me.get_battery())
me.streamon()
while True:
img = me.get_frame_read().frame
img = cv2.resize(img, (360, 240))
cv2.imshow("Image", img)
cv2.waitKey(1)
the code returns the error:
[h264 @ 000001d171fc08c0] non-existing PTraceback (most recent call last):
File "C:/Users/Andrew Rudy/PycharmProjects/TelloDroneYouTubeProject/Video test 2.py", line 11, in <module>frame_read = tello.get_frame_read()File "C:\Users\Andrew Rudy\PycharmProjects\TelloDroneYouTubeProject\venv\lib\site-packages\djitellopy\enforce_types.py", line 54, in wrapperreturn func(*args, **kwargs)File "C:\Users\Andrew Rudy\PycharmProjects\TelloDroneYouTubeProject\venv\lib\site-packages\djitellopy\tello.py", line 404, in get_frame_readself.background_frame_read = BackgroundFrameRead(self, address) # also sets self.capFile "C:\Users\Andrew Rudy\PycharmProjects\TelloDroneYouTubeProject\venv\lib\site-packages\djitellopy\tello.py", line 932, in __init__raise Exception('Failed to grab first frame from video stream')
If you debug look at the return value for the Frame = "None" so there is no stream is coming back to the computer. Also seen in the returned "raise Exception('Failed to grab first frame from video stream')".
I have tried to turn the firewall completely off and also to create special inbound rules to allow the UDP port 11111 to come through, however that has not solved the issue.
I am using Windows 10, pycharm, and have tried this with Python 3.7 and 3.9. Additionally I have tried it with djitello and djitello2, am using opencv-python 4.5.2.52.
The issue isn't with the Tello drone - it can send a video to my phone, and my friend ran the same code on his laptop (running on Linux) and it opened up a live stream.
Does anyone have any idea how to troubleshoot this or what may be wrong? Thanks in advance!
Last edited: