Implemented first Hangar-Service

Dependencies:   CalibrateMagneto QuaternionMath

Fork of SML2 by TobyRich GmbH

Committer:
pvaibhav
Date:
Wed Mar 18 15:34:51 2015 +0000
Revision:
15:4488660e1a3b
Child:
17:e9d42864c8a1
Axes updated again. SensorFusion class added. Works for quaternion output.

Who changed what in which revision?

UserRevisionLine numberNew 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 15:4488660e1a3b 28 };
pvaibhav 15:4488660e1a3b 29
pvaibhav 15:4488660e1a3b 30 #endif