Servers by jDrones

Question about height_amsl() when it's 'corrected'

What happens when the height_amsl() function is ‘corrected’. Does this mean that the height returned is the terrain height above the home location rather than above mean sea level?


  find the terrain height in meters above sea level for a location

  return false if not available

  if corrected is true then terrain alt is adjusted so that

  the terrain altitude matches the home altitude at the home location

  (i.e. we assume home is at the terrain altitude)


bool height_amsl(const Location &loc, float &height, bool corrected);

I think it corrects the terrain height by some fixed amount such that the terrain height reported for the home location is corrected to the home altitude.

Ie if home is at +10m but the terrain height at the location reports 5m the correction would be +5m such that the home terrain height is reported as 10m. this 5m correction is then added on to all the terrain heights.

Sort of a single data point ‘calibration’ of the terrain data.

Thank you Peter. A further question:

if home is at +10m

+10m relative to what, measured by what?

EDIT: Ah, I think I see. The answer would be as measured by the GNSS receiver, which provides a (WGS84) height above mean sea level.

So let’s say one is sitting on the runway, and defines this as the home location. This (WGS84) height above mean sea level is also the terrain height. But, as you say, the terrain data will likely indicate that the terrain height for this location is slightly different. So we calculate this difference and apply it to all other locations as the ‘correction’.

1 Like

yep, exactly. It also means we don’t get a step change when we move from takeoff to AGL flight. Otherwise sometimes with significant discrepancies between GPS data and terrain data the aircraft could try to dive into the ground on the first AGL waypoint.
It also means when the user asks the aircraft to land at home that it actually lands at the right height.

Servers by jDrones