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.
Diff: PID/PID.h
- Revision:
- 29:8b7362a2ee14
- Child:
- 30:021e13b62575
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PID/PID.h Sat Dec 15 08:42:36 2012 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" + +#ifndef PID_H +#define PID_H + +class PID { + public: + PID(float P, float I, float D, float Integral_Max); + float compute(float SetPoint, float ProcessValue); + void setIntegrate(bool Integrate); + + private: + float P,I,D; // PID Values + + Timer dtTimer; // Timer to measure time between every compute + float LastTime; // Time when last loop was + + float SetPoint; // the Point you want to reach + float Integral; // the sum of all errors (constaind so it doesn't get infinite) + float Integral_Max; // maximum that the sum of all errors can get (not important: last error not counted) + float PreviousError; // the Error of the last computation to get derivative + bool Integrate; // if the integral is used / the controller is in use +}; + +#endif \ No newline at end of file