Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_TECS: Constrained throttle in airspeedless #27452

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading