Files
PX4-Autopilot/docs/en/peripherals
Andrea Bernasconi 08f5938916 fix(failure_detector): check altitude loss without a height setpoint (#29000)
* fix(failure_detector): check altitude loss without a height setpoint

The altitude loss check only ran when an altitude setpoint was present.
While the pilot moves the throttle stick in Altitude/Position mode the
setpoint is NaN, so a failure during a manual climb or manual descent
was never detected.

When there is no height setpoint but a vertical velocity setpoint is
available, keep a reference that remembers the highest altitude reached
and only moves down at the commanded descent rate. Climb or hold
commands therefore protect the best height, and a commanded descent is
compared against the expected one with FD_ALT_LOSS as margin.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* fix(failure_detector): ignore stale descent setpoint in altitude loss check

Without a height setpoint the reference is lowered by the commanded
descent rate. If position control stopped publishing while a descent
was commanded, the last vz was integrated indefinitely, lowering the
reference and masking the altitude loss the detector should catch.

Only integrate the commanded descent while the setpoint is fresh
(within 500 ms of the position estimate); otherwise the reference is
held at the best altitude reached.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* docs(safety): describe altitude loss reference for manual commands

The altitude loss trigger is no longer measured only against an
altitude setpoint. Explain that manual climbs and descents are covered
and how a commanded descent lowers the reference.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* fix(commander): Add a margin to avoid small error accumulation

* fix(failure_detector): keep the altitude loss reference when the setpoint follows the vehicle

In auto modes emergency braking keeps the altitude setpoint on the vehicle
while it falls. The setpoint dragged the reference down with it, and every
time it ended up just below the vehicle the reference was reset, so a free
fall during a mission was not detected.

The reference now only moves down at the commanded descent rate, and it is
kept while the vehicle falls faster than allowed even if it is above the
setpoint.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* style(failure_detector): shorten altitude loss reference comment

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* style(failure_detector): name altitude loss constants as constants

Also document the 2 m/s descent rate margin.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

* fix(failure_detector): apply the descent rate margin once

The commanded descent rate already includes the margin, adding it again
meant a fall up to 2 m/s faster than the reference moves down, with the
setpoint kept on the vehicle, reset the reference instead of being
detected.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>

---------

Signed-off-by: Andrea Bernasconi <andrea.bernasconi@auterion.com>
2026-11-04 17:59:05 +01:00
..
…
2026-03-05 10:43:41 +11:00
…