The baro fallback gates touchdown on height-since-takeoff assuming flat
ground. Beyond 20m from the launch point that assumption may not hold,
but disabling touchdown compensation there left mission landings and
rally-point RTLs on baro-only vehicles with none at all, a regression
from the pre-gate behaviour, while the no-position branch assumed flat
ground everywhere.
Beyond 20m fall back to any gentle descent counting as a landing, as
before the gate existed and as the comment on the constant already
described. Rangefinder, near-launch and no-position paths are
unchanged.
SITL, GNDEFF_ALT=1.0, GUIDED to 3m, land 30m from takeoff:
touchdown_expected 0.0s -> 9.6s (6.9s landing at the takeoff point,
9.8s with GNDEFF_ALT=5).
EKF3's HAGL is not zero on the ground: the EKF substitutes the
rangefinder ground clearance (RNGFNDx_GNDCLR) while the sensor is out
of range low. Gating on absolute HAGL therefore released the takeoff
window before liftoff whenever GNDCLR >= GNDEFF_ALT, and the touchdown
gate could never be met on the same vehicle.
Anchor HAGL alongside the takeoff altitude while on the ground and
gate on the climb since then, matching the relative-to-takeoff
fallback. Without a rangefinder behaviour is unchanged.
SITL, GNDEFF_ALT=0.5 GNDEFF_TMO=0, RNGFND1_TYPE=100 RNGFND1_GNDCLR=0.6:
takeoff_expected 0.0s -> 4.9s, touchdown_expected 0.0s -> 6.9s
(baro-only baseline 5.0s).
Restores the pre-PR latch: takeoff_expected is set while armed and
land_complete and only cleared by the release check, so an altitude
release is not undone by a later dip below GNDEFF_ALT and modes that
disable it (THROW) never see it in the air.
Also clamps GNDEFF_TMO before the unsigned conversion, only trusts the
takeoff XY anchor for the drift gate when it was captured with a valid
horizontal position, and renames the drift define to say it is a NE
distance.
Vehicle-agnostic detector that tells the EKF when to expect baro
disturbance from rotor downwash near the ground, driving AP_AHRS
set_takeoff_expected and set_touchdown_expected. Adds GNDEFF_ALT
(altitude threshold and master enable) and GNDEFF_TMO (takeoff hold
time).