This repository has been archived by the owner on Feb 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tello_run.py
134 lines (114 loc) · 2.37 KB
/
tello_run.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
from lib.helper_functions import *
from lib.controller_input import XboxController
from lib.tellopic import setup_field
from guizero import App, Text, Combo, Picture
from djitellopy import Tello
from threading import Thread, Lock
# noinspection PyArgumentEqualDefault
app = App(title="Daedalus Robotics Tello GUI", layout="auto")
controller = XboxController()
tello = Tello()
field = setup_field(app=app)
# print(field)
# Button Variables
mp = -1
battery = -1
mission_pad_text = Text(
app,
text=f"MP: {mp}",
align="top"
)
battery_text = Text(
app,
text=f"Battery: {battery}%",
align="top"
)
autonomous_text = Text(
app,
text=f"Autonomous Mode: {is_auton}",
align="top"
)
side_switch = Combo(
app,
options=["textron", "residential"],
selected="textron",
command=set_side,
align="top"
)
mission_text = Text(app, text=f"mission: {m_type}")
mission_picture_1 = Picture(
app,
image=r"assets\mission_1.png",
width=778,
height=296,
align="left",
visible=False
)
mission_picture_2 = Picture(
app,
image=r"assets\mission_2.png",
width=778,
height=296,
align="left",
visible=False
)
mission_picture_3 = Picture(
app,
image=r"assets\mission_3.png",
width=778,
height=296,
align="left",
visible=False
)
# noinspection PyArgumentEqualDefault
base_pads_picture = Picture(
app,
image=r"assets\basepads.png",
width=778,
height=296,
align="left",
visible=True
)
tello_lock = Lock()
tello_control_thread = Thread(
target=lambda: tello_control_loop(
tello,
controller,
tello_lock,
base_pads_picture,
field=field
),
daemon=True
)
tello_update_thread = Thread(
target=lambda: tello_update_loop(
tello,
battery_text,
mission_pad_text
),
daemon=True
)
tello_status_thread = Thread(
target=lambda: switch_status(
tello,
controller,
tello_lock,
autonomous_text,
mission_text,
mission_picture_1,
mission_picture_2,
mission_picture_3,
base_pad=base_pads_picture,
field=field
),
daemon=True
)
tello.connect()
tello.set_mission_pad_detection_direction(0)
try:
tello_control_thread.start()
tello_update_thread.start()
tello_status_thread.start()
app.display()
finally:
tello.end()