Skip to content

Commit

Permalink
AP_TECS: Constrain pitch to limits after rate constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
Georacer committed Aug 13, 2024
1 parent 65dc003 commit e9aa49b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/AP_TECS/AP_TECS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1054,9 +1054,6 @@ void AP_TECS::_update_pitch(void)
_pitch_dem_unc += (_TAS_dem_adj - _pitch_ff_v0) * _pitch_ff_k;
}

// Constrain pitch demand
_pitch_dem = constrain_float(_pitch_dem_unc, _PITCHminf, _PITCHmaxf);

// Rate limit the pitch demand to comply with specified vertical
// acceleration limit
float ptchRateIncr = _DT * _vertAccLim / _TAS_state;
Expand All @@ -1067,6 +1064,9 @@ void AP_TECS::_update_pitch(void)
_pitch_dem = _last_pitch_dem - ptchRateIncr;
}

// Constrain pitch demand
_pitch_dem = constrain_float(_pitch_dem_unc, _PITCHminf, _PITCHmaxf);

_last_pitch_dem = _pitch_dem;

#if HAL_LOGGING_ENABLED
Expand Down

0 comments on commit e9aa49b

Please sign in to comment.