Successful acro and level mode now! Relying on MPU9250 as base sensor. I'm working continuously on tuning and features :) NEWEST VERSION ON: https://github.com/MaEtUgR/FlyBed (CODE 100% compatible/copyable)

Dependencies:   mbed

Committer:
maetugr
Date:
Tue Sep 08 13:38:10 2015 +0000
Revision:
0:37f0c1e8fa66
Child:
7:90f876d47862
MPU9250 on the new Board works fine over SPI; RC is broken and works with FlyBed2 :(

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maetugr 0:37f0c1e8fa66 1 // by MaEtUgR
maetugr 0:37f0c1e8fa66 2
maetugr 0:37f0c1e8fa66 3 #ifndef IMU_10DOF_H
maetugr 0:37f0c1e8fa66 4 #define IMU_10DOF_H
maetugr 0:37f0c1e8fa66 5
maetugr 0:37f0c1e8fa66 6 #include "mbed.h"
maetugr 0:37f0c1e8fa66 7 #include "MPU9250.h" // Combined Gyroscope & Accelerometer & Magnetometer over SPI
maetugr 0:37f0c1e8fa66 8 #include "IMU_Filter.h" // Class to calculate position angles (algorithm from S.O.H. Madgwick, see header file for info)
maetugr 0:37f0c1e8fa66 9
maetugr 0:37f0c1e8fa66 10 class IMU_10DOF
maetugr 0:37f0c1e8fa66 11 {
maetugr 0:37f0c1e8fa66 12 public:
maetugr 0:37f0c1e8fa66 13 IMU_10DOF(PinName MOSI, PinName MISO, PinName SCLK, PinName CS);
maetugr 0:37f0c1e8fa66 14 void readAngles(); // read all sensors and calculate angles
maetugr 0:37f0c1e8fa66 15
maetugr 0:37f0c1e8fa66 16 float * angle; // where the measured and calculated data is saved
maetugr 0:37f0c1e8fa66 17 float temperature;
maetugr 0:37f0c1e8fa66 18 float pressure;
maetugr 0:37f0c1e8fa66 19 float altitude;
maetugr 0:37f0c1e8fa66 20
maetugr 0:37f0c1e8fa66 21 float dt; // time for entire loop
maetugr 0:37f0c1e8fa66 22 float dt_sensors; // time only to read sensors
maetugr 0:37f0c1e8fa66 23
maetugr 0:37f0c1e8fa66 24 MPU9250 mpu; // The sensor Hardware Driver
maetugr 0:37f0c1e8fa66 25
maetugr 0:37f0c1e8fa66 26 private:
maetugr 0:37f0c1e8fa66 27 Timer LocalTimer; // local time to calculate processing speed for entire loop and just reading sensors
maetugr 0:37f0c1e8fa66 28 float time_for_dt; // |
maetugr 0:37f0c1e8fa66 29 float time_for_dt_sensors; // |
maetugr 0:37f0c1e8fa66 30
maetugr 0:37f0c1e8fa66 31 IMU_Filter Filter; // Filterclass to join sensor data
maetugr 0:37f0c1e8fa66 32 };
maetugr 0:37f0c1e8fa66 33
maetugr 0:37f0c1e8fa66 34 #endif