AC_PID: use calc_lowpass_alpha_dt()

This commit is contained in:
Andrew Tridgell 2020-11-08 21:57:10 +11:00
parent b0f0c8d842
commit 9e73922fd9

View File

@ -325,13 +325,7 @@ float AC_PID::get_filt_D_alpha() const
// get_filt_alpha - calculate a filter alpha
float AC_PID::get_filt_alpha(float filt_hz) const
{
if (is_zero(filt_hz)) {
return 1.0f;
}
// calculate alpha
float rc = 1 / (M_2PI * filt_hz);
return _dt / (_dt + rc);
return calc_lowpass_alpha_dt(_dt, filt_hz);
}
void AC_PID::set_integrator(float target, float measurement, float i)