The flight needs terrain heights, and the terrain database is off
What ArduPilot says:
- TERRAIN_SPACING can't be <= 0
- PreArm: terrain disabled
- PreArm: terrain required but disabled
The mission has waypoints with heights above terrain, and the terrain database (ground heights kept on the SD card) is not available. “terrain disabled”: TERRAIN_ENABLE is 0. “terrain required but disabled”: this firmware was built without the terrain database, as on boards with little memory. “TERRAIN_SPACING can't be <= 0” (4.7): the grid spacing must be a positive number of metres; 100 is the default.
What to do, most likely first
The waypoints were planned with heights above terrain by accident.
CheckIn the ground station's Plan screen look at the altitude frame of the waypoints: Relative (above home), Absolute (above sea level) or Terrain.
FixIf you did not mean to follow the ground, change the frame to Relative, check every height again and write the mission.
TERRAIN_ENABLEis 0 while the mission really is meant to follow the ground.FixSet
TERRAIN_ENABLEto 1, then wait for the data to arrive (“waiting for terrain data”).The firmware for this board has no terrain database.
CheckThe message is “terrain required but disabled”, and there is no
TERRAIN_ENABLEparameter to set.FixPlan with heights above home, or use a board and a firmware build that include terrain.
A copter whose RTL is set to follow the terrain (RTL_ALT_TYPE 1) with the database off gets a different message: “RTL_ALT_TYPE is above-terrain but no terrain data”.
Parameters to look at
| Parameter | What it is |
|---|---|
TERRAIN_ENABLE | Terrain data enable |
TERRAIN_SPACING | Terrain grid spacing |
Where to do it:Failsafe ExplainerMission Energy Check
The code that sends it
TERRAIN_SPACING can't be <= 0
libraries/AP_Terrain/AP_Terrain.cpp AP_Terrain::pre_arm_checks() · Open in ArduPilot Copter-4.7.1
PreArm: terrain disabled
libraries/AP_Arming/AP_Arming.cpp AP_Arming::terrain_checks() · Open in ArduPilot Copter-4.7.1
PreArm: terrain required but disabled
libraries/AP_Arming/AP_Arming.cpp AP_Arming::terrain_checks() · Open in ArduPilot Copter-4.7.1