The Advanced Failsafe is ending the flight on purpose
What ArduPilot says:
- Terminating due to fence breach
- Terminating due to …
- Terminating due to dual loss
- Terminating due to RC failure
- Terminating due to range N.Nkm
The Advanced Failsafe (AFS) is an optional system made for competitions whose rules demand that an aircraft is brought down rather than allowed to fly away. With AFS_TERM_ACTION 42 a plane crashes itself: throttle closed, flaps down, ailerons, rudder and elevator hard over. With 43 a QuadPlane lands in QLAND, while an ordinary plane only has its motor disarmed and glides on in its mode. The line gives the reason: RC failure (no radio for AFS_RC_FAIL_TIME), fence breach, range (further than AFS_MAX_RANGE km from where it armed), dual loss (ground station and GPS lost together), or one handed in by a battery failsafe or the ground station.
What to do, most likely first
AFS was switched on without a need for it, or with settings copied from a competition aircraft.
Check
AFS_ENABLEis 1 andAFS_TERM_ACTIONis 42.FixAFS is the one failsafe a first plane should not have: unless a rule requires termination, set
AFS_ENABLEto 0 and let the ordinary failsafes bring the plane home (FS_LONG_ACTN1, RTL).The reason in the line did happen.
CheckRead the last words of the line and the log before it.
FixTreat each as its own fault: radio range for RC failure, the fence's size for a breach,
AFS_MAX_RANGEfor range, telemetry and GPS reception for dual loss.A battery failsafe is set to Terminate (
BATT_FS_LOW_ACTorBATT_FS_CRT_ACTis 3).CheckThe line ends with “low battery” or “critical battery”.
FixChoose 1 (RTL) or 2 (Land) for the battery failsafes unless a deliberate crash on low battery is what you want.
Changing the flight mode does not stop a termination. Setting AFS_TERMINATE back to 0 from the ground station does (“Aborting termination …”), if there is still height and a link to do it.
Parameters to look at
| Parameter | What it is |
|---|---|
AFS_ENABLE | Enable Advanced Failsafe |
AFS_TERM_ACTION | Terminate action |
AFS_TERMINATE | Force Terminate |
AFS_RC_FAIL_TIME | RC failure time |
AFS_GEOFENCE | Enable geofence Advanced Failsafe |
AFS_MAX_RANGE | Max allowed range |
AFS_DUAL_LOSS | Enable dual loss terminate due to failure of both GCS and GPS simultaneously |
AFS_GCS_TIMEOUT | GCS timeout |
Where to do it:Starting Parameters
The code that sends it
Terminating due to fence breach
libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp AP_AdvancedFailsafe::check() · Open in ArduPilot Copter-4.7.1
Terminating due to …
libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp AP_AdvancedFailsafe::gcs_terminate() · Open in ArduPilot Copter-4.7.1
Terminating due to dual loss
libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp AP_AdvancedFailsafe::check() · Open in ArduPilot Copter-4.7.1
Terminating due to RC failure
libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp AP_AdvancedFailsafe::check() · Open in ArduPilot Copter-4.7.1
And 1 more messages, sent from the same places.