The fence's altitude limits contradict each other
What ArduPilot says:
- Invalid FENCE_ALT_MIN value
- FENCE_ALT_MAX < FENCE_ALT_MIN
- FENCE_MARGIN too big
- Invalid FENCE_ALT_MAX value
With the fence on, ArduPilot checks the two altitude limits, even when no altitude fence is selected in FENCE_TYPE. FENCE_ALT_MAX (100 m by default) must not be negative. FENCE_ALT_MIN (-10 m by default) must not be below -100. The maximum must not be below the minimum. And the gap between them must be more than twice FENCE_MARGIN (2 m by default), otherwise “FENCE_MARGIN too big” is shown: no height would be left to fly in.
What to do, most likely first
One of the two limits was typed with the wrong sign or in the wrong unit.
CheckRead both.
FENCE_ALT_MAXis metres above home and positive.FENCE_ALT_MINis metres above home too, and is negative only when flying below the take-off point is allowed.FixSet
FENCE_ALT_MAXto the ceiling you want (the documented range is 10 to 1000 m) andFENCE_ALT_MINbelow it.The two limits are closer together than twice
FENCE_MARGIN.CheckSubtract:
FENCE_ALT_MAXminusFENCE_ALT_MINmust be more than 2 ×FENCE_MARGIN, which is more than 4 m with the default margin.FixMove the limits apart. Lower
FENCE_MARGINonly if the aircraft really can stop within that distance.The fence parameters came from another aircraft's file.
FixSet
FENCE_ALT_MAX,FENCE_ALT_MINandFENCE_MARGINfor this aircraft and this field, rather than keeping somebody else's.
Both limits are heights above home, where the aircraft was armed.
Parameters to look at
| Parameter | What it is |
|---|---|
FENCE_ALT_MAX | Fence Maximum Altitude |
FENCE_ALT_MIN | Fence Minimum Altitude |
FENCE_MARGIN | Fence Margin |
FENCE_TYPE | Fence Type |
Where to do it:Failsafe ExplainerParameter Compare & Migrate
The code that sends it
Invalid FENCE_ALT_MIN value
libraries/AC_Fence/AC_Fence.cpp AC_Fence::pre_arm_check_alt() · Open in ArduPilot Copter-4.7.1
FENCE_ALT_MAX < FENCE_ALT_MIN
libraries/AC_Fence/AC_Fence.cpp AC_Fence::pre_arm_check() · Open in ArduPilot Copter-4.7.1
FENCE_MARGIN too big
libraries/AC_Fence/AC_Fence.cpp AC_Fence::pre_arm_check() · Open in ArduPilot Copter-4.7.1
Invalid FENCE_ALT_MAX value
libraries/AC_Fence/AC_Fence.cpp AC_Fence::pre_arm_check_alt() · Open in ArduPilot Copter-4.7.1