-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathimu.h
47 lines (35 loc) · 1.01 KB
/
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
#pragma once
#include <joints.h>
#include <point_3d.h>
struct YPR {
float yaw{}, pitch{}, roll{};
YPR() = default;
YPR(float _yaw, float _pitch, float _roll) : yaw(_yaw), pitch(_pitch), roll(_roll) {}
YPR operator-(const YPR &o) {
return {yaw - o.yaw, pitch - o.pitch, roll - o.roll};
}
YPR operator+(const YPR &o) {
return {yaw + o.yaw, pitch + o.pitch, roll + o.roll};
}
};
struct PitchRoll {
float pitch{}, roll{};
PitchRoll() = default;
PitchRoll(float pitch, float roll) : pitch(pitch), roll(roll) {}
};
struct YawPitch {
float yaw{}, pitch{};
YawPitch() = default;
YawPitch(float yaw, float pitch) : yaw(yaw), pitch(pitch) {}
YawPitch(HeadJointAngles angles) : yaw(angles[0]), pitch(angles[1]) {}
YawPitch operator-(const YawPitch &o) {
return {yaw - o.yaw, pitch - o.pitch};
}
YawPitch operator+(const YawPitch &o) {
return {yaw + o.yaw, pitch + o.pitch};
}
};
struct IMU {
YPR gyr;
point_3d accel;
};