ROS_FINGER
Fork of PID by
PID.h@1:4df4895863cd, 2016-04-22 (annotated)
- Committer:
- adam_z
- Date:
- Fri Apr 22 09:38:38 2016 +0000
- Revision:
- 1:4df4895863cd
- Parent:
- 0:7f9b4ca968ae
add a anti-windup function
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
weisnail | 0:7f9b4ca968ae | 1 | #ifndef PID_H |
weisnail | 0:7f9b4ca968ae | 2 | #define PID_H |
weisnail | 0:7f9b4ca968ae | 3 | |
weisnail | 0:7f9b4ca968ae | 4 | #include "mbed.h" |
weisnail | 0:7f9b4ca968ae | 5 | |
weisnail | 0:7f9b4ca968ae | 6 | class PID{ |
weisnail | 0:7f9b4ca968ae | 7 | public: |
weisnail | 0:7f9b4ca968ae | 8 | |
weisnail | 0:7f9b4ca968ae | 9 | PID(float setKp, float setKi, float setKd, float setSampletime); |
weisnail | 0:7f9b4ca968ae | 10 | void SetOutputLimits(float setoutputLimits_H, float setoutputLimits_L); |
weisnail | 0:7f9b4ca968ae | 11 | void SetInputLimits(float setinputLimits_H, float setinputLimits_L); |
adam_z | 1:4df4895863cd | 12 | void Compute(float setreference, float setfeedbackvalue); |
adam_z | 1:4df4895863cd | 13 | void PID::EnableAntiWindUp(float Ka_); |
weisnail | 0:7f9b4ca968ae | 14 | |
weisnail | 0:7f9b4ca968ae | 15 | float Kp; |
weisnail | 0:7f9b4ca968ae | 16 | float Ki; |
weisnail | 0:7f9b4ca968ae | 17 | float Kd; |
adam_z | 1:4df4895863cd | 18 | float Ka; |
weisnail | 0:7f9b4ca968ae | 19 | |
weisnail | 0:7f9b4ca968ae | 20 | float error[3]; |
weisnail | 0:7f9b4ca968ae | 21 | float output; |
weisnail | 0:7f9b4ca968ae | 22 | float reference; |
weisnail | 0:7f9b4ca968ae | 23 | |
weisnail | 0:7f9b4ca968ae | 24 | |
weisnail | 0:7f9b4ca968ae | 25 | |
weisnail | 0:7f9b4ca968ae | 26 | |
weisnail | 0:7f9b4ca968ae | 27 | float sampletime; |
weisnail | 0:7f9b4ca968ae | 28 | |
weisnail | 0:7f9b4ca968ae | 29 | |
weisnail | 0:7f9b4ca968ae | 30 | |
weisnail | 0:7f9b4ca968ae | 31 | private: |
weisnail | 0:7f9b4ca968ae | 32 | |
weisnail | 0:7f9b4ca968ae | 33 | bool Outputlimit_bool; |
weisnail | 0:7f9b4ca968ae | 34 | bool Inputlimit_bool; |
adam_z | 1:4df4895863cd | 35 | bool AntiWindUp_bool; |
weisnail | 0:7f9b4ca968ae | 36 | |
weisnail | 0:7f9b4ca968ae | 37 | float outputLimits_H; |
weisnail | 0:7f9b4ca968ae | 38 | float outputLimits_L; |
weisnail | 0:7f9b4ca968ae | 39 | float inputLimits_H; |
weisnail | 0:7f9b4ca968ae | 40 | float inputLimits_L; |
weisnail | 0:7f9b4ca968ae | 41 | |
weisnail | 0:7f9b4ca968ae | 42 | float feedbackvalue; |
weisnail | 0:7f9b4ca968ae | 43 | // Ticker PID_timer; |
weisnail | 0:7f9b4ca968ae | 44 | |
weisnail | 0:7f9b4ca968ae | 45 | }; |
weisnail | 0:7f9b4ca968ae | 46 | |
weisnail | 0:7f9b4ca968ae | 47 | #endif /* PID_H*/ |