During flight, the barometer altitude can drift due to: - Temperature changes inside the vehicle (battery heat, video transmitter heat, etc.) - Atmospheric pressure changes during flight - Temperature differences between takeoff location and flying site
Result: The barometer can report altitude errors of ±5 to ±20 meters (or more) on long flights, even though most barometers are temperature compensated.
When the rangefinder is in range (typically ≤6-12m for cheap sensors), the autopilot calculates:
correction = baro_altitude - rangefinder_altitude
landing_height = baro_altitude - correction
= baro_altitude - (baro_altitude - rangefinder_altitude)
= rangefinder_altitude ✓
Once rangefinder is in range, it directly overrides the barometer for landing altitude!
From ArduPlane/altitude.cpp:
float Plane::get_landing_height(bool &rangefinder_active)
{
// get basic height above target
height = height_above_target(); // Barometer-based
// possibly correct with rangefinder
height -= rangefinder_correction(); // Subtract correction
rangefinder_active = rangefinder_state.in_range;
return height; // = rangefinder altitude when in range!
}TECS_LAND_THR throttleLAND_FLARE_SEC seconds
before ground impactLAND_FLARE_ALT meters
above groundTHR_MIN and zeroTECS_FLARE_HGT: Transition sink rate to
TECS_LAND_SINKLEVEL_ROLL_LIMIT (default 5°)TECS_LAND_SINK descent rate (default 0.25
m/s)LAND_PITCH_DEGGROUND_STEER_ALT: Rudder maintains headingLAND_DISARMDELAY seconds (default 20s):
Auto-disarmSituation: - Actual altitude at ground level: 0m - Barometer reports: -20m (thinks it’s 20m underground)
What Happens:
| Actual Alt | Baro Reading | Rangefinder | What Happens |
|---|---|---|---|
| 30m | 10m | No signal (too high) | LAND_FLARE_ALT=10m triggers flare! ❌ |
| 20m | 0m | No signal | Gliding in flare mode |
| 10m | -10m | No signal | Still gliding |
| 6m | -14m | 6m detected | Rangefinder correction active! ✓ |
| 0m | -20m | 0m | Lands safely |
Result: - ❌ Flare starts 20m too high (at 30m instead of 10m) - ✅ Rangefinder prevents crash after 6m detection - ⚠️ Landing is LONG (overshoots touchdown point by ~100-200m) - ✅ Safe if runway is long enough - ❌ Cannot fix on first approach (baro error > rangefinder range)
Solution: Use the “dry run calibration” LUA script: 1. Descend until rangefinder triggers 2. Pull up immediately 3. Recalibrate baro to known rangefinder altitude 4. Execute actual landing with corrected baro
Situation: - Actual altitude at ground level: 0m - Barometer reports: +20m (thinks it’s 20m high)
What Happens:
| Actual Alt | Baro Reading | Rangefinder | What Happens |
|---|---|---|---|
| 30m | 50m | No signal | Normal descent at TECS_LAND_THR |
| 20m | 40m | No signal | Still descending (no flare yet) |
| 15m | 35m | No signal | Still descending with power! ⚠️ |
| 10m | 30m | No signal | Getting dangerous… |
| 6m | 26m | 6m detected | RANGEFINDER SAVES THE DAY! ✓ |
| 6m | 26m | 6m | Correction: 20m applied → height = 6m |
| 6m | 26m | 6m | FLARE TRIGGERS (even though baro > 10m) |
| 0m | 20m | 0m | Lands safely ✓ |
Result: - ⚠️ Plane continues powered descent past intended flare altitude - ✅ Rangefinder detects ground at 6m actual altitude - ✅ Flare triggers immediately based on rangefinder - ✅ Prevents powered crash into ground! - ✅ Landing point is approximately correct (maybe slightly short)
Safety Mechanism from Code:
// AP_Landing_Slope.cpp line 103
if ((on_approach_stage && below_flare_alt) ||
(on_approach_stage && below_flare_sec) ||
(!rangefinder_state_in_range && wp_proportion >= 1) || // Safety catch!
probably_crashed)Even if rangefinder fails, flare triggers when plane passes the landing point.
With a 6m range rangefinder: - ❌ Cannot prevent early flare (when you’re too high to detect ground) - ✅ CAN prevent late/no flare (detects ground and forces correction)
RNGFND_LANDING = 1 or 3 # Enable rangefinder for landing
LAND_FLARE_ALT = 10 # Flare altitude (meters) - conservative value
LAND_FLARE_SEC = 2.0 # Flare time (seconds)
TECS_LAND_SINK = 0.25 # Final descent rate (m/s)
LAND_SLOPE_RCALC = 2.0 # Allow slope recalc for rangefinder bumps
The documentation recommends shallow glide slopes and conservative flare altitudes because: - Minimizes overshoot distance in Scenario 1 (early flare) - Gives more time for rangefinder to engage and correct - Reduces approach speed and energy at touchdown - Makes landing more survivable if things go wrong
Your cheap 6m rangefinder is highly effective at preventing the dangerous Scenario 2 (powered descent into ground). For Scenario 1, you need either: - A long runway to handle overshoot, OR - A pre-landing baro calibration routine (custom LUA script)
The rangefinder’s limited range makes it asymmetric in protection: excellent crash prevention, limited overshoot prevention.