New version of quadcopter software written to OO principles
Dependencies: mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS
Diff: Sensors/Imu/Imu.h
- Revision:
- 2:969dfa4f2436
- Parent:
- 0:c6a85bb2a827
- Child:
- 3:4823d6750629
--- a/Sensors/Imu/Imu.h Wed Mar 04 18:53:43 2015 +0000 +++ b/Sensors/Imu/Imu.h Wed Apr 01 11:19:21 2015 +0000 @@ -0,0 +1,65 @@ +#include "mbed.h" +#include "Global.h" +#include "FreeIMU.h" +#include "filter.h" +#include "ConfigFileWrapper.h" +#include "Kalman.h" + +#ifndef Imu_H +#define Imu_H + +class Imu +{ + public: + Imu(ConfigFileWrapper& configFileWrapper); + ~Imu(); + + struct Rate + { + double yaw; + double pitch; + double roll; + }; + + struct Angle + { + double yaw; + double pitch; + double roll; + }; + + struct Velocity + { + double x; + double y; + double z; + }; + + void enable(bool enable); + + Rate getRate(); + Angle getAngle(bool bias = true); + float getVelocity(float time); + float getVelocity(); + double getAltitude(); + + void zeroGyro(); + void zeroBarometer(); + void zeroAccel(); + void setCurrentVelocity(float velocity); + + private: + FreeIMU _freeImu; + filter* _barometerZeroFilter; + filter* _barometerFilter; + Rate _rate; + Angle _angle; + float _velocity; + float _barometerZero; + ConfigFileWrapper& _configFileWrapper; + float _accelZeroPitch; + float _accelZeroRoll; + Kalman* _kalmanFilter; +}; + +#endif \ No newline at end of file