www.pudn.com > mputil.rar > PID_controller.h
#ifndef PID_CONTROLLER_H
#define PID_CONTROLLER_H
#ifndef max
#define max(A,B) ((A)>(B) ? (A):(B))
#endif
#ifndef min
#define min(A,B) ((A)<(B) ? (A):(B))
#endif
class PID_controller {
public:
double m_curError;
PID_controller();
~PID_controller();
void setGains(double pGain, double iGain, double dGain);
void setMax(float iMax, float iMin);
void setLambda(double lambda);
double update();
private:
double m_prevError;
double m_iSum;
double m_lambda;
double m_pGain;
double m_dGain;
double m_iGain;
float m_iMax, m_iMin;
};
#endif //PID_CONTROLLER_H