New version of quadcopter software written to OO principles
Dependencies: mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS
Status/Status.h@0:c6a85bb2a827, 2015-03-04 (annotated)
- Committer:
- joe4465
- Date:
- Wed Mar 04 18:50:37 2015 +0000
- Revision:
- 0:c6a85bb2a827
- Child:
- 2:969dfa4f2436
New version of quadcopter software, written following OO principles
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joe4465 | 0:c6a85bb2a827 | 1 | #include "mbed.h" |
joe4465 | 0:c6a85bb2a827 | 2 | |
joe4465 | 0:c6a85bb2a827 | 3 | #ifndef Status_H |
joe4465 | 0:c6a85bb2a827 | 4 | #define Status_H |
joe4465 | 0:c6a85bb2a827 | 5 | |
joe4465 | 0:c6a85bb2a827 | 6 | class Status // begin declaration of the class |
joe4465 | 0:c6a85bb2a827 | 7 | { |
joe4465 | 0:c6a85bb2a827 | 8 | public: // begin public section |
joe4465 | 0:c6a85bb2a827 | 9 | Status(); // constructor |
joe4465 | 0:c6a85bb2a827 | 10 | ~Status(); // destructor |
joe4465 | 0:c6a85bb2a827 | 11 | |
joe4465 | 0:c6a85bb2a827 | 12 | enum State |
joe4465 | 0:c6a85bb2a827 | 13 | { |
joe4465 | 0:c6a85bb2a827 | 14 | PREFLIGHT, |
joe4465 | 0:c6a85bb2a827 | 15 | STANDBY, |
joe4465 | 0:c6a85bb2a827 | 16 | GROUND_READY, |
joe4465 | 0:c6a85bb2a827 | 17 | MANUAL, |
joe4465 | 0:c6a85bb2a827 | 18 | STABILISED, |
joe4465 | 0:c6a85bb2a827 | 19 | AUTO, |
joe4465 | 0:c6a85bb2a827 | 20 | ABORT, |
joe4465 | 0:c6a85bb2a827 | 21 | EMG_LAND, |
joe4465 | 0:c6a85bb2a827 | 22 | EMG_OFF, |
joe4465 | 0:c6a85bb2a827 | 23 | GROUND_ERROR |
joe4465 | 0:c6a85bb2a827 | 24 | }; |
joe4465 | 0:c6a85bb2a827 | 25 | |
joe4465 | 0:c6a85bb2a827 | 26 | enum FlightMode |
joe4465 | 0:c6a85bb2a827 | 27 | { |
joe4465 | 0:c6a85bb2a827 | 28 | RATE, |
joe4465 | 0:c6a85bb2a827 | 29 | STAB, |
joe4465 | 0:c6a85bb2a827 | 30 | NOT_SET |
joe4465 | 0:c6a85bb2a827 | 31 | }; |
joe4465 | 0:c6a85bb2a827 | 32 | |
joe4465 | 0:c6a85bb2a827 | 33 | enum BaseStationMode |
joe4465 | 0:c6a85bb2a827 | 34 | { |
joe4465 | 0:c6a85bb2a827 | 35 | MOTOR_POWER, |
joe4465 | 0:c6a85bb2a827 | 36 | PID_OUTPUTS, |
joe4465 | 0:c6a85bb2a827 | 37 | IMU_OUTPUTS, |
joe4465 | 0:c6a85bb2a827 | 38 | STATUS, |
joe4465 | 0:c6a85bb2a827 | 39 | MAPPED_RC, |
joe4465 | 0:c6a85bb2a827 | 40 | PID_TUNING, |
joe4465 | 0:c6a85bb2a827 | 41 | GPS, |
joe4465 | 0:c6a85bb2a827 | 42 | ZERO, |
joe4465 | 0:c6a85bb2a827 | 43 | RATE_TUNING, |
joe4465 | 0:c6a85bb2a827 | 44 | STAB_TUNING, |
joe4465 | 0:c6a85bb2a827 | 45 | ALTITUDE, |
joe4465 | 0:c6a85bb2a827 | 46 | VELOCITY |
joe4465 | 0:c6a85bb2a827 | 47 | }; |
joe4465 | 0:c6a85bb2a827 | 48 | |
joe4465 | 0:c6a85bb2a827 | 49 | bool initialise(); |
joe4465 | 0:c6a85bb2a827 | 50 | bool setState(State state); |
joe4465 | 0:c6a85bb2a827 | 51 | State getState(); |
joe4465 | 0:c6a85bb2a827 | 52 | bool setFlightMode(FlightMode flightMode); |
joe4465 | 0:c6a85bb2a827 | 53 | FlightMode getFlightMode(); |
joe4465 | 0:c6a85bb2a827 | 54 | bool setBaseStationMode(BaseStationMode baseStationMode); |
joe4465 | 0:c6a85bb2a827 | 55 | BaseStationMode getBaseStationMode(); |
joe4465 | 0:c6a85bb2a827 | 56 | bool setBatteryLevel(float batteryLevel); |
joe4465 | 0:c6a85bb2a827 | 57 | float getBatteryLevel(); |
joe4465 | 0:c6a85bb2a827 | 58 | bool setArmed(bool armed); |
joe4465 | 0:c6a85bb2a827 | 59 | bool getArmed(); |
joe4465 | 0:c6a85bb2a827 | 60 | bool setInitialised(bool initialised); |
joe4465 | 0:c6a85bb2a827 | 61 | bool getInitialised(); |
joe4465 | 0:c6a85bb2a827 | 62 | bool setRcConnected(bool rcConnected); |
joe4465 | 0:c6a85bb2a827 | 63 | bool getRcConnected(); |
joe4465 | 0:c6a85bb2a827 | 64 | |
joe4465 | 0:c6a85bb2a827 | 65 | private: |
joe4465 | 0:c6a85bb2a827 | 66 | State _state; |
joe4465 | 0:c6a85bb2a827 | 67 | FlightMode _flightMode; |
joe4465 | 0:c6a85bb2a827 | 68 | BaseStationMode _baseStationMode; |
joe4465 | 0:c6a85bb2a827 | 69 | float _batteryLevel; |
joe4465 | 0:c6a85bb2a827 | 70 | bool _armed; |
joe4465 | 0:c6a85bb2a827 | 71 | bool _initialised; |
joe4465 | 0:c6a85bb2a827 | 72 | bool _rcConnected; |
joe4465 | 0:c6a85bb2a827 | 73 | }; |
joe4465 | 0:c6a85bb2a827 | 74 | |
joe4465 | 0:c6a85bb2a827 | 75 | #endif |