New version of quadcopter software written to OO principles
Dependencies: mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS
FlightController/FlightController.h@4:9ffbf9101992, 2015-05-08 (annotated)
- Committer:
- joe4465
- Date:
- Fri May 08 09:07:38 2015 +0000
- Revision:
- 4:9ffbf9101992
- Parent:
- 2:969dfa4f2436
End of FYP
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 | #include "Global.h" |
joe4465 | 0:c6a85bb2a827 | 3 | #include "rtos.h" |
joe4465 | 0:c6a85bb2a827 | 4 | #include "Status.h" |
joe4465 | 0:c6a85bb2a827 | 5 | #include "MotorMixer.h" |
joe4465 | 0:c6a85bb2a827 | 6 | #include "PidWrapper.h" |
joe4465 | 0:c6a85bb2a827 | 7 | #include "RateController.h" |
joe4465 | 0:c6a85bb2a827 | 8 | #include "StabController.h" |
joe4465 | 2:969dfa4f2436 | 9 | #include "ConfigFileWrapper.h" |
joe4465 | 0:c6a85bb2a827 | 10 | |
joe4465 | 0:c6a85bb2a827 | 11 | #ifndef FlightController_H |
joe4465 | 0:c6a85bb2a827 | 12 | #define FlightController_H |
joe4465 | 0:c6a85bb2a827 | 13 | |
joe4465 | 0:c6a85bb2a827 | 14 | class FlightController |
joe4465 | 0:c6a85bb2a827 | 15 | { |
joe4465 | 0:c6a85bb2a827 | 16 | public: |
joe4465 | 2:969dfa4f2436 | 17 | FlightController(Status& status, Sensors& sensors, NavigationController& navigationController, ConfigFileWrapper& configFileWrapper, PinName motor1, PinName motor2, PinName motor3, PinName motor4); |
joe4465 | 0:c6a85bb2a827 | 18 | ~FlightController(); |
joe4465 | 0:c6a85bb2a827 | 19 | |
joe4465 | 0:c6a85bb2a827 | 20 | MotorMixer::MotorPower getMotorPower(); |
joe4465 | 2:969dfa4f2436 | 21 | PidWrapper::PidOutput getPidOutputs(); |
joe4465 | 2:969dfa4f2436 | 22 | PidWrapper::FlightControllerPidParameters getPidParameters(); |
joe4465 | 2:969dfa4f2436 | 23 | void setYawStabPidParameters(PidWrapper::PidParameter pidParameters); |
joe4465 | 2:969dfa4f2436 | 24 | void setPitchStabPidParameters(PidWrapper::PidParameter pidParameters); |
joe4465 | 2:969dfa4f2436 | 25 | void setRollStabPidParameters(PidWrapper::PidParameter pidParameters); |
joe4465 | 2:969dfa4f2436 | 26 | void setYawRatePidParameters(PidWrapper::PidParameter pidParameters); |
joe4465 | 2:969dfa4f2436 | 27 | void setPitchRatePidParameters(PidWrapper::PidParameter pidParameters); |
joe4465 | 2:969dfa4f2436 | 28 | void setRollRatePidParameters(PidWrapper::PidParameter pidParameters); |
joe4465 | 2:969dfa4f2436 | 29 | PidWrapper::RatePidState getRatePidState(); |
joe4465 | 2:969dfa4f2436 | 30 | PidWrapper::StabPidState getStabPidState(); |
joe4465 | 0:c6a85bb2a827 | 31 | |
joe4465 | 0:c6a85bb2a827 | 32 | private: |
joe4465 | 0:c6a85bb2a827 | 33 | static void threadStarter(void const *p); |
joe4465 | 0:c6a85bb2a827 | 34 | void threadWorker(); |
joe4465 | 0:c6a85bb2a827 | 35 | RtosTimer* _rtosTimer; |
joe4465 | 2:969dfa4f2436 | 36 | RateController* _rateController; |
joe4465 | 2:969dfa4f2436 | 37 | StabController* _stabController; |
joe4465 | 2:969dfa4f2436 | 38 | void saveSettings(); |
joe4465 | 2:969dfa4f2436 | 39 | Status& _status; |
joe4465 | 2:969dfa4f2436 | 40 | Sensors& _sensors; |
joe4465 | 2:969dfa4f2436 | 41 | NavigationController& _navigationController; |
joe4465 | 2:969dfa4f2436 | 42 | ConfigFileWrapper& _configFileWrapper; |
joe4465 | 2:969dfa4f2436 | 43 | MotorMixer* _motorMixer; |
joe4465 | 2:969dfa4f2436 | 44 | |
joe4465 | 2:969dfa4f2436 | 45 | PidWrapper::PidOutput _pidOutputs; |
joe4465 | 0:c6a85bb2a827 | 46 | }; |
joe4465 | 0:c6a85bb2a827 | 47 | |
joe4465 | 0:c6a85bb2a827 | 48 | #endif |