NOT FINISHED YET!!! My first try to get a self built fully working Quadrocopter based on an mbed, a self built frame and some other more or less cheap parts.

Dependencies:   mbed MODI2C

Committer:
maetugr
Date:
Thu Apr 04 14:25:21 2013 +0000
Revision:
33:fd98776b6cc7
Parent:
30:021e13b62575
New version developed in eastern holidays, ported Madgwick Filter, added support for chaning PID values while flying over bluetooth, still not flying stable or even controllable

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maetugr 30:021e13b62575 1 // by MaEtUgR
maetugr 30:021e13b62575 2
maetugr 29:8b7362a2ee14 3 #include "mbed.h"
maetugr 29:8b7362a2ee14 4
maetugr 29:8b7362a2ee14 5 #ifndef PID_H
maetugr 29:8b7362a2ee14 6 #define PID_H
maetugr 29:8b7362a2ee14 7
maetugr 29:8b7362a2ee14 8 class PID {
maetugr 29:8b7362a2ee14 9 public:
maetugr 29:8b7362a2ee14 10 PID(float P, float I, float D, float Integral_Max);
maetugr 29:8b7362a2ee14 11 float compute(float SetPoint, float ProcessValue);
maetugr 29:8b7362a2ee14 12 void setIntegrate(bool Integrate);
maetugr 33:fd98776b6cc7 13 void setPID(float P, float I, float D);
maetugr 29:8b7362a2ee14 14
maetugr 29:8b7362a2ee14 15 private:
maetugr 29:8b7362a2ee14 16 float P,I,D; // PID Values
maetugr 29:8b7362a2ee14 17
maetugr 29:8b7362a2ee14 18 Timer dtTimer; // Timer to measure time between every compute
maetugr 29:8b7362a2ee14 19 float LastTime; // Time when last loop was
maetugr 29:8b7362a2ee14 20
maetugr 29:8b7362a2ee14 21 float SetPoint; // the Point you want to reach
maetugr 29:8b7362a2ee14 22 float Integral; // the sum of all errors (constaind so it doesn't get infinite)
maetugr 29:8b7362a2ee14 23 float Integral_Max; // maximum that the sum of all errors can get (not important: last error not counted)
maetugr 29:8b7362a2ee14 24 float PreviousError; // the Error of the last computation to get derivative
maetugr 29:8b7362a2ee14 25 bool Integrate; // if the integral is used / the controller is in use
maetugr 29:8b7362a2ee14 26 };
maetugr 29:8b7362a2ee14 27
maetugr 29:8b7362a2ee14 28 #endif