-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTelloTemplate.py
More file actions
85 lines (57 loc) · 1.83 KB
/
Copy pathTelloTemplate.py
File metadata and controls
85 lines (57 loc) · 1.83 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Started from Tello Template
# This Python app is in the Public domain
# Some parts from Tello3.py
import threading, socket, sys, time, subprocess
# GLOBAL VARIABLES DECLARED HERE....
host = ''
port = 9000
locaddr = (host,port)
tello_address = ('192.168.10.1', 8889) # Get the Tello drone's address
# Creates a UDP socketd
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(locaddr)
def recv():
count = 0
while True:
try:
data, server = sock.recvfrom(1518)
print(data.decode(encoding="utf-8"))
except Exception:
print ('\n****Keep Eye on Drone****\n')
break
def sendmsg(msg, sleep = 6):
print("Sending: " + msg)
msg = msg.encode(encoding="utf-8")
sock.sendto(msg, tello_address)
time.sleep(sleep)
# recvThread create
recvThread = threading.Thread(target=recv)
recvThread.start()
# CREATE FUNCTIONS HERE....
print("\nCyle & William")
print("Program Name:Hoop Competition ")
print("Date: 4.20.2026 ")
print("\n****CHECK YOUR TELLO WIFI ADDRESS****")
print("\n****CHECK SURROUNDING AREA BEFORE FLIGHT****")
ready = input('\nAre you ready to take flight: ')
try:
if ready.lower() == 'yes':
print("\nStarting Drone!\n")
sendmsg('command', 0)
sendmsg('battery?',0)
sendmsg('takeoff',12)
sendmsg('go 160 26 20 100',8)
sendmsg('go 240 0 35 100',12)
sendmsg('curve 155 145 0 0 270 0 60')
sendmsg('curve -145 -155 0 0 270 20 60',10)
sendmsg('cw 180',8)
sendmsg('land')
sendmsg('temp?')
sendmsg('battery?')
print('\nGreat Flight!!!')
else:
print('\nMake sure you check WIFI, surroundings, co-pilot is ready, re-run program\n')
except KeyboardInterrupt:
sendmsg('emergency')
breakr = True
sock.close()