Browse Source

Start button as well as stop on monitor

Also, 'tidy' analysis
Petra Lamborn 6 years ago
parent
commit
99b5fe8aa9
2 changed files with 18 additions and 1 deletions
  1. 5
    0
      analysis.rmd
  2. 13
    1
      monitor.py

+ 5
- 0
analysis.rmd View File

@@ -4,6 +4,11 @@ title: "Flight analysis"
4 4
 
5 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 12
 ```{r init}
8 13
 library(ggplot2)
9 14
 library(scales)

+ 13
- 1
monitor.py View File

@@ -24,11 +24,23 @@ rect.size = (200, 50)
24 24
 rect.position = (110-(screen_size[0]/2), screen_size[1]/2-75)
25 25
 
26 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 28
 button.rect_transform.position = (0, 0)
29 29
 
30 30
 # Set up a stream to monitor the throttle button
31 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 44
 f = open(datafile, 'w')
33 45
 f.write('timepoint, current_altitude, v_speed, h_speed, mass, fuel, available_thrust, current_thrust, g_force\n')
34 46
 timepoint = 0