library for 9dof using madgwick's algorithm
Dependents: NerfGun_nRF24L01P_TX_9d0f
MadgwickAHRS.h@0:756055ce357a, 2015-08-13 (annotated)
- Committer:
- b50559
- Date:
- Thu Aug 13 22:11:38 2015 +0000
- Revision:
- 0:756055ce357a
created library for sensor fusion using madgwick's algorithm
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
b50559 | 0:756055ce357a | 1 | //===================================================================================================== |
b50559 | 0:756055ce357a | 2 | // MadgwickAHRS.h |
b50559 | 0:756055ce357a | 3 | //===================================================================================================== |
b50559 | 0:756055ce357a | 4 | // |
b50559 | 0:756055ce357a | 5 | // Implementation of Madgwick's IMU and AHRS algorithms. |
b50559 | 0:756055ce357a | 6 | // See: http://www.x-io.co.uk/node/8#open_source_ahrs_and_imu_algorithms |
b50559 | 0:756055ce357a | 7 | // |
b50559 | 0:756055ce357a | 8 | // Date Author Notes |
b50559 | 0:756055ce357a | 9 | // 29/09/2011 SOH Madgwick Initial release |
b50559 | 0:756055ce357a | 10 | // 02/10/2011 SOH Madgwick Optimised for reduced CPU load |
b50559 | 0:756055ce357a | 11 | // |
b50559 | 0:756055ce357a | 12 | //===================================================================================================== |
b50559 | 0:756055ce357a | 13 | #ifndef MadgwickAHRS_h |
b50559 | 0:756055ce357a | 14 | #define MadgwickAHRS_h |
b50559 | 0:756055ce357a | 15 | |
b50559 | 0:756055ce357a | 16 | //---------------------------------------------------------------------------------------------------- |
b50559 | 0:756055ce357a | 17 | |
b50559 | 0:756055ce357a | 18 | class MadgwickAHRS{ |
b50559 | 0:756055ce357a | 19 | |
b50559 | 0:756055ce357a | 20 | public: |
b50559 | 0:756055ce357a | 21 | |
b50559 | 0:756055ce357a | 22 | MadgwickAHRS(float Freq); |
b50559 | 0:756055ce357a | 23 | |
b50559 | 0:756055ce357a | 24 | //Function declarations |
b50559 | 0:756055ce357a | 25 | void update(float gx, float gy, float gz, float ax, float ay, float az, float mx, float my, float mz); |
b50559 | 0:756055ce357a | 26 | void updateIMU(float gx, float gy, float gz, float ax, float ay, float az); |
b50559 | 0:756055ce357a | 27 | void getEuler(); |
b50559 | 0:756055ce357a | 28 | int16_t getRoll(); |
b50559 | 0:756055ce357a | 29 | int16_t getPitch(); |
b50559 | 0:756055ce357a | 30 | int16_t getYaw(); |
b50559 | 0:756055ce357a | 31 | |
b50559 | 0:756055ce357a | 32 | |
b50559 | 0:756055ce357a | 33 | private: |
b50559 | 0:756055ce357a | 34 | |
b50559 | 0:756055ce357a | 35 | // Variable declaration |
b50559 | 0:756055ce357a | 36 | float sampleFreq; |
b50559 | 0:756055ce357a | 37 | float roll; |
b50559 | 0:756055ce357a | 38 | float pitch; |
b50559 | 0:756055ce357a | 39 | float yaw; |
b50559 | 0:756055ce357a | 40 | }; |
b50559 | 0:756055ce357a | 41 | |
b50559 | 0:756055ce357a | 42 | #endif |
b50559 | 0:756055ce357a | 43 | //===================================================================================================== |
b50559 | 0:756055ce357a | 44 | // End of file |
b50559 | 0:756055ce357a | 45 | //===================================================================================================== |