-
Notifications
You must be signed in to change notification settings - Fork 286
/
Copy pathDrawAxis.pde
100 lines (92 loc) · 2.31 KB
/
DrawAxis.pde
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
void drawAxisX() {
/* draw gyro x-axis */
noFill();
stroke(0,0,255); // blue
// redraw everything
beginShape();
for(int i = 0; i<gyroX.length;i++)
vertex(i,gyroX[i]);
endShape();
// put all data one array back
for(int i = 1; i<gyroX.length;i++)
gyroX[i-1] = gyroX[i];
/* draw acceleromter x-axis */
noFill();
stroke(0,255,0); // green
// redraw everything
beginShape();
for(int i = 0; i<accX.length;i++)
vertex(i,accX[i]);
endShape();
// put all data one array back
for(int i = 1; i<accX.length;i++)
accX[i-1] = accX[i];
/* draw complementary filter x-axis */
noFill();
stroke(255,255,0); // yellow
// redraw everything
beginShape();
for(int i = 0; i<compX.length;i++)
vertex(i,compX[i]);
endShape();
// put all data one array back
for(int i = 1; i<compX.length;i++)
compX[i-1] = compX[i];
/* draw kalman filter x-axis */
noFill();
stroke(255,0,0);//red
// redraw everything
beginShape();
for(int i = 0; i<kalmanX.length;i++)
vertex(i,kalmanX[i]);
endShape();
// put all data one array back
for(int i = 1; i<kalmanX.length;i++)
kalmanX[i-1] = kalmanX[i];
}
void drawAxisY() {
/* draw gyro y-axis */
noFill();
stroke(0,0,255); // blue
// redraw everything
beginShape();
for(int i = 0; i<gyroY.length;i++)
vertex(i,gyroY[i]);
endShape();
// put all data one array back
for(int i = 1; i<gyroY.length;i++)
gyroY[i-1] = gyroY[i];
/* draw acceleromter y-axis */
noFill();
stroke(0,255,0); // green
// redraw everything
beginShape();
for(int i = 0; i<accY.length;i++)
vertex(i,accY[i]);
endShape();
// put all data one array back
for(int i = 1; i<accY.length;i++)
accY[i-1] = accY[i];
/* draw complementary filter y-axis */
noFill();
stroke(255,255,0); // yellow
// redraw everything
beginShape();
for(int i = 0; i<compY.length;i++)
vertex(i,compY[i]);
endShape();
// put all data one array back
for(int i = 1; i<compY.length;i++)
compY[i-1] = compY[i];
/* draw kalman filter y-axis */
noFill();
stroke(255,0,0); // red
// redraw everything
beginShape();
for(int i = 0; i<kalmanY.length;i++)
vertex(i,kalmanY[i]);
endShape();
//put all data one array back
for(int i = 1; i<kalmanY.length;i++)
kalmanY[i-1] = kalmanY[i];
}