An fully working IMU-Filter and Sensor drivers for the 10DOF-Board over I2C. All in one simple class. Include, calibrate sensors, call read, get angles. (3D Visualisation code for Python also included) Sensors: L3G4200D, ADXL345, HMC5883, BMP085

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers IMU_10DOF.h Source File

IMU_10DOF.h

00001 // by MaEtUgR
00002 
00003 #ifndef IMU_10DOF_H
00004 #define IMU_10DOF_H
00005 
00006 #include "mbed.h"
00007 #include "L3G4200D.h"   // Gyro (Gyroscope)
00008 #include "ADXL345.h"    // Acc (Accelerometer)
00009 #include "HMC5883.h"    // Comp (Compass)
00010 #include "BMP085.h"     // Alt (Altitude sensor or Barometer)
00011 #include "IMU_Filter.h" // Class to calculate position angles  (algorithm from S.O.H. Madgwick, see header file for info)
00012 
00013 class IMU_10DOF
00014 {           
00015     public:
00016         IMU_10DOF(PinName sda, PinName scl);
00017         void readAngles();              // read all axis from register to array data
00018         void readAltitude();            // read all axis from register to array data
00019         
00020         float * angle;                  // where the measured and calculated data is saved
00021         float temperature;
00022         float pressure;
00023         float altitude;
00024         
00025         float dt;                       // local time to calculate processing speed for entire loop and just reading sensors
00026         float dt_sensors;               // |
00027     private:                            // |
00028         Timer LocalTimer;               // |
00029         float time_for_dt;              // |
00030         float time_for_dt_sensors;      // |
00031         
00032         L3G4200D    Gyro;               // All sensors Hardwaredrivers
00033         ADXL345     Acc;
00034         HMC5883     Comp;
00035         BMP085      Alt;
00036         
00037         IMU_Filter  Filter;             // Filterclass to join sensor data
00038 };
00039 
00040 #endif