AP_TECS : Add protection for airspeed runaway due to pitch errors

This commit is contained in:
Paul Riseborough 2014-03-09 08:50:39 +11:00 committed by priseborough
parent 6ace31b6c1
commit 88b0364fcd

View File

@ -340,12 +340,17 @@ void AP_TECS::_update_energies(void)
// Calculate specific energy rate // Calculate specific energy rate
_SPEdot = _integ2_state * GRAVITY_MSS; _SPEdot = _integ2_state * GRAVITY_MSS;
_SKEdot = _integ5_state * _vel_dot; _SKEdot = _integ5_state * _vel_dot;
} }
void AP_TECS::_update_throttle(void) void AP_TECS::_update_throttle(void)
{ {
// Calculate total energy values // Calculate limits to be applied to potential energy error to prevent over or underspeed occurring due to large height errors
_STE_error = _SPE_dem - _SPE_est + _SKE_dem - _SKE_est; float SPE_err_max = 0.5f * _TASmax * _TASmax - _SKE_dem;
float SPE_err_min = 0.5f * _TASmin * _TASmin - _SKE_dem;
// Calculate total energy error
_STE_error = constrain_float((_SPE_dem - _SPE_est), SPE_err_min, SPE_err_max) + _SKE_dem - _SKE_est;
float STEdot_dem = constrain_float((_SPEdot_dem + _SKEdot_dem), _STEdot_min, _STEdot_max); float STEdot_dem = constrain_float((_SPEdot_dem + _SKEdot_dem), _STEdot_min, _STEdot_max);
float STEdot_error = STEdot_dem - _SPEdot - _SKEdot; float STEdot_error = STEdot_dem - _SPEdot - _SKEdot;