New version of quadcopter software written to OO principles

Dependencies:   mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS

Committer:
joe4465
Date:
Wed Apr 01 11:19:21 2015 +0000
Revision:
2:969dfa4f2436
Parent:
0:c6a85bb2a827
Child:
3:4823d6750629
Altitude hold with 2 PID's working. Exported to offline compiler

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joe4465 0:c6a85bb2a827 1 #include "mbed.h"
joe4465 2:969dfa4f2436 2 #include "Global.h"
joe4465 2:969dfa4f2436 3 #include "StatusLights.h"
joe4465 0:c6a85bb2a827 4
joe4465 0:c6a85bb2a827 5 #ifndef Status_H
joe4465 0:c6a85bb2a827 6 #define Status_H
joe4465 0:c6a85bb2a827 7
joe4465 2:969dfa4f2436 8 class Status
joe4465 0:c6a85bb2a827 9 {
joe4465 2:969dfa4f2436 10 public:
joe4465 2:969dfa4f2436 11 Status();
joe4465 2:969dfa4f2436 12 ~Status();
joe4465 0:c6a85bb2a827 13
joe4465 0:c6a85bb2a827 14 enum State
joe4465 0:c6a85bb2a827 15 {
joe4465 0:c6a85bb2a827 16 PREFLIGHT,
joe4465 0:c6a85bb2a827 17 STANDBY,
joe4465 0:c6a85bb2a827 18 GROUND_READY,
joe4465 0:c6a85bb2a827 19 MANUAL,
joe4465 0:c6a85bb2a827 20 STABILISED,
joe4465 0:c6a85bb2a827 21 AUTO,
joe4465 2:969dfa4f2436 22 ERROR
joe4465 0:c6a85bb2a827 23 };
joe4465 0:c6a85bb2a827 24
joe4465 0:c6a85bb2a827 25 enum FlightMode
joe4465 0:c6a85bb2a827 26 {
joe4465 0:c6a85bb2a827 27 RATE,
joe4465 2:969dfa4f2436 28 STAB
joe4465 2:969dfa4f2436 29 };
joe4465 2:969dfa4f2436 30
joe4465 2:969dfa4f2436 31 enum NavigationMode
joe4465 2:969dfa4f2436 32 {
joe4465 2:969dfa4f2436 33 NONE,
joe4465 2:969dfa4f2436 34 ALTITUDE_HOLD,
joe4465 2:969dfa4f2436 35 POSITION_HOLD
joe4465 0:c6a85bb2a827 36 };
joe4465 0:c6a85bb2a827 37
joe4465 0:c6a85bb2a827 38 enum BaseStationMode
joe4465 0:c6a85bb2a827 39 {
joe4465 0:c6a85bb2a827 40 MOTOR_POWER,
joe4465 0:c6a85bb2a827 41 PID_OUTPUTS,
joe4465 0:c6a85bb2a827 42 IMU_OUTPUTS,
joe4465 0:c6a85bb2a827 43 STATUS,
joe4465 2:969dfa4f2436 44 RC,
joe4465 0:c6a85bb2a827 45 PID_TUNING,
joe4465 0:c6a85bb2a827 46 GPS,
joe4465 0:c6a85bb2a827 47 ZERO,
joe4465 0:c6a85bb2a827 48 RATE_TUNING,
joe4465 0:c6a85bb2a827 49 STAB_TUNING,
joe4465 0:c6a85bb2a827 50 ALTITUDE,
joe4465 2:969dfa4f2436 51 VELOCITY,
joe4465 2:969dfa4f2436 52 ALTITUDE_STATUS
joe4465 0:c6a85bb2a827 53 };
joe4465 0:c6a85bb2a827 54
joe4465 2:969dfa4f2436 55 bool update();
joe4465 0:c6a85bb2a827 56 State getState();
joe4465 0:c6a85bb2a827 57 bool setFlightMode(FlightMode flightMode);
joe4465 0:c6a85bb2a827 58 FlightMode getFlightMode();
joe4465 2:969dfa4f2436 59 bool setNavigationMode(NavigationMode navigationMode);
joe4465 2:969dfa4f2436 60 NavigationMode getNavigationMode();
joe4465 0:c6a85bb2a827 61 bool setBaseStationMode(BaseStationMode baseStationMode);
joe4465 0:c6a85bb2a827 62 BaseStationMode getBaseStationMode();
joe4465 2:969dfa4f2436 63 bool setBatteryLevel(double batteryLevel);
joe4465 2:969dfa4f2436 64 double getBatteryLevel();
joe4465 0:c6a85bb2a827 65 bool setArmed(bool armed);
joe4465 0:c6a85bb2a827 66 bool getArmed();
joe4465 0:c6a85bb2a827 67 bool setInitialised(bool initialised);
joe4465 0:c6a85bb2a827 68 bool getInitialised();
joe4465 0:c6a85bb2a827 69 bool setRcConnected(bool rcConnected);
joe4465 0:c6a85bb2a827 70 bool getRcConnected();
joe4465 2:969dfa4f2436 71 bool setMotorsSpinning(bool flying);
joe4465 2:969dfa4f2436 72 bool getMotorsSpinning();
joe4465 2:969dfa4f2436 73 bool setDeadZone(bool flying);
joe4465 2:969dfa4f2436 74 bool getDeadZone();
joe4465 0:c6a85bb2a827 75
joe4465 0:c6a85bb2a827 76 private:
joe4465 0:c6a85bb2a827 77 State _state;
joe4465 2:969dfa4f2436 78 FlightMode _flightMode;
joe4465 2:969dfa4f2436 79 NavigationMode _navigationMode;
joe4465 0:c6a85bb2a827 80 BaseStationMode _baseStationMode;
joe4465 2:969dfa4f2436 81 StatusLights _statusLights;
joe4465 2:969dfa4f2436 82 bool setState(State state);
joe4465 2:969dfa4f2436 83 void flash();
joe4465 2:969dfa4f2436 84 double _batteryLevel;
joe4465 0:c6a85bb2a827 85 bool _armed;
joe4465 0:c6a85bb2a827 86 bool _initialised;
joe4465 0:c6a85bb2a827 87 bool _rcConnected;
joe4465 2:969dfa4f2436 88 bool _flying;
joe4465 2:969dfa4f2436 89 bool _deadZone;
joe4465 0:c6a85bb2a827 90 };
joe4465 0:c6a85bb2a827 91
joe4465 0:c6a85bb2a827 92 #endif