Repository navigation
Fix/AS-1603: Land detector overrides a stuck rangefinder after 15 s - #270
Merged
NicolasMichelMatternet merged 3 commits intoOct 9, 2026
Conversation
A downward rangefinder can report a healthy but false distance while the vehicle is on the ground (NCT-3495: radar reported 6.55 m / Good for 400+ s after touchdown; same pattern in NCT-3311, NCT-2885, NCT-2781), which blocks land detection and therefore disarm indefinitely. Add a secondary path to the land detector: if the throttle, acceleration and descent-rate criteria have all held continuously for LAND_DETECTOR_RNGFND_TIMEOUT_SEC (30 s) while only the rangefinder check fails, send a warning and declare the landing anyway. The primary path and all downstream disarm behaviour are unchanged. Verified in SITL with a MAVLink rangefinder stuck at 650 cm after touchdown: unpatched build never disarms; patched build disarms 30 s after the inertial criteria are met; a normal landing still completes at the 0.5 s trigger. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
NicolasMichelMatternet
marked this pull request as ready for review
October 6, 2026 22:11
adriennet823
approved these changes
Oct 7, 2026
adriennet823
left a comment
Contributor
There was a problem hiding this comment.
Logic looks good to me; code still reflects 30s value. Confirmed offline we will go with 15s, but please let me know if you get feedback from others on this and if anything changes.
Contributor
Author
Confirmed; I've pushed the change. |
1b3365b changed LAND_CHECK_ANGLE_ERROR_DEG (a throttle-mix / crash-check angle threshold) instead of the timeout. Restore it to 30 deg and set LAND_DETECTOR_RNGFND_TIMEOUT_SEC to 15 s in config.h as intended. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
adriennet823
approved these changes
Oct 8, 2026
NicolasMichelMatternet
deleted the
feat-AS-1603-land-detector-rangefinder-timeout
branch
October 9, 2026 17:39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A downward rangefinder can report a healthy-but-false distance while the vehicle is on the ground. In NCT-3495 the radar (RNGFND1) reported a steady 6.55 m with status Good for 400+ s after touchdown while the lidar read 0.19 m (below its 20 cm minimum, so OutOfRangeLow and excluded from the vote). The land detector refuses to declare a landing while the only healthy downward rangefinder reads ≥ 2 m, so
land_completenever set and every disarm path — automatic and commanded — stayed blocked for 522 s. The same signature appears in NCT-3311 (976 s), NCT-2885 (128 s) and NCT-2781 (471 s).This adds a secondary path to the land detector: if the throttle, acceleration and descent-rate criteria have all held continuously for
LAND_DETECTOR_RNGFND_TIMEOUT_SEC(15 s, reduced from the initial 30 s proposal) while only the rangefinder check fails, a warning is sent and the landing is declared anyway. The primary path (0.5 s trigger,APM_Config.h) and all downstream disarm behaviour are unchanged — the override only setsland_complete; disarm then follows the mode's normal path (ModeLand,ModeAuto::verify_land()).Change
ArduCopter/config.h— newLAND_DETECTOR_RNGFND_TIMEOUT_SEC 30.0f.ArduCopter/land_detector.cpp— the existing check is factored asinertial_landed = motor_at_lower_limit && accel_stationary && descent_rate_low; the primary path (inertial_landed && rangefinder_check) is untouched. A second counter accumulates whileinertial_landedholds regardless of the rangefinder and, on reaching the timeout, sendsLand detect: rangefinder overridden(WARNING) and callsset_land_complete(true). Both counters reset inset_land_complete()and in standby.Design notes:
Verification (SITL)
MAVLink rangefinder (
RNGFND1_TYPE=10; these runs were made with the original 30 s value — the override timing scales directly with the define) fed by a script that reports true altitude in flight, then a stuck 650 cm Good reading on final approach (the NCT-3495 scenario). Times are from throttle reaching minimum on the ground:mttr-rebase-4.0), stuck rangefinderLand detect: rangefinder overriddenThis is the before/after figure for these three runs. Applied to the historical logs, the inertial criteria held continuously from touchdown in all four events, so the override would have fired at +15 s in each (vs 128–976 s armed on the ground).
Tickets: https://matternet.atlassian.net/browse/AS-1603 · https://matternet.atlassian.net/browse/NCT-3495 (also NCT-3311, NCT-2885, NCT-2781)
🤖 Generated with Claude Code