Rio Harris / Madgwick_Algorithm

Dependents:   NerfGun_nRF24L01P_TX_9d0f

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MadgwickAHRS.h Source File

MadgwickAHRS.h

00001 //=====================================================================================================
00002 // MadgwickAHRS.h
00003 //=====================================================================================================
00004 //
00005 // Implementation of Madgwick's IMU and AHRS algorithms.
00006 // See: http://www.x-io.co.uk/node/8#open_source_ahrs_and_imu_algorithms
00007 //
00008 // Date         Author          Notes
00009 // 29/09/2011   SOH Madgwick    Initial release
00010 // 02/10/2011   SOH Madgwick    Optimised for reduced CPU load
00011 //
00012 //=====================================================================================================
00013 #ifndef MadgwickAHRS_h
00014 #define MadgwickAHRS_h
00015 
00016 //----------------------------------------------------------------------------------------------------
00017 
00018 class MadgwickAHRS{
00019     
00020 public:
00021 
00022     MadgwickAHRS(float Freq);
00023     
00024     //Function declarations
00025     void update(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz);
00026     void updateIMU(float gx, float gy, float gz, float ax, float ay, float az);
00027     void getEuler();
00028     int16_t getRoll();
00029     int16_t getPitch();
00030     int16_t getYaw();
00031     
00032     
00033 private:
00034     
00035     // Variable declaration
00036     float sampleFreq;
00037     float roll;
00038     float pitch;
00039     float yaw;
00040 };
00041 
00042 #endif
00043 //=====================================================================================================
00044 // End of file
00045 //=====================================================================================================