New version of quadcopter software written to OO principles
Dependencies: mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS
Diff: Sensors/Sensors.h
- Revision:
- 3:4823d6750629
- Parent:
- 2:969dfa4f2436
- Child:
- 4:9ffbf9101992
--- a/Sensors/Sensors.h Wed Apr 01 11:19:21 2015 +0000 +++ b/Sensors/Sensors.h Fri Apr 24 16:50:20 2015 +0000 @@ -6,11 +6,14 @@ #include "Status.h" #include "LidarLitePwm.h" #include "Kalman.h" +#include <math.h> #ifndef Sensors_H #define Sensors_H -#define PI 3.14159265 +//#define PI 3.14159265 + +using namespace std; class Sensors { @@ -20,11 +23,7 @@ struct Position { - double accelX; - double accelY; - double accelZ; - double latitude; - double longitude; + Gps::Value gpsPosition; double computedX; double computedY; }; @@ -41,13 +40,14 @@ Imu::Rate getRate(); Imu::Angle getAngle(); Gps::Value getGpsValues(); - double getZVelocity(); + Imu::Velocity getImuVelocity(); Sensors::Altitude getAltitude(); Sensors::Position getPosition(); void enable(bool enable); void zeroBarometer(); void updateImu(); void zeroAccel(); + void zeroPos(); private: void zeroGyro(); @@ -56,17 +56,21 @@ void updateVelocity(); void updatePosition(); int getLidarAltitude(); + double toRadian(double deg); Status& _status; Imu::Rate _rate; Imu::Angle _angle; Position _position; + Position _startingPosition; Altitude _altitude; Gps::Value _gpsValues; Imu* _imu; Gps* _gps; LidarLitePwm* _lidar; Kalman* _altitudeKalmanFilter; + Kalman* _xPosKalmanFilter; + Kalman* _yPosKalmanFilter; }; #endif \ No newline at end of file