The drawn fence stored on the aircraft could not be loaded
What ArduPilot says:
- Polygon fence(s) invalid
- AC_Fence: invalid polygon vertex count N
- Fence corrupt
- AC_Fence: latlon read failed
- PolyFence: latlon read failed
- AC_Fence: non-positive circle radius
Also explained here: 2 more
- AC_Fence: polygon read failed
- PolyFence: Multiple return points found
FENCE_TYPE includes drawn fences (bit 2), and the polygons and circles stored on the aircraft are not in memory. ArduPilot loads them once it knows where it is. The load fails when what is stored makes no sense: a polygon with fewer than 3 points, a circle with no radius, two return points, an item of unknown kind. The warning lines that begin “AC_Fence:” or “PolyFence:”, and “Fence corrupt”, say which. An aircraft with no drawn fence at all passes this check.
What to do, most likely first
The stored fence is damaged: an upload was cut short, or it was written by a much older firmware.
CheckRead the fence back in the ground station's Plan screen: does it look like what you drew? One of the warning lines above among the start-up messages confirms it.
FixClear the fence on the aircraft, upload it again from the ground station, then reboot.
The fence was uploaded a moment ago and is still being loaded.
FixWait a second or two. If the message stays, it is one of the other causes.
The board has too little free memory to hold all the fence points.
CheckA fence of many points on a small board, with scripting or other memory-hungry features switched on.
FixDraw the fence with fewer points, or free memory by switching off features you do not use, and reboot.
When BRD_SD_FENCE is above 0 the fence is kept in a file on the SD card; a missing card then shows as “Failed to open fence storage”.
Parameters to look at
| Parameter | What it is |
|---|---|
FENCE_TYPE | Fence Type |
FENCE_TOTAL | Fence polygon point total |
BRD_SD_FENCE | SDCard Fence size |
Where to do it:Failsafe Explainer
The code that sends it
Polygon fence(s) invalid
libraries/AC_Fence/AC_Fence.cpp AC_Fence::pre_arm_check_polygon() · Open in ArduPilot Copter-4.7.1
AC_Fence: invalid polygon vertex count N
libraries/AC_Fence/AC_PolyFence_loader.cpp AC_PolyFence_loader::load_from_eeprom() · Open in ArduPilot Copter-4.6.3
libraries/AC_Fence/AC_PolyFence_loader.cpp AC_PolyFence_loader::load_from_storage() · Open in ArduPilot Copter-4.7.1
Fence corrupt
libraries/AC_Fence/AC_PolyFence_loader.cpp AC_PolyFence_loader::scan_eeprom() · Open in ArduPilot Copter-4.7.1
AC_Fence: latlon read failed
libraries/AC_Fence/AC_PolyFence_loader.cpp AC_PolyFence_loader::load_from_eeprom() · Open in ArduPilot Copter-4.6.3
libraries/AC_Fence/AC_PolyFence_loader.cpp AC_PolyFence_loader::load_from_storage() · Open in ArduPilot Copter-4.7.1
And 4 more messages, sent from the same places.