Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
SensorFusion.h@17:e9d42864c8a1, 2015-03-26 (annotated)
- Committer:
- pvaibhav
- Date:
- Thu Mar 26 15:43:49 2015 +0000
- Revision:
- 17:e9d42864c8a1
- Parent:
- 15:4488660e1a3b
- Child:
- 20:503cbe360419
Use my own Euler angle conversion formulas in sensorfusion
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pvaibhav | 15:4488660e1a3b | 1 | #ifndef _H_SENSORFUSION_H |
pvaibhav | 15:4488660e1a3b | 2 | #define _H_SENSORFUSION_H |
pvaibhav | 15:4488660e1a3b | 3 | |
pvaibhav | 15:4488660e1a3b | 4 | #include "I2CPeripheral.h" |
pvaibhav | 15:4488660e1a3b | 5 | #include "Magnetometer.h" |
pvaibhav | 15:4488660e1a3b | 6 | #include "Accelerometer.h" |
pvaibhav | 15:4488660e1a3b | 7 | #include "Gyroscope.h" |
pvaibhav | 15:4488660e1a3b | 8 | #include "Quaternion.h" |
pvaibhav | 15:4488660e1a3b | 9 | |
pvaibhav | 15:4488660e1a3b | 10 | class SensorFusion : public Sensor::Delegate |
pvaibhav | 15:4488660e1a3b | 11 | { |
pvaibhav | 15:4488660e1a3b | 12 | public: |
pvaibhav | 15:4488660e1a3b | 13 | SensorFusion(I2C &i2c); |
pvaibhav | 15:4488660e1a3b | 14 | |
pvaibhav | 15:4488660e1a3b | 15 | bool start(); |
pvaibhav | 15:4488660e1a3b | 16 | void stop(); |
pvaibhav | 15:4488660e1a3b | 17 | |
pvaibhav | 15:4488660e1a3b | 18 | virtual void sensorTick(Vector3 fused, Vector3 accel, Vector3 magneto, Vector3 gyro, Quaternion q) = 0; |
pvaibhav | 15:4488660e1a3b | 19 | virtual void sensorUpdate(Vector3 gyro_degrees); // gyro's callback |
pvaibhav | 15:4488660e1a3b | 20 | |
pvaibhav | 15:4488660e1a3b | 21 | private: |
pvaibhav | 15:4488660e1a3b | 22 | Accelerometer accel; |
pvaibhav | 15:4488660e1a3b | 23 | Gyroscope gyro; |
pvaibhav | 15:4488660e1a3b | 24 | Magnetometer magneto; |
pvaibhav | 15:4488660e1a3b | 25 | Quaternion q; |
pvaibhav | 15:4488660e1a3b | 26 | float deltat, beta; |
pvaibhav | 15:4488660e1a3b | 27 | void updateFilter(float ax, float ay, float az, float gx, float gy, float gz, float mx, float my, float mz); |
pvaibhav | 17:e9d42864c8a1 | 28 | Vector3 eulerAngles(Quaternion const &q) const; |
pvaibhav | 15:4488660e1a3b | 29 | }; |
pvaibhav | 15:4488660e1a3b | 30 | |
pvaibhav | 15:4488660e1a3b | 31 | #endif |