feat(commander): add failsafe for traffic avoidance system (#27887)

* feat(commander): add traffic avoidance system failsafe

* test(commander): add tests for traffic avoidance failsafe

* docs(parameters): add COM_ARM_TRAFF migration notes

* fix(failsafe): use a shared header instead of hard-coding enum literals

* fix(commander): clear stale traffic avoidance unhealthy flag when check disabled

* refactor(failsafe): rename failsafe_mode_params.h to failsafe_action_modes.h

* docs(adsb_flarm): fix formatting in traffic avoidance parameter table

---------

Co-authored-by: Claudio Chies <chiesc@chies.com>
This commit is contained in:
Anil Kircaliali
2026-07-23 13:26:11 -07:00
committed by GitHub
parent b14e63019b
commit 03bf4a5e95
16 changed files with 353 additions and 38 deletions

View File

@@ -409,7 +409,7 @@ That means DAA will not automatically switch a manually flown vehicle into Hold,
The commander health check reads [`detect_and_avoid_most_urgent`](../msg_docs/DetectAndAvoidMostUrgent.md) and applies the result only while the vehicle is disarmed.
This section covers conflict-based DAA behavior when traffic is already present.
The separate traffic-system-presence arming check is configured by [COM_ARM_TRAFF](../advanced_config/parameter_reference.md#COM_ARM_TRAFF) and described in [ADS-B/FLARM/UTM Receivers > Arming Check](../peripherals/adsb_flarm.md#arming-check).
The separate traffic-system-presence arming check and failsafe is configured by [COM_TRAFF_AVOID](../advanced_config/parameter_reference.md#COM_TRAFF_AVOID) and described in [ADS-B/FLARM/UTM Receivers > Arming Check and Failsafe](../peripherals/adsb_flarm.md#arming-check-and-failsafe).
Preflight behavior:

View File

@@ -176,21 +176,21 @@ These parameters use the same action scale:
Most users can start with the default F3442 volume parameters and tune them only if needed.
See [Detect and Avoid > F3442 Mode](../advanced_features/detect_and_avoid.md#f3442-mode), which also includes the zone-computation equations.
### Arming Check
### Arming Check and Failsafe
PX4 can be configured to check for the presence of a traffic avoidance system (for example an ADS-B or FLARM receiver) before arming.
This ensures that a traffic avoidance system is connected and functioning before flight.
PX4 can be configured to warn about, or require, a traffic avoidance system (for example an ADS-B or FLARM receiver), and to trigger a failsafe if the system stops sending MAVLink heartbeats in flight.
This check only verifies that a traffic source is present. It is separate from DAA rejecting arming because active traffic already requires an automatic action; that behavior is described in [Detect and Avoid > Arming, Preflight, and Ground Behavior](../advanced_features/detect_and_avoid.md#arming-preflight-and-ground-behavior).
The check is configured using the [COM_ARM_TRAFF](../advanced_config/parameter_reference.md#COM_ARM_TRAFF) parameter:
The behavior is configured using the [COM_TRAFF_AVOID](../advanced_config/parameter_reference.md#COM_TRAFF_AVOID) parameter:
| Value | Description |
| ----- | -------------------------------------------------------------------------------------------------------------------------- |
| 0 | Disabled (default). No check is performed. |
| 1 | Warning only. A warning is issued if no traffic avoidance system is detected, but arming is allowed. |
| 2 | Enforce for all modes. Arming is denied if no traffic avoidance system is detected, regardless of flight mode. |
| 3 | Enforce for mission modes only. Arming is denied if no traffic avoidance system is detected and a mission mode is planned. |
| Value | Description|
| ----- | ---------- |
| 0 | Disabled (default). No check is performed.|
| 1 | Warning (allow arming). Arming is allowed even if no traffic avoidance system is detected; a warning is issued if it is missing or lost in flight. |
| 2 | Error (block arming). Arming is denied while no traffic avoidance system is detected, and a warning is issued if it is lost in flight. |
| 3 | Return. Arming is denied while no traffic avoidance system is detected, and the vehicle returns if it is lost in flight.|
| 4 | Land. Arming is denied while no traffic avoidance system is detected, and the vehicle lands if it is lost in flight.|
When a traffic avoidance system is detected, the system tracks its presence with a 3-second timeout.
If the system is lost or regained, corresponding events are logged ("Traffic avoidance system lost" / "Traffic avoidance system regained").

View File

@@ -30,6 +30,8 @@ Please continue reading for [upgrade instructions](#upgrade-guide).
## Upgrade Guide
- `COM_ARM_TRAFF` has been replaced by `COM_TRAFF_AVOID`. The old value 3 ("enforce for mission modes only") is migrated to `COM_TRAFF_AVOID=2`, which blocks arming in all modes, not just mission modes. If you relied on being able to arm manually with traffic detected, set `COM_TRAFF_AVOID=1` (warning only) instead.
## Other changes
- Fast mission Return modes ([RTL_TYPE](../advanced_config/parameter_reference.md#RTL_TYPE) = 2 and 4) now skip `DO_JUMP` commands (loops) while following the mission path. ([PX4-Autopilot#26993: fix(navigator): goToNextPositionItem skip loops when required](https://github.com/PX4/PX4-Autopilot/pull/26993))