fw pos ctrl: fix glide slope calculation, from geometry, not param

This commit is contained in:
Thomas Stastny 2022-07-14 00:55:37 +02:00 committed by Daniel Agar
parent d73b2e8625
commit 6612d4696d
1 changed files with 2 additions and 1 deletions

View File

@ -1788,7 +1788,8 @@ FixedwingPositionControl::control_auto_landing(const hrt_abstime &now, const flo
/* longitudinal guidance */
// open the desired max sink rate to encompass the glide slope if within the aircraft's performance limits
const float glide_slope_sink_rate = airspeed_land * sinf(math::radians(_param_fw_lnd_ang.get()));
// x/sqrt(x^2+1) = sin(arctan(x))
const float glide_slope_sink_rate = airspeed_land * glide_slope / sqrtf(glide_slope * glide_slope + 1.0f);
const float desired_max_sinkrate = math::min(math::max(glide_slope_sink_rate, _param_sinkrate_target.get()),
_param_fw_t_sink_max.get());