Matthias Grob
/
FlyBed2
My fully self designed first stable working Quadrocopter Software.
PID/PID.h
- Committer:
- maetugr
- Date:
- 2014-07-12
- Revision:
- 7:ac2895479e34
- Parent:
- 2:03e5f7ab473f
File content as of revision 7:ac2895479e34:
// by MaEtUgR #ifndef PID_H #define PID_H #include "mbed.h" class PID { public: PID(float P, float I, float D, float Integral_Max); float compute(float SetPoint, float ProcessValue); void setIntegrate(bool Integrate); void setPID(float P, float I, float D); float Value; private: float P, I, D; // PID Values and limits Timer dtTimer; // Timer to measure time between every compute float LastTime; // Time when last loop was 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) bool Integrate; // if the integral is used / the controller is in use float PreviousError; // the Error of the last computation to get derivative }; #endif