mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-18 04:23:33 +08:00
Navigator: re-introduce min loiter alt, but only apply it for Loiters w/o a specified altitude setpoint
Also applies to Loiters that are started due to the previous mode being over (Takeoff, VTOL_Takeoff, Mission). Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
committed by
Daniel Agar
parent
8157d83bfc
commit
9cd3eae0aa
@@ -772,7 +772,17 @@ MissionBlock::setLoiterItemFromCurrentPosition(struct mission_item_s *item)
|
||||
|
||||
item->lat = _navigator->get_global_position()->lat;
|
||||
item->lon = _navigator->get_global_position()->lon;
|
||||
item->altitude = _navigator->get_global_position()->alt;
|
||||
|
||||
// check if minimum loiter altitude is specified, and enforce it if so
|
||||
float loiter_altitude_amsl = _navigator->get_global_position()->alt;
|
||||
|
||||
if (_navigator->get_loiter_min_alt() > FLT_EPSILON) {
|
||||
loiter_altitude_amsl = math::max(loiter_altitude_amsl,
|
||||
_navigator->get_home_position()->alt + _navigator->get_loiter_min_alt());
|
||||
}
|
||||
|
||||
item->altitude = loiter_altitude_amsl;
|
||||
|
||||
item->loiter_radius = _navigator->get_loiter_radius();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user