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:
Mon Sep 14 12:49:08 2015 +0000
Revision:
7:90f876d47862
Parent:
0:37f0c1e8fa66
Child:
8:609a2ad4c30e
Changed a lot of Timing related things; controll frequency is now regulated to 495Hz becuase this is the output frequency anyway

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 7:90f876d47862 27 Timer LoopTimer; // local time to calculate processing speed for entire loop
maetugr 7:90f876d47862 28 Timer SensorTimer; // local time to calculate processing speed for just reading sensors
maetugr 0:37f0c1e8fa66 29
maetugr 0:37f0c1e8fa66 30 IMU_Filter Filter; // Filterclass to join sensor data
maetugr 0:37f0c1e8fa66 31 };
maetugr 0:37f0c1e8fa66 32
maetugr 0:37f0c1e8fa66 33 #endif