Explorar el Código

Start button as well as stop on monitor

Also, 'tidy' analysis
Petra Lamborn hace 6 años
padre
commit
99b5fe8aa9
Se han modificado 2 ficheros con 18 adiciones y 1 borrados
  1. 5
    0
      analysis.rmd
  2. 13
    1
      monitor.py

+ 5
- 0
analysis.rmd Ver fichero

4
 
4
 
5
 This file creates graphs of recorded flight parameters
5
 This file creates graphs of recorded flight parameters
6
 
6
 
7
+```{r opts, include=FALSE}
8
+library(knitr)
9
+opts_chunk$set(tidy=TRUE)
10
+```
11
+
7
 ```{r init}
12
 ```{r init}
8
 library(ggplot2)
13
 library(ggplot2)
9
 library(scales)
14
 library(scales)

+ 13
- 1
monitor.py Ver fichero

24
 rect.position = (110-(screen_size[0]/2), screen_size[1]/2-75)
24
 rect.position = (110-(screen_size[0]/2), screen_size[1]/2-75)
25
 
25
 
26
 # Add a button to set the throttle to maximum
26
 # Add a button to set the throttle to maximum
27
-button = panel.add_button("Stop monitor")
27
+button = panel.add_button("Start monitor")
28
 button.rect_transform.position = (0, 0)
28
 button.rect_transform.position = (0, 0)
29
 
29
 
30
 # Set up a stream to monitor the throttle button
30
 # Set up a stream to monitor the throttle button
31
 button_clicked = conn.add_stream(getattr, button, 'clicked')
31
 button_clicked = conn.add_stream(getattr, button, 'clicked')
32
+
33
+# Wait for button
34
+while button_clicked() == False:
35
+    time.sleep(0.1)
36
+
37
+button.remove()
38
+
39
+# replace button
40
+button = panel.add_button("Stop monitor")
41
+button.rect_transform.position = (0, 0)
42
+button_clicked = conn.add_stream(getattr, button, 'clicked')
43
+
32
 f = open(datafile, 'w')
44
 f = open(datafile, 'w')
33
 f.write('timepoint, current_altitude, v_speed, h_speed, mass, fuel, available_thrust, current_thrust, g_force\n')
45
 f.write('timepoint, current_altitude, v_speed, h_speed, mass, fuel, available_thrust, current_thrust, g_force\n')
34
 timepoint = 0
46
 timepoint = 0