|
|
|
@ -10,7 +10,7 @@
@@ -10,7 +10,7 @@
|
|
|
|
|
long |
|
|
|
|
APM_PI::get_pi(int32_t error, float dt, bool calc_i) |
|
|
|
|
{ |
|
|
|
|
if(true) |
|
|
|
|
if(calc_i){ |
|
|
|
|
_integrator += ((float)error * _ki) * dt; |
|
|
|
|
|
|
|
|
|
if (_integrator < -_imax) { |
|
|
|
@ -18,7 +18,7 @@ APM_PI::get_pi(int32_t error, float dt, bool calc_i)
@@ -18,7 +18,7 @@ APM_PI::get_pi(int32_t error, float dt, bool calc_i)
|
|
|
|
|
} else if (_integrator > _imax) { |
|
|
|
|
_integrator = _imax; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return (float)error * _kp + _integrator; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|