Skip to content

Commit 7ba734f

Browse files
committed
more information about terrain data
1 parent 8c72a9e commit 7ba734f

1 file changed

Lines changed: 81 additions & 13 deletions

File tree

common/source/docs/common-terrain-following.rst

Lines changed: 81 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,12 @@ Terrain Following in CRUISE and FBWB modes can be disabled with an RC switch ass
6969
Use of terrain following in AUTO missions is controlled on a waypoint by
7070
waypoint basis using the reference frame of the waypoint. Normal (non
7171
terrain following) waypoints have a "Relative" reference frame, and
72-
altitudes are specified relative to the home location. Not by the :ref:`TERRAIN_FOLLOW<TERRAIN_FOLLOW>` parameter. Terrain following
73-
waypoints have a "Terrain" reference frame, and altitudes are relative
72+
altitudes are specified relative to the home location, not by the :ref:`TERRAIN_FOLLOW<TERRAIN_FOLLOW>` parameter.
73+
Terrain following waypoints have a "Terrain" reference frame, and altitudes are relative
7474
to the ground level given in the terrain database.
7575

76-
.. note:: in AUTO mode autolandings, the :ref:`TERRAIN_FOLLOW<TERRAIN_FOLLOW>` parameter does have an impact, when a rangefinder is also used. See :ref:`rangefinder-autolanding`.
76+
.. note:: in AUTO mode autolandings, the :ref:`TERRAIN_FOLLOW<TERRAIN_FOLLOW>` parameter
77+
does have an impact, when a rangefinder is also used. See :ref:`rangefinder-autolanding`.
7778

7879
See :ref:`common-understanding-altitude` for altitude definitions.
7980

@@ -92,30 +93,51 @@ the terrain may vary significantly. Key uses are:
9293
- **FPV flying.** When flying FPV in CRUISE mode it is useful to
9394
maintain constant height above the ground so you can spend more time
9495
enjoying the scenary and less time avoiding hills
96+
- **Regulatory Compliance.** many countries have restrictions on the
97+
altitude drones must fly at or below, often 400' (about 120m). with
98+
terrain following enabled, missions items and other limits including
99+
:ref:`FENCE_ALT_MIN<FENCE_ALT_MIN>` and :ref:`FENCE_ALT_MAX<FENCE_ALT_MAX>`
100+
can be specified in AGL (terrain) frame.
95101

96102

97103
Sources of Terrain Data
98104
=======================
99105

100-
The ground station is normally responsible for providing the raw terrain data which is sent to the aircraft via MAVLink. Right now only Mission Planner and MAVProxy support the required TERRAIN_DATA and TERRAIN_REQUEST MAVLink messages needed for terrain following download support. If you are using a different ground station , in order to download terrain data you will need to connect using one of those two ground stations in order to allow ArduPilot to load terrain data onto your board on the ground or in flight. Once it is loaded, it is saved permanently on the microSD card.
106+
The ground station is normally responsible for providing the raw terrain data which is sent to the aircraft via MAVLink.
107+
Right now only Mission Planner, QGroundControl, SiYi UniGCS and MAVProxy support the required TERRAIN_DATA and TERRAIN_REQUEST
108+
MAVLink messages needed for terrain following download support. If you are using a different ground station , in order to download terrain data you will need to connect using one of those two ground stations in order to allow ArduPilot to load terrain data onto your board on the ground or in flight. Once it is loaded, it is saved permanently on the microSD card.
101109

102-
Both MissionPlanner and MAVProxy support the global SRTM database for terrain data. The ArduPilot SRTM server used by MAVProxy and Mission Planner has 100m grid spacing. Unless the ground control station uses a different server with closer spacing, setting the :ref:`TERRAIN_SPACING <TERRAIN_SPACING>` parameter lower than 100m provides no better resolution, and only consumes more space on the SD card.
110+
Both MissionPlanner and MAVProxy support the global SRTM database for terrain data.
111+
The ArduPilot SRTM server used by MAVProxy and Mission Planner provides data with 100m and 30m grid spacing.
112+
Unless the ground control station uses a different server, setting the :ref:`TERRAIN_SPACING <TERRAIN_SPACING>`
113+
parameter other than 100m or 30m provides no better resolution, and only consumes more space on the SD card.
103114

104-
Terrain Data is downloaded any time you save or connect with a loaded mission with these ground stations, or, if flying, the autopilot will request data if it's flying into an area not already downloaded, assuming the ground station can provide it. Usually an internet connection is required by the ground station.
115+
If :ref:`TERRAIN_OPTIONS<TERRAIN_OPTIONS>` bit 1 is not set, terrain Data is downloaded any time you save or
116+
connect with a loaded mission with these ground stations, or,
117+
if flying, the autopilot will request data if it's flying into an area not already downloaded, assuming the
118+
ground station can provide it. Usually an internet connection is required by the ground station for this to work.
105119

106-
.. warning:: While the autopilot will request the terrain data around waypoints and home location, if it is not connected to a GCS that can supply enroute tiles, the autopilot just interpolates between waypoint's terrain elevation. See below:
120+
.. warning:: While the autopilot will request the terrain data around waypoints and home location, if it is not connected to a GCS that can supply enroute tiles, and if there relevant terrain data is not on the SD Card, the autopilot just interpolates between waypoint's terrain elevation. See below:
107121
.. image:: ../../../images/terrain-warning.jpg
108122

109-
If you are not flying with a GCS that can fetch and supply terrain data as the vehicles flies between waypoints, the you may need to load terrain data covering the flight route and/or area for RTL paths manually.
123+
If you are not flying with a GCS that can fetch and supply terrain data as the vehicles flies between waypoints,
124+
the you may need to load terrain data covering the flight route and/or area for RTL paths manually.
110125

111-
You can download a set of terrain data tiles for any anticipated flight area using this `web utility <https://terrain.ardupilot.org/>`__.
126+
You can download a set of terrain data tiles at either 100m (STRM3) or 30m (SRTM1) for any anticipated
127+
flight area using this `web utility <https://terrain.ardupilot.org/>`__.
112128

113129
.. image:: ../../../images/common-terrain-dl-utility.png
114130

115131
It will create tiles for the specified radius around a geographic location. Then you can download them, unzip and write in the APM/TERRAIN folder of the SD card.
116132

117133
You can also download .zip files for entire continents, or individual tiles from `here <https://terrain.ardupilot.org/continentsdat3/>`__.
118134

135+
You may also want to obtain higher resolution data, available from commercial sources online, if you have specialized requirements.
136+
137+
It's a very good idea to remove the SD card from the AutoPilot and copy large terrain data sets directly to
138+
the /APM/TERRAIN folder from your PC, as copying them via MAVFtp in Mission Planner using a USB
139+
or other MAVlink connection is likely to take many, many hours or even days.
140+
119141
Terrain Spacing
120142
===============
121143

@@ -125,16 +147,26 @@ requests for terrain data from the aircraft to the ground station. The
125147
default :ref:`TERRAIN_SPACING<TERRAIN_SPACING>` is 100 meters, but users may set a different
126148
grid spacing for specialist applications.
127149

150+
30m spacing (SRTM1) data provides a good compromise between accuracy and
151+
bandwidth/storage space, and runtime memory requirements. Use ``TERRAIN_SPACING`` = 30
152+
meters for most normal use cases.
153+
128154
Note that the amount of terrain data kept in memory is directly related
129155
to the grid spacing. If you decrease the ``TERRAIN_SPACING`` by a factor of
130156
2 then the amount of terrain area kept in memory is reduced by a factor
131-
of 4. It is recommended that you use a ``TERRAIN_SPACING`` of 100
157+
of 4. This may be an issue on older boards with less memory, but for a newer
158+
AutoPilot with 1M of RAM, the :ref:`TERRAIN_CACHE_SZ<TERRAIN_CACHE_SZ>` can be
159+
increased to make better use of available memory for caching terrain tiles. The default
160+
is 12 but a good value on an H743 or H757 processor is probably 60.
161+
162+
If your AutoPilot has less memory, less storage space or communication
163+
bandwidth might be an issue, it is recommended that you use a ``TERRAIN_SPACING`` of 100
132164
meters to prevent the aircraft running off the side of a grid in flight
133165
and not having data available.
134166

135167
If the ground station does not have terrain data available at the
136168
resolution requested by the aircraft then the ground station will
137-
interpolate as necessary to provide the requested grid size. Currently, MAVPRoxy and Mission Planner can only provide data down to 100m spacing.
169+
interpolate as necessary to provide the requested grid size.
138170

139171
Terrain Accuracy
140172
================
@@ -163,13 +195,15 @@ steps
163195
When the autopilot has finished loading terrain data you should see
164196
"ter_pend" goes to zero and the current terrain altitude in meters
165197
showing up in "ter_alt". The "ter_pend" value is the number of terrain
166-
blocks that the autopilot is waiting to load from the ground station.
198+
blocks that the autopilot is waiting to load from the ground station or from the SD Card.
167199

168200
Options
169201
-------
170-
There are two optional behaviors which can be selected via the :ref:`TERRAIN_OPTIONS<TERRAIN_OPTIONS>` bitmask parameter:
202+
There are three optional behaviors which can be selected via the :ref:`TERRAIN_OPTIONS<TERRAIN_OPTIONS>` bitmask parameter:
203+
171204
- if bit 0 is set (value+1): downloading of terrain data is halted.
172205
- if bit 1 is set (value+2): enables using terrain data (via GCS) when no SD card is present.
206+
- if bit 2 is set (value+4): will accept "old" terrain data (see below)
173207

174208
Terrain Look-ahead
175209
==================
@@ -185,5 +219,39 @@ include climb rates your aircraft cannot achieve.
185219
The climb rate used in the terrain look-ahead is based on the
186220
:ref:`TECS_CLMB_MAX<TECS_CLMB_MAX>` parameter, combined with your current ground speed.
187221

222+
Terrain Data Issue - Old Terrain Data
223+
=====================================
224+
In early 2026 an issue was identified with terrain data available from terrain.ardupilot.org.
225+
The issue was resolved on 24th February 2026. From ArduPilot 4.7, ArduPilot will raise a pre-arm
226+
error if it finds older data on the SD Card, or it's served from a ground control station, perhaps
227+
from an older cache. It might be risky to fly with this old data, but the risks do depend on where
228+
you are flying, so you might chose to accept the risk. IF you do set :ref:`TERRAIN_OPTIONS<TERRAIN_OPTIONS>` bit 2
229+
which will override the warning.
230+
231+
If you are running a 4.6.x release or earlier you won’t get the above error message, but that doesn’t mean you are safe.
232+
You should:
233+
234+
- Delete all the DAT files in the APM/TERRAIN directory on your microSD card then reboot the autopilot
235+
- Delete the SRTM data from your Ground Station. If using Mission Planner delete the contents of C:\\ProgramData\\Mission Planner\\srtm
236+
- Then either download new data from terrain.ardupilot.org or let the normal automatic terrain download system download new terrain data via your GCS.
237+
238+
If you are running the new 4.7.x release (or you are running the latest master branch) then you should get the above warning if you have old terrain data, but if you are uncertain then the safe thing to do is delete the old DAT files from APM/TERRAIN and download again.
239+
240+
In 4.7.x you can set :ref:`TERRAIN_OPTIONS<TERRAIN_OPTIONS>` bit 2 to override the check and allow you to use old terrain data.
241+
If you are confident you are not impacted by the bugs (most locations in the world are unaffected)
242+
then this new :ref:`TERRAIN_OPTIONS<TERRAIN_OPTIONS>` bit allows you to fly without the error messages. We don’t recommend this, but for some vehicles where replacing the terrain data files is difficult this is
243+
provided as an option. For example, if you have created your own DAT files from geoTIFF or similar then this would be a way to avoid having to regenerate them. Remember to unset this option bit when you move to newer terrain data.
244+
245+
Recommended Settings
246+
====================
247+
248+
- set :ref:`TERRAIN_ENABLE<TERRAIN_ENABLE>` to 1 and :ref:`TERRAIN_FOLLOW<TERRAIN_FOLLOW>` to 1
249+
- set :ref:`TERRAIN_SPACING<TERRAIN_SPACING>` to 30 meters for more precise AGL calculations
250+
- set :ref:`TERRAIN_CACHE_SZ<TERRAIN_CACHE_SZ>` to 60 to load more tiles into memory (RAM)
251+
- set :ref:`TERRAIN_LOOKAHD<TERRAIN_LOOKAHD>` to 1000 meters unless you have a reason to need more
252+
253+
To avoid high bandwidth consumption due to terrain tiles being sent to the aircraft over your telemetry
254+
link, especially if you often fly in different locations, it's also highly recommended to download the
255+
terrain around your planned flight area in the /APM/TERRAIN folder on the SD Card on the AutoPilot.
188256

189257
[copywiki destination="plane"]

0 commit comments

Comments
 (0)