Skip to content

Commit

Permalink
AP_TECS : Add protection for airspeed runaway due to pitch errors
Browse files Browse the repository at this point in the history
  • Loading branch information
priseborough committed Mar 9, 2014
1 parent 6ace31b commit 88b0364
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libraries/AP_TECS/AP_TECS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,17 @@ void AP_TECS::_update_energies(void)
// Calculate specific energy rate
_SPEdot = _integ2_state * GRAVITY_MSS;
_SKEdot = _integ5_state * _vel_dot;

}

void AP_TECS::_update_throttle(void)
{
// Calculate total energy values
_STE_error = _SPE_dem - _SPE_est + _SKE_dem - _SKE_est;
// Calculate limits to be applied to potential energy error to prevent over or underspeed occurring due to large height errors
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_error = STEdot_dem - _SPEdot - _SKEdot;

Expand Down

0 comments on commit 88b0364

Please sign in to comment.