The Terrain Protocol provides a mechanism for a vehicle to request terrain information (tiles) from a ground station, and to stream progress of that information to the ground station.
Support for this protocol is indicated by
AUTOPILOT_VERSION.capabilities by the MAV_PROTOCOL_CAPABILITY_TERRAIN flag.
A vehicle that supports this capability must also support terrain following in missions using the data. Note however that a vehicle may also support terrain handling in missions using a distance sensor, even if this protocol is not supported and capability flag is not set.
|!!crwdBlockTags_22_sgaTkcolBdwrc!||Request from drone (to GCS) for terrain data. The message specifies a mask indicating what tiles are required, and the GCS responds by sending TERRAIN_DATA for each tile. The drone will also stream TERRAIN_REPORT messages to provide progress updates while it is waiting for data.|
|!!crwdBlockTags_23_sgaTkcolBdwrc!||Terrain data from GCS for a particular tile (sent in response to a TERRAIN_REQUEST). The |
|!!crwdBlockTags_24_sgaTkcolBdwrc!||The drone will stream |
The TERRAIN_CHECK message is not needed/part of the protocol.
The sequence for a drone to update its terrain altitude information is entirely driven by the drone, and is shown below.
In summary, the sequence is:
- Drone sends TERRAIN_REQUEST to the GCS to request a set of tiles (specified in a mask).
- The GCS responds by sending a TERRAIN_DATA for each tile set in the mask
- The drone also streams TERRAIN_REPORT messages back to the GCS indicating the current state of the download
TERRAIN_REPORT.loadedindicate how many tiles are expected and have arrived, respectively.
terrain_height, while duplicated in other messages, are useful for debugging (a GCS can check its own internal terrain data against what the information).
- The Drone must maintain its own record of what tiles have arrived/not arrived, and can re-request any that are missing using a further TERRAIN_REQUEST (with mask indicating just the missing tiles)
TERRAIN_REQUEST.mask is a 64-bit value that represents a row major 8x7 array of (4x4) tiles. The the
lon fields indicate the position of the South-West corner of first grid position (tile). The tiles are allocated sequentially in rows (West to East) starting from the lowest significant bit of
mask, and then in columns (South to North).
Each tile represents a 4x4 grid of altitude information. The spacing between the rows/columns in the tile is indicated by
grid_spacing (the same value must be used in both request and data messages).