|
|
|
@ -249,7 +249,7 @@ int32_t Plane::relative_target_altitude_cm(void)
@@ -249,7 +249,7 @@ int32_t Plane::relative_target_altitude_cm(void)
|
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
int32_t relative_alt = target_altitude.amsl_cm - home.alt; |
|
|
|
|
relative_alt += int32_t(g.alt_offset)*100; |
|
|
|
|
relative_alt += mission_alt_offset()*100; |
|
|
|
|
relative_alt += rangefinder_correction() * 100; |
|
|
|
|
return relative_alt; |
|
|
|
|
} |
|
|
|
@ -451,7 +451,7 @@ void Plane::setup_terrain_target_alt(Location &loc)
@@ -451,7 +451,7 @@ void Plane::setup_terrain_target_alt(Location &loc)
|
|
|
|
|
*/ |
|
|
|
|
int32_t Plane::adjusted_altitude_cm(void) |
|
|
|
|
{ |
|
|
|
|
return current_loc.alt - (g.alt_offset*100); |
|
|
|
|
return current_loc.alt - (mission_alt_offset()*100); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -464,6 +464,24 @@ int32_t Plane::adjusted_relative_altitude_cm(void)
@@ -464,6 +464,24 @@ int32_t Plane::adjusted_relative_altitude_cm(void)
|
|
|
|
|
return adjusted_altitude_cm() - home.alt; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
return the mission altitude offset. This raises or lowers all |
|
|
|
|
mission items. It is primarily set using the ALT_OFFSET parameter, |
|
|
|
|
but can also be adjusted by the rangefinder landing code for a |
|
|
|
|
NAV_LAND command if we have aborted a steep landing |
|
|
|
|
*/ |
|
|
|
|
float Plane::mission_alt_offset(void) |
|
|
|
|
{ |
|
|
|
|
float ret = g.alt_offset; |
|
|
|
|
if (control_mode == AUTO && auto_state.land_in_progress) { |
|
|
|
|
// when landing after an aborted landing due to too high glide
|
|
|
|
|
// slope we use an offset from the last landing attempt
|
|
|
|
|
ret += auto_state.land_alt_offset; |
|
|
|
|
} |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
return the height in meters above the next_WP_loc altitude |
|
|
|
|
*/ |
|
|
|
|