Implemented first Hangar-Service
Dependencies: CalibrateMagneto QuaternionMath
Fork of SML2 by
Diff: SensorFusion.h
- Revision:
- 21:5a0c9406e119
- Parent:
- 20:503cbe360419
- Child:
- 26:8f3e4e1a3acc
diff -r 503cbe360419 -r 5a0c9406e119 SensorFusion.h --- a/SensorFusion.h Thu Apr 09 09:51:51 2015 +0000 +++ b/SensorFusion.h Thu Apr 09 11:54:48 2015 +0000 @@ -12,7 +12,8 @@ public: class Delegate { - virtual void sensorTick(Vector3 fused, Vector3 accel, Vector3 magneto, Vector3 gyro, Quaternion q) = 0; + public: + virtual void sensorTick(Vector3 fused, Vector3 accel, Vector3 magneto, Vector3 gyro, Quaternion q) {} }; SensorFusion(I2C &i2c); @@ -24,12 +25,13 @@ virtual void sensorUpdate(Vector3 gyro_degrees); // gyro's callback private: + Delegate defaultDelegate; // to avoid check for existence every time Delegate* delegate; Accelerometer accel; Gyroscope gyro; Magnetometer magneto; Quaternion q; - float deltat, beta; + float const deltat, beta; void updateFilter(float ax, float ay, float az, float gx, float gy, float gz, float mx, float my, float mz); Vector3 eulerAngles(Quaternion const &q) const; };