Skip to content

Commit 49b1a44

Browse files
committed
compatability testing
Trying to get the start button to work (no luck so far)
1 parent 403a618 commit 49b1a44

File tree

3 files changed

+82
-13
lines changed

3 files changed

+82
-13
lines changed

drivers/flight_gui.py

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ def init(config=Config.FLIGHT):
5050
manager.DataType('temperature', float, units='deg C', thresholds=(-20, 80)),
5151
manager.DataType('gps_vel', float, units='xy m/s', thresholds=(-20, 100)),
5252
manager.DataType('gps_dir', float, units='xy deg', thresholds=(-20, 365)),
53-
manager.DataType('xy_from_lanch', float, units='xy m', thresholds=(-20, 100000)),
53+
manager.DataType('x_from_launch', float, units='m', thresholds=(-100000, 100000)),
54+
manager.DataType('y_from_launch', float, units='m', thresholds=(-100000, 100000)),
5455
manager.DataType('dir_from_launch', float, units='xy deg', thresholds=(-20, 365)),
5556
manager.DataType('P1_setting', bool),
5657
manager.DataType('P2_setting', bool),
@@ -65,14 +66,10 @@ def init(config=Config.FLIGHT):
6566
manager.DataType('launch_lon', float),
6667
manager.DataType('land_lat', float),
6768
manager.DataType('land_lon', float),
68-
manager.DataType('gps_n', float, units="m"),
69-
manager.DataType('gps_e', float, units="m"),
7069

71-
manager.DataType('up', bool),
72-
manager.DataType('down', bool),
7370
manager.DataType('gps_d', bool),
7471
manager.DataType('bmp_d', bool),
75-
manager.DataType('bmp_d2', bool),
72+
#manager.DataType('bmp_d2', bool),
7673
manager.DataType('bno_d', bool),
7774

7875
manager.DataType('run_time', int, units="ms"),
@@ -93,6 +90,7 @@ def init(config=Config.FLIGHT):
9390
dispatcher = manager.Dispatcher(*dts)
9491
data_manager = manager.DataManager(dispatcher)
9592
root = Tk()
93+
<<<<<<< HEAD
9694
root.configure(background='#69615e')
9795
app = gui.Application(
9896
dispatcher, data_manager, plots, master=root,
@@ -106,8 +104,20 @@ def init(config=Config.FLIGHT):
106104
plots_background='#69615e',
107105
controls_background='#69615e',
108106
default_baud=57600)
107+
=======
108+
app = gui.Application(dispatcher, data_manager, plots, master=root,
109+
window_manager_title=
110+
"Telemetry monitor - Demo" if config == Config.DEMO else
111+
"Telemetry monitor - Flight" if config == Config.FLIGHT else
112+
"Telemetry monitor",
113+
show_send_value=False,
114+
serial_console_height=5,
115+
plots_size=(10,10),
116+
default_baud=57600)
117+
>>>>>>> parent of b41a304... bg colors and positioning
109118

110119
running = False
120+
111121
def heartbeat():
112122
if running: #get link2ground status all the time, exept if I delete this line, the start/abort button doesn't work right for some reason
113123
app.sendValue("c") #c stands for connection, i.e. heartbeat
@@ -128,29 +138,36 @@ def check_stop(time, status):
128138
nonlocal running
129139
if status == 'STAND_BY': #was 'STAND_BY'
130140
#status.config(bg='#0fe9f5')
131-
app.stop()
141+
app.stop() #app.stop()
132142
running = False
133143
if config == Config.DEMO:
134144
countdown.config(text=" T-00:10:00")
135145
else:
136146
countdown.config(text=" T-01:00:00")
137147
start_abort_button.config(text="Start", bg='lime green')
138148
elif status == 'TERMINAL_COUNT':
149+
running = True
150+
app.start()
139151
status.config(bg='#e6d925')
152+
start_abort_button.config(text="Abort", bg='red')
140153
elif status == 'POWERED_ASCENT':
141154
status.config(bg='#e04122')
142-
155+
start_abort_button.config(text="Abort", bg='red')
143156
elif status == 'UNPOWERED_ASCENT':
144157
status.config(bg='#bd857b')
158+
start_abort_button.config(text="Abort", bg='red')
145159
elif status == 'FREEFALL':
146160
status.config(bg='#760e99')
161+
start_abort_button.config(text="Abort", bg='red')
147162
elif status == 'DROGUE_DESCENT':
148163
status.config(bg='#8b65ba')
164+
start_abort_button.config(text="Abort", bg='red')
149165
elif status == 'MAIN_DESCENT':
150166
status.config(bg='#402aa1')
151-
167+
start_abort_button.config(text="Abort", bg='red')
152168
elif status == 'LANDED':
153169
status.config(bg='#4395d9')
170+
start_abort_button.config(text="Abort", bg='red')
154171
else:
155172
start_abort_button.config(text="Abort", bg='red')
156173

@@ -169,13 +186,22 @@ def state_name(name):
169186
return lower_name.replace("_", " ")
170187

171188
# Add custom gui controls
189+
<<<<<<< HEAD
172190
Label(app, text="\nControls", bg= '#69615e').pack(side=TOP)
191+
=======
192+
Label(app, text="\nControls").pack()
193+
>>>>>>> parent of b41a304... bg colors and positioning
173194

174195
# Sensor controls
175196
#Label(app, text="\nSensor Controls").pack()
176197
controlsFrame = Frame(app, bg= '#69615e')
198+
<<<<<<< HEAD
177199
controlsFrame.pack(side=TOP) #expand=1
178200
sensorStatus = Label(controlsFrame, text="All sensors functional", fg='green', font=("Helvetica", 12), bg= '#c9c1be') #light grey c9c1be
201+
=======
202+
controlsFrame.pack() #expand=1
203+
sensorStatus = Label(controlsFrame, text="All sensors functional", fg='green', font=("Helvetica", 17))
204+
>>>>>>> parent of b41a304... bg colors and positioning
179205
sensorStatus.grid(row=0,column=0,columnspan=4)
180206
#Button(controlsFrame, text="Zero force", command=lambda: app.sendValue("zero_force")).pack(side=LEFT)
181207
#Button(controlsFrame, text="Zero pressure", command=lambda: app.sendValue("zero_pressure")).pack(side=LEFT)
@@ -236,12 +262,21 @@ def state_name(name):
236262
#Label(app, text="\nThrottle Controls").pack()
237263
throttleFrame = Frame(app, bg= '#69615e') #bg or background works
238264
throttleFrame.pack()
265+
<<<<<<< HEAD
239266
Label(throttleFrame, text="Drogue", font=("Helvetica", 10), bg= '#69615e').grid(row=0, column=1, sticky= W)
240267
Label(throttleFrame, text="Main", font=("Helvetica", 10), bg= '#69615e').grid(row=0, column=2, padx=15, sticky= W)
241268
Label(throttleFrame, text="1", font=("Helvetica", 10), bg= '#69615e').grid(row=1, column=0, sticky=W, padx=5)
242269
Label(throttleFrame, text="2", font=("Helvetica", 10), bg= '#69615e').grid(row=2, column=0, sticky=W, padx=5)
243270
Label(throttleFrame, text="Cam", font=("Helvetica", 10), bg= '#69615e').grid(row=3, column=0, sticky=W, padx=5)
244-
Button(throttleFrame, text="Reset board", font=("Helvetica", 8), command=lambda: app.sendValue("reset")).grid(row=3, column=2, sticky=W, padx=5)
271+
Button(throttleFrame, text="Reset board", font=("Helvetica", 8), command=lambda: app.sendValue("r")).grid(row=3, column=2, sticky=W, padx=5)
272+
=======
273+
Label(throttleFrame, text="Drouge", font=("Helvetica", 15)).grid(row=0, column=1)
274+
Label(throttleFrame, text="Main", font=("Helvetica", 15)).grid(row=0, column=2, padx=15)
275+
Label(throttleFrame, text="1", font=("Helvetica", 15)).grid(row=1, column=0, sticky=W, padx=5)
276+
Label(throttleFrame, text="2", font=("Helvetica", 15)).grid(row=2, column=0, sticky=W, padx=5)
277+
Label(throttleFrame, text="Cam", font=("Helvetica", 15)).grid(row=3, column=0, sticky=W, padx=5)
278+
Button(throttleFrame, text="Reset board", command=lambda: app.sendValue("reset")).grid(row=3, column=2, sticky=W, padx=5)
279+
>>>>>>> parent of b41a304... bg colors and positioning
245280

246281

247282
valves = ['P1', 'P2', 'P3', 'P4', 'P5'] #indexing starts at 0
@@ -259,11 +294,18 @@ def state_name(name):
259294
runFrame.pack(side=TOP)
260295
start_abort_button = Button(runFrame, text="Start", command=start_abort_handler, bg="lime green", height=2, width=8)
261296
start_abort_button.pack(side=LEFT)
297+
<<<<<<< HEAD
262298
countdown = Label(runFrame, text=" T-01:00:00", width=10, fg="red", font=("Helvetica", 16, "bold"), bg= '#c9c1be') #b9b1ae
263299
countdown.pack(side=TOP)
264300

265301
status = Label(runFrame, text=" Stand by", width=16, font=("Helvetica", 10), bg= '#c9c1be')
266302
status.pack(side=TOP)
303+
=======
304+
countdown = Label(runFrame, text=" T-01:00:00", fg="red", font=("Helvetica", 20, "bold"))
305+
countdown.pack()
306+
status = Label(runFrame, text=" Stand by", width=15, font=("Helvetica", 17))
307+
status.pack()
308+
>>>>>>> parent of b41a304... bg colors and positioning
267309

268310
# Listeners
269311
app.dispatcher.add_listener('status', lambda time, val: status.config(text=" " + state_name(val)))

src/gui.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,12 @@ def __init__(self,
5050
'serial_console_height': 15,
5151
'default_baud': 9600,
5252
'plots_size': (12,10),
53+
<<<<<<< HEAD
5354
'plots_background': 'white',
5455
'controls_background': None}
56+
=======
57+
'plots_background': 'white'}
58+
>>>>>>> parent of b41a304... bg colors and positioning
5559
new_flags.update(flags)
5660
self.flags = new_flags
5761

@@ -70,8 +74,13 @@ def __init__(self,
7074
self.flags['full_screen'] = args.full_screen
7175

7276
# Init gui
77+
<<<<<<< HEAD
7378
Frame.__init__(self, master, bg=self.flags['controls_background'])
7479
self.pack(side=LEFT) #side=LEFT
80+
=======
81+
Frame.__init__(self, master)
82+
self.pack()
83+
>>>>>>> parent of b41a304... bg colors and positioning
7584
#master.iconbitmap('telemetry.png')
7685
master.attributes("-fullscreen", self.flags['full_screen'])
7786
master.bind('<Escape>', self.unmaximize)
@@ -119,8 +128,13 @@ def _createWidgets(self):
119128
"""Initialize the various widgets in the main frame."""
120129
self._setupPlots()
121130

131+
<<<<<<< HEAD
122132
buttons = Frame(self, bg=self.flags['controls_background'])
123133
self.controlButton = Button(buttons, text="Start", command=self.start, bg="lime green",font=("Helvetica", 8))
134+
=======
135+
buttons = Frame(self)
136+
self.controlButton = Button(buttons, text="Start", command=self.start, bg="lime green")
137+
>>>>>>> parent of b41a304... bg colors and positioning
124138
self.controlButton.pack(side=LEFT)
125139

126140
self.exitButton = Button(buttons, text="Quit", command=self.terminate, font=("Helvetica", 8))
@@ -139,11 +153,20 @@ def _createWidgets(self):
139153
self.thresholdButton.pack(side=LEFT)
140154

141155
buttons.pack()
156+
<<<<<<< HEAD
142157
serialLabel = Label(self, text="\nSerial console", bg=self.flags['controls_background'])
143158
serialLabel.pack()
144159

145160
serial = Frame(self, bg=self.flags['controls_background'])
146161
serialControls = Frame(serial, bg=self.flags['controls_background'])
162+
=======
163+
164+
serialLabel = Label(self, text="\nSerial console")
165+
serialLabel.pack()
166+
167+
serial = Frame(self, bg= '#69615e')
168+
serialControls = Frame(serial)
169+
>>>>>>> parent of b41a304... bg colors and positioning
147170

148171
self.serialPort = StringVar(self)
149172
self.serialSelect = OptionMenu(serialControls, self.serialPort, [])
@@ -204,7 +227,11 @@ def _createWidgets(self):
204227
sendValues.pack()
205228

206229
# Value readout widget
230+
<<<<<<< HEAD
207231
valuesLabel = Label(self, text="\nCurrent values", bg=self.flags['controls_background'], height= 2)
232+
=======
233+
valuesLabel = Label(self, text="\nCurrent values")
234+
>>>>>>> parent of b41a304... bg colors and positioning
208235
if self.flags['show_current_values']:
209236
valuesLabel.pack(side=TOP)
210237

src/plot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self,
3737
suffix = suffix.replace("_", " ")
3838
if " " in suffix:
3939
suffix = suffix[suffix.index(" "):]
40-
40+
4141
if ys_names:
4242
self.ys_names = ys_names
4343
elif suffix:
@@ -133,7 +133,7 @@ def fn(x_data, y_data, y=y):
133133
j += 1
134134
x_data = new_x_data
135135
y_data = new_y_data
136-
136+
137137
assert len(x_data) == len(y_data)
138138
# 'Prune' plotted data to avoid slow-down with large amounts of data
139139
indices = range(0, len(x_data), max(len(x_data) // max_points, 1))
@@ -167,7 +167,7 @@ def gen_layout(plots):
167167
available = {(i, j): True
168168
for i in range(width)
169169
for j in range(height)}
170-
170+
171171
# List of info for each plot
172172
layout = []
173173

0 commit comments

Comments
 (0)