New version of quadcopter software written to OO principles
Dependencies: mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS
FlightController/MotorMixer/MotorMixer.h@2:969dfa4f2436, 2015-04-01 (annotated)
- Committer:
- joe4465
- Date:
- Wed Apr 01 11:19:21 2015 +0000
- Revision:
- 2:969dfa4f2436
- Parent:
- 0:c6a85bb2a827
Altitude hold with 2 PID's working. Exported to offline compiler
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 "PidWrapper.h" |
joe4465 | 2:969dfa4f2436 | 4 | #include "NavigationController.h" |
joe4465 | 0:c6a85bb2a827 | 5 | |
joe4465 | 0:c6a85bb2a827 | 6 | #ifndef MotorMixer_H |
joe4465 | 0:c6a85bb2a827 | 7 | #define MotorMixer_H |
joe4465 | 0:c6a85bb2a827 | 8 | |
joe4465 | 0:c6a85bb2a827 | 9 | class MotorMixer |
joe4465 | 0:c6a85bb2a827 | 10 | { |
joe4465 | 0:c6a85bb2a827 | 11 | public: |
joe4465 | 2:969dfa4f2436 | 12 | MotorMixer(PinName motor1, PinName motor2, PinName motor3, PinName motor4); |
joe4465 | 0:c6a85bb2a827 | 13 | ~MotorMixer(); |
joe4465 | 0:c6a85bb2a827 | 14 | |
joe4465 | 0:c6a85bb2a827 | 15 | struct MotorPower |
joe4465 | 0:c6a85bb2a827 | 16 | { |
joe4465 | 2:969dfa4f2436 | 17 | double motor1; |
joe4465 | 2:969dfa4f2436 | 18 | double motor2; |
joe4465 | 2:969dfa4f2436 | 19 | double motor3; |
joe4465 | 2:969dfa4f2436 | 20 | double motor4; |
joe4465 | 0:c6a85bb2a827 | 21 | }; |
joe4465 | 0:c6a85bb2a827 | 22 | |
joe4465 | 2:969dfa4f2436 | 23 | void computePower(PidWrapper::PidOutput pidOutput, double throttle); |
joe4465 | 2:969dfa4f2436 | 24 | void computePower(double throttle); |
joe4465 | 2:969dfa4f2436 | 25 | void setPower(double motorPower); |
joe4465 | 2:969dfa4f2436 | 26 | void setPower(double motor1Power, double motor2Power, double motor3Power, double motor4Power); |
joe4465 | 2:969dfa4f2436 | 27 | void setPower(MotorMixer::MotorPower motorPower); |
joe4465 | 0:c6a85bb2a827 | 28 | MotorPower getMotorPower(); |
joe4465 | 0:c6a85bb2a827 | 29 | |
joe4465 | 0:c6a85bb2a827 | 30 | private: |
joe4465 | 0:c6a85bb2a827 | 31 | PwmOut* _motor1; |
joe4465 | 0:c6a85bb2a827 | 32 | PwmOut* _motor2; |
joe4465 | 0:c6a85bb2a827 | 33 | PwmOut* _motor3; |
joe4465 | 0:c6a85bb2a827 | 34 | PwmOut* _motor4; |
joe4465 | 0:c6a85bb2a827 | 35 | |
joe4465 | 0:c6a85bb2a827 | 36 | MotorPower _motorPower; |
joe4465 | 0:c6a85bb2a827 | 37 | }; |
joe4465 | 0:c6a85bb2a827 | 38 | |
joe4465 | 0:c6a85bb2a827 | 39 | #endif |