Skip to content

Commit

Permalink
AP_TECS: Constrained throttle in airspeedless
Browse files Browse the repository at this point in the history
  • Loading branch information
Georacer committed Jul 4, 2024
1 parent a346323 commit 2d61cea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion libraries/AP_TECS/AP_TECS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,12 @@ void AP_TECS::_update_throttle_with_airspeed(void)
#endif
}

// Constrain throttle demand and record clipping
constrain_throttle();

}

// Constrain throttle demand and record clipping
void AP_TECS::constrain_throttle() {
if (_throttle_dem > _THRmaxf) {
_thr_clip_status = clipStatus::MAX;
_throttle_dem = _THRmaxf;
Expand Down Expand Up @@ -914,6 +919,8 @@ void AP_TECS::_update_throttle_without_airspeed(int16_t throttle_nudge, float pi
float cosPhi = sqrtf((rotMat.a.y*rotMat.a.y) + (rotMat.b.y*rotMat.b.y));
float STEdot_dem = _rollComp * (1.0f/constrain_float(cosPhi * cosPhi, 0.1f, 1.0f) - 1.0f);
_throttle_dem = _throttle_dem + STEdot_dem / (_STEdot_max - _STEdot_min) * (_THRmaxf - _THRminf);

constrain_throttle();
}

void AP_TECS::_detect_bad_descent(void)
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_TECS/AP_TECS.h
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,9 @@ class AP_TECS {
// Update Demanded Throttle Non-Airspeed
void _update_throttle_without_airspeed(int16_t throttle_nudge, float pitch_trim_deg);

// Constrain throttle demand and record clipping
void constrain_throttle();

// get integral gain which is flight_stage dependent
float _get_i_gain(void);

Expand Down

0 comments on commit 2d61cea

Please sign in to comment.