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 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?

UserRevisionLine numberNew 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 #include "rtos.h"
joe4465 0:c6a85bb2a827 7
joe4465 0:c6a85bb2a827 8 #ifndef Rc_H
joe4465 0:c6a85bb2a827 9 #define Rc_H
joe4465 0:c6a85bb2a827 10
joe4465 0:c6a85bb2a827 11 class Rc
joe4465 0:c6a85bb2a827 12 {
joe4465 0:c6a85bb2a827 13 public:
joe4465 0:c6a85bb2a827 14 Rc();
joe4465 0:c6a85bb2a827 15 ~Rc();
joe4465 0:c6a85bb2a827 16
joe4465 0:c6a85bb2a827 17 struct MappedRc
joe4465 0:c6a85bb2a827 18 {
joe4465 0:c6a85bb2a827 19 float roll;
joe4465 0:c6a85bb2a827 20 float pitch;
joe4465 0:c6a85bb2a827 21 float throttle;
joe4465 0:c6a85bb2a827 22 float yaw;
joe4465 0:c6a85bb2a827 23 };
joe4465 0:c6a85bb2a827 24
joe4465 0:c6a85bb2a827 25 struct RawRc
joe4465 0:c6a85bb2a827 26 {
joe4465 0:c6a85bb2a827 27 int channel0;
joe4465 0:c6a85bb2a827 28 int channel1;
joe4465 0:c6a85bb2a827 29 int channel2;
joe4465 0:c6a85bb2a827 30 int channel3;
joe4465 0:c6a85bb2a827 31 int channel4;
joe4465 0:c6a85bb2a827 32 int channel5;
joe4465 0:c6a85bb2a827 33 int channel6;
joe4465 0:c6a85bb2a827 34 int channel7;
joe4465 0:c6a85bb2a827 35 };
joe4465 0:c6a85bb2a827 36
joe4465 0:c6a85bb2a827 37 bool initialise(Status& status, PinName pin);
joe4465 0:c6a85bb2a827 38 MappedRc getMappedRc();
joe4465 0:c6a85bb2a827 39 RawRc getRawRc();
joe4465 0:c6a85bb2a827 40
joe4465 0:c6a85bb2a827 41 private:
joe4465 0:c6a85bb2a827 42 static void threadStarter(void const *p);
joe4465 0:c6a85bb2a827 43 void threadWorker();
joe4465 0:c6a85bb2a827 44 float Map(float input, float inputMin, float inputMax, float outputMin, float outputMax);
joe4465 0:c6a85bb2a827 45
joe4465 0:c6a85bb2a827 46 Ppm* _ppm;
joe4465 0:c6a85bb2a827 47 Thread* _thread;
joe4465 0:c6a85bb2a827 48 Status _status;
joe4465 0:c6a85bb2a827 49 MappedRc _mappedRc;
joe4465 0:c6a85bb2a827 50 RawRc _rawRc;
joe4465 0:c6a85bb2a827 51 medianFilter* _yawMedianFilter;
joe4465 0:c6a85bb2a827 52 medianFilter* _pitchMedianFilter;
joe4465 0:c6a85bb2a827 53 medianFilter* _rollMedianFilter;
joe4465 0:c6a85bb2a827 54 medianFilter* _thrustMedianFilter;
joe4465 0:c6a85bb2a827 55 };
joe4465 0:c6a85bb2a827 56
joe4465 0:c6a85bb2a827 57 #endif