Control Library by altb
Dependents: My_Libraries IndNav_QK3_T265
Diff: PID_Cntrl.cpp
- Revision:
- 3:27595dd9e433
- Parent:
- 2:e7c9e50a2e46
- Child:
- 5:d8c53cece01b
--- a/PID_Cntrl.cpp Fri Jun 14 07:05:55 2019 +0000 +++ b/PID_Cntrl.cpp Fri Jul 05 06:56:49 2019 +0000 @@ -33,6 +33,7 @@ this->p = 1.0 - Ts/tau_f; this->P = P; this->I = I; + this->tau_f = tau_f; this->D_ = D/tau_f; // modified D, now D is consistent with Matlab PID this->Ts = Ts; if(P!=0) @@ -41,6 +42,18 @@ this->Ka=1.0f; } +void PID_Cntrl::setCoeff_P(float P) +{ + this->P = P; +} +void PID_Cntrl::setCoeff_I(float I) +{ + this->I = I; +} +void PID_Cntrl::setCoeff_D(float D) +{ + this->D_ = D/this->tau_f; +} float PID_Cntrl::doStep(float e) {