-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimu.h
63 lines (47 loc) · 848 Bytes
/
imu.h
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
#ifndef IMU_H
#define IMU_H
#include <Arduino.h>
#include <MPU9250.h>
void setup_imu();
void calib_imu();
void debug_imu();
struct Attitude {
double roll, pitch, yaw;
Attitude()
: roll(0), pitch(0), yaw(0) {}
void reset() {
roll = 0;
pitch = 0;
yaw = 0;
}
void print()
{
Serial.print(roll);
Serial.print(" ");
Serial.print(pitch);
Serial.print(" ");
Serial.println(yaw);
}
};
struct Linear {
double x, y, z;
Linear()
: x(0), y(0), z(0) {}
void reset() {
x = 0;
y = 0;
z = 0;
}
void print()
{
Serial.print(x);
Serial.print(" ");
Serial.print(y);
Serial.print(" ");
Serial.println(z);
}
};
void get_linear_acc(Linear& acc, const Attitude& angles);
void get_angles(Attitude& angles);
void get_rates(Attitude& rates);
#endif