-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMotionState.h
44 lines (42 loc) · 1.01 KB
/
MotionState.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
#ifndef MOTIONSTATE_H
#define MOTIONSTATE_H
#include "HardwareType.h"
#include "SensorFusion.h"
#ifdef BATON
#include <Adafruit_LSM9DS1.h>
#include <Adafruit_Sensor.h>
#endif
#ifdef STAFF
#include "MPU9250.h"
#endif
class MotionState
{
public:
MotionState();
bool isEnabled;
SF orientation;
int relativeAngularVelocity;
float angularVelocity;
float angularAcceleration;
int relativeAngularAcceleration;
int relativeJerk;
float jerk;
float pointingX;
float pointingY;
float pointingZ;
float rawAxialAccel;
#ifdef BATON
int Update(Adafruit_LSM9DS1* imu); // returns milliseconds if processing falls behind filter rate.
#endif
#ifdef STAFF
int Update(MPU9250* imu); // returns milliseconds if processing falls behind filter rate.
#endif
private:
float maxAngularAcceleration;
float maxAngularVelocity;
float maxJerk;
float lastAccel;
float lastAngularVelocity;
long lastUpdateTime;
};
#endif