pid
Fork of PID by
Diff: PID.h
- Revision:
- 7:66e3f3fd08d8
- Parent:
- 6:775c9421fe3b
--- a/PID.h Fri Oct 30 12:47:54 2015 +0000 +++ b/PID.h Sun Aug 07 12:47:39 2016 +0000 @@ -10,25 +10,34 @@ PID& operator=(const PID &p) { return *this; } +public: + void PIDctrl(); -public: void InputLimits(float max,float min); void OutputLimits(float max,float min); PID(float tauKc, float tauKi, float tauKd ,Timer *T); void setbias(float bias_){bias=bias_;} - double s_dErrIntg ,dErr_prev; + float s_dErrIntg ,dErr_prev; void start(); void pid_reset(); - void setInterval(double inter); + void setInterval(float inter); //Getters. void stop(); - double dTarget; - double dPoint; + float dTarget; + float dPoint; // PI制御ゲイン - double GAIN_P ;//1.5 // 比例ゲイン - double GAIN_I ;//2.8 // 積分ゲイン - double GAIN_D ;//0.2 - double data; + float GAIN_P ;//1.5 // 比例ゲイン + float GAIN_I ;//2.8 // 積分ゲイン + float GAIN_D ;//0.2 + float data; + double dErrDiff; + + float userInt; + float userDiff; + float userProp; + bool intF; + bool diffF; + bool propF; private: float bias; float OutMax; @@ -38,13 +47,13 @@ float OutSpan; float InSpan; Timer *timer; + float prev_time; float gettime() { - static float prev_time; float a = timer->read()-prev_time; prev_time=timer->read(); return a; } - //Ticker T; + Ticker T; float interval; };