AHRS Library

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers AHRS.h Source File

AHRS.h

00001 #include "Mahony.h"
00002 #include "MadgwickAHRS.h"
00003 #include "LinearCharacteristics.h"
00004 #include "LSM9DS1.h"
00005 #include "Signal.h"
00006 
00007 class AHRS{
00008 public:
00009     AHRS(uint8_t,float);
00010     virtual ~AHRS();
00011     
00012     float getRollRadians() {
00013         if (!RPY_filter.anglesComputed) RPY_filter.computeAngles();
00014         return RPY_filter.getRoll();
00015     }
00016     float getPitchRadians() {
00017         if (!RPY_filter.anglesComputed) RPY_filter.computeAngles();
00018         return RPY_filter.getPitch();
00019     }
00020     float getYawRadians() {
00021         if (!RPY_filter.anglesComputed) RPY_filter.computeAngles();
00022         return RPY_filter.getYaw();
00023     }
00024     LSM9DS1 imu;
00025     Mahony RPY_filter;
00026     LinearCharacteristics raw_gx2gx;
00027     LinearCharacteristics raw_gy2gy;
00028     LinearCharacteristics raw_gz2gz;
00029 private:
00030     Signal signal;
00031     Thread thread;
00032     Ticker ticker;
00033     Mutex mutex;      // mutex to lock critical sections 
00034     void sendSignal();
00035     void update();
00036     LinearCharacteristics raw_ax2ax;
00037     LinearCharacteristics raw_ay2ay;
00038     LinearCharacteristics raw_az2az;
00039     LinearCharacteristics int2magx;     
00040     LinearCharacteristics int2magy;
00041     LinearCharacteristics int2magz;
00042     SPI spi;
00043     DigitalOut csAG;         // for spi
00044     DigitalOut csM;           //  "
00045 };