-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtelloVideoOutpuTest.py
63 lines (53 loc) · 1.63 KB
/
telloVideoOutpuTest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from djitellopy import tello
import cv2
me = tello.Tello()
#cap = cv2.VideoCapture(0)
me.connect()
print('Connected!')
print("Tello battery: " + str(me.get_battery()))
me.streamon()
while True:
img = me.get_frame_read().frame
img = cv2.resize(img, (360, 240))
cv2.imshow("results", img)
cv2.waitKey(1)
# from threading import Thread as th
# import socket
# from ctypes import windll as wdll
# import cv2
# # Title
# title = "TELLO Control Panel v.0.1.1 [DEVELOPMENT]"
# wdll.kernel32.SetConsoleTitleW(title)
# # Networking stuff
# class Net:
# host = ''
# port = 9000
# locaddr = (host, port)
# sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# sock.bind(locaddr)
# tello_address = ('192.168.10.1', 8889)
# def recv(self):
# count = 0
# while True:
# try:
# data, server = self.sock.recvfrom(1518)
# print("Response: " + data.decode(encoding="utf-8"))
# except Exception:
# print('Exit . . .')
# break
# recvThread = th(target=recv, daemon=True)
# recvThread.start()
# def send(self, msg):
# msgEncoded = msg.encode("utf-8")
# self.sock.sendto(msgEncoded, self.tello_address)
# class VideoOutput:
# try:
# Net.send(Net(), 'command')
# Net.send(Net(), 'streamon')
# except Exception as e:
# print(f"[EXCEPTION]: {e}")
# while True:
# img = me.get_frame_read().frame
# img = cv2.resize(img, (360, 240))
# cv2.imshow("results", img)
# cv2.waitKey(1)