No memory for the terrain database
What ArduPilot says:
- Terrain: Allocation failed
The terrain database could not get the memory for its working store: TERRAIN_CACHE_SZ blocks (12 by default) of about 1.8 kB each. It stays off until the next reboot: no terrain heights, so waypoints with heights above terrain and terrain following do not work. Arming is refused as well, with “Terrain out of memory”, whether or not the flight needs terrain.
What to do, most likely first
The board is short of memory: scripting, many enabled features, or a raised
TERRAIN_CACHE_SZ.CheckOther out-of-memory messages appear at start-up, and the ground station shows little free memory.
FixPut
TERRAIN_CACHE_SZback to 12 if it was raised, free memory by switching off features you do not use (scripting is usually the largest), and reboot.Terrain is on although nothing in your flying uses it.
FixIf no mission uses heights above terrain and no terrain following is set, set
TERRAIN_ENABLEto 0 and reboot: the memory is then never asked for.
Parameters to look at
| Parameter | What it is |
|---|---|
TERRAIN_CACHE_SZ | Terrain cache size |
TERRAIN_ENABLE | Terrain data enable |
Where to do it:Failsafe Explainer
The code that sends it
Terrain: Allocation failed
libraries/AP_Terrain/AP_Terrain.cpp AP_Terrain::allocate() · Open in ArduPilot Copter-4.7.1