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.
PID/PID.h
- Committer:
- maetugr
- Date:
- 2012-12-15
- Revision:
- 29:8b7362a2ee14
- Child:
- 30:021e13b62575
File content as of revision 29:8b7362a2ee14:
#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