IMU filter
Diff: MadgwickAHRS.h
- Revision:
- 0:0c61d7209f75
diff -r 000000000000 -r 0c61d7209f75 MadgwickAHRS.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MadgwickAHRS.h Mon May 30 08:10:20 2016 +0000 @@ -0,0 +1,33 @@ +// MadgwickAHRS.h +//===================================================================================================== +// +// Implementation of Madgwick's IMU and AHRS algorithms. +// See: http://www.x-io.co.uk/node/8#open_source_ahrs_and_imu_algorithms +// +// Date Author Notes +// 29/09/2011 SOH Madgwick Initial release +// 02/10/2011 SOH Madgwick Optimised for reduced CPU load +// +//===================================================================================================== +#ifndef MadgwickAHRS_h +#define MadgwickAHRS_h + +//---------------------------------------------------------------------------------------------------- +// Variable declaration +extern int instability_fix; +extern volatile float beta; // algorithm gain +extern volatile float q0, q1, q2, q3; // quaternion of sensor frame relative to auxiliary frame + +//extern volatile float quat[4]; + +//--------------------------------------------------------------------------------------------------- +// Function declarations + +void MadgwickAHRSupdate(float tdelta, float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz); +void MadgwickAHRSupdateIMU(float tdelta, float gx, float gy, float gz, float ax, float ay, float az); +float invSqrt(float x); + +#endif +//===================================================================================================== +// End of file +//=====================================================================================================