Ruprecht Altenburger
/
mirror_actuator_stud
template for students for mirror actuator
Lib_Cntrl/PID_Cntrl.h@3:d672a96eeecc, 2022-03-06 (annotated)
- Committer:
- altb2
- Date:
- Sun Mar 06 08:57:28 2022 +0000
- Revision:
- 3:d672a96eeecc
- Parent:
- 2:c4c4cc1bff45
MirrorActuator Stud FS21
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
altb2 | 0:d2e117716219 | 1 | #ifndef PID_CNTRL_H_ |
altb2 | 0:d2e117716219 | 2 | #define PID_CNTRL_H_ |
altb2 | 0:d2e117716219 | 3 | |
altb2 | 0:d2e117716219 | 4 | class PID_Cntrl |
altb2 | 0:d2e117716219 | 5 | { |
altb2 | 0:d2e117716219 | 6 | public: |
altb2 | 0:d2e117716219 | 7 | |
altb2 | 0:d2e117716219 | 8 | PID_Cntrl(float P, float I, float D, float tau_f, float Ts, float uMin, float uMax); |
altb2 | 0:d2e117716219 | 9 | PID_Cntrl() {}; |
altb2 | 0:d2e117716219 | 10 | |
altb2 | 0:d2e117716219 | 11 | float operator()(float e) |
altb2 | 0:d2e117716219 | 12 | { |
altb2 | 0:d2e117716219 | 13 | return update(e); |
altb2 | 0:d2e117716219 | 14 | } |
altb2 | 0:d2e117716219 | 15 | |
altb2 | 0:d2e117716219 | 16 | virtual ~PID_Cntrl(); |
altb2 | 0:d2e117716219 | 17 | |
altb2 | 0:d2e117716219 | 18 | void reset(float initValue); |
altb2 | 0:d2e117716219 | 19 | void setCoefficients(float P, float I, float D, float tau_f, float Ts, float uMin, float uMax); |
altb2 | 0:d2e117716219 | 20 | float update(float e); |
altb2 | 1:a7fc1afe0575 | 21 | float saturate(float); |
altb2 | 1:a7fc1afe0575 | 22 | |
altb2 | 0:d2e117716219 | 23 | |
altb2 | 0:d2e117716219 | 24 | private: |
altb2 | 1:a7fc1afe0575 | 25 | float P,I,D,tau_f,Ts,uMax,uMin; |
altb2 | 2:c4c4cc1bff45 | 26 | float Ipart,Dpart,e_old; |
altb2 | 0:d2e117716219 | 27 | |
altb2 | 0:d2e117716219 | 28 | }; |
altb2 | 0:d2e117716219 | 29 | |
altb2 | 0:d2e117716219 | 30 | #endif |