New version of quadcopter software written to OO principles
Dependencies: mbed MODSERIAL filter mbed-rtos ConfigFile PID PPM FreeIMU_external_magnetometer TinyGPS
Rc/Rc.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 "Ppm.h" |
joe4465 | 0:c6a85bb2a827 | 4 | #include "filter.h" |
joe4465 | 0:c6a85bb2a827 | 5 | #include "Status.h" |
joe4465 | 0:c6a85bb2a827 | 6 | |
joe4465 | 0:c6a85bb2a827 | 7 | #ifndef Rc_H |
joe4465 | 0:c6a85bb2a827 | 8 | #define Rc_H |
joe4465 | 0:c6a85bb2a827 | 9 | |
joe4465 | 0:c6a85bb2a827 | 10 | class Rc |
joe4465 | 0:c6a85bb2a827 | 11 | { |
joe4465 | 0:c6a85bb2a827 | 12 | public: |
joe4465 | 2:969dfa4f2436 | 13 | Rc(Status& status, PinName pin); |
joe4465 | 0:c6a85bb2a827 | 14 | ~Rc(); |
joe4465 | 0:c6a85bb2a827 | 15 | |
joe4465 | 0:c6a85bb2a827 | 16 | struct MappedRc |
joe4465 | 0:c6a85bb2a827 | 17 | { |
joe4465 | 2:969dfa4f2436 | 18 | double yaw; |
joe4465 | 2:969dfa4f2436 | 19 | double pitch; |
joe4465 | 2:969dfa4f2436 | 20 | double roll; |
joe4465 | 2:969dfa4f2436 | 21 | double throttle; |
joe4465 | 0:c6a85bb2a827 | 22 | }; |
joe4465 | 0:c6a85bb2a827 | 23 | |
joe4465 | 0:c6a85bb2a827 | 24 | struct RawRc |
joe4465 | 0:c6a85bb2a827 | 25 | { |
joe4465 | 2:969dfa4f2436 | 26 | double channel0; |
joe4465 | 2:969dfa4f2436 | 27 | double channel1; |
joe4465 | 2:969dfa4f2436 | 28 | double channel2; |
joe4465 | 2:969dfa4f2436 | 29 | double channel3; |
joe4465 | 2:969dfa4f2436 | 30 | double channel4; |
joe4465 | 2:969dfa4f2436 | 31 | double channel5; |
joe4465 | 2:969dfa4f2436 | 32 | double channel6; |
joe4465 | 2:969dfa4f2436 | 33 | double channel7; |
joe4465 | 0:c6a85bb2a827 | 34 | }; |
joe4465 | 0:c6a85bb2a827 | 35 | |
joe4465 | 0:c6a85bb2a827 | 36 | MappedRc getMappedRc(); |
joe4465 | 0:c6a85bb2a827 | 37 | RawRc getRawRc(); |
joe4465 | 0:c6a85bb2a827 | 38 | |
joe4465 | 0:c6a85bb2a827 | 39 | private: |
joe4465 | 2:969dfa4f2436 | 40 | double Map(double input, double inputMin, double inputMax, double outputMin, double outputMax); |
joe4465 | 0:c6a85bb2a827 | 41 | |
joe4465 | 0:c6a85bb2a827 | 42 | Ppm* _ppm; |
joe4465 | 2:969dfa4f2436 | 43 | Status& _status; |
joe4465 | 2:969dfa4f2436 | 44 | filter* _yawMedianFilter; |
joe4465 | 2:969dfa4f2436 | 45 | filter* _pitchMedianFilter; |
joe4465 | 2:969dfa4f2436 | 46 | filter* _rollMedianFilter; |
joe4465 | 2:969dfa4f2436 | 47 | filter* _thrustMedianFilter; |
joe4465 | 2:969dfa4f2436 | 48 | filter* _armMedianFilter; |
joe4465 | 2:969dfa4f2436 | 49 | filter* _modeMedianFilter; |
joe4465 | 2:969dfa4f2436 | 50 | int _notConnectedIterator; |
joe4465 | 2:969dfa4f2436 | 51 | int _connectedIterator; |
joe4465 | 0:c6a85bb2a827 | 52 | }; |
joe4465 | 0:c6a85bb2a827 | 53 | |
joe4465 | 0:c6a85bb2a827 | 54 | #endif |