library for 9dof using madgwick's algorithm
Dependents: NerfGun_nRF24L01P_TX_9d0f
Diff: MadgwickAHRS.h
- Revision:
- 0:756055ce357a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MadgwickAHRS.h Thu Aug 13 22:11:38 2015 +0000 @@ -0,0 +1,45 @@ +//===================================================================================================== +// 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 + +//---------------------------------------------------------------------------------------------------- + +class MadgwickAHRS{ + +public: + + MadgwickAHRS(float Freq); + + //Function declarations + void update(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz); + void updateIMU(float gx, float gy, float gz, float ax, float ay, float az); + void getEuler(); + int16_t getRoll(); + int16_t getPitch(); + int16_t getYaw(); + + +private: + + // Variable declaration + float sampleFreq; + float roll; + float pitch; + float yaw; +}; + +#endif +//===================================================================================================== +// End of file +//=====================================================================================================