From 08ceddaddbcedb7c0a9478b0b8e0629843d0ddb7 Mon Sep 17 00:00:00 2001 From: Philipp Oettershagen Date: Sat, 16 Jun 2018 12:32:38 +0200 Subject: [PATCH] Fixed-wing autoland: ALWAYS flare when close to the ground, independently of the horizontal distance to the land WP. This avoids that we crash into the ground at negative pitch and guarantees that the flare always starts at the same altitude above ground. However, the motor shutoff still depends on the horizontal distance to the LAND WP, thus avoiding that the motor is shut off prematurely --- src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp b/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp index f0d446085e..2eac47741f 100644 --- a/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp +++ b/src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp @@ -1461,8 +1461,7 @@ FixedwingPositionControl::control_landing(const Vector2f &curr_pos, const Vector * horizontal limit (with some tolerance) * The horizontal limit is only applied when we are in front of the wp */ - if (((_global_pos.alt < terrain_alt + _landingslope.flare_relative_alt()) && - (wp_distance_save < _landingslope.flare_length() + 5.0f)) || + if ((_global_pos.alt < terrain_alt + _landingslope.flare_relative_alt()) || _land_noreturn_vertical) { //checking for land_noreturn to avoid unwanted climb out /* land with minimal speed */ @@ -1479,7 +1478,9 @@ FixedwingPositionControl::control_landing(const Vector2f &curr_pos, const Vector _att_sp.fw_control_yaw = true; } - if (_global_pos.alt < terrain_alt + _landingslope.motor_lim_relative_alt() || _land_motor_lim) { + if (((_global_pos.alt < terrain_alt + _landingslope.motor_lim_relative_alt()) && + (wp_distance_save < _landingslope.flare_length() + 5.0f)) || // Only kill throttle when close to WP + _land_motor_lim) { throttle_max = min(throttle_max, _parameters.throttle_land_max); if (!_land_motor_lim) {