Skip to content

Commit

Permalink
Plane: mode LoiterAltQLand to reuse loiter point if available
Browse files Browse the repository at this point in the history
  • Loading branch information
magicrub committed Oct 26, 2023
1 parent 106067d commit 22738cb
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions ArduPlane/mode_LoiterAltQLand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ bool ModeLoiterAltQLand::_enter()
return true;
}

// If we were already in a loiter then use that waypoint. Else, use the current point
const Location loiter_wp = plane.nav_controller->reached_loiter_target() ? plane.next_WP_loc : plane.current_loc;

ModeLoiter::_enter();

#if AP_TERRAIN_AVAILABLE
if (plane.terrain_enabled_in_mode(Mode::Number::QLAND)) {
plane.next_WP_loc.set_alt_cm(quadplane.qrtl_alt*100UL, Location::AltFrame::ABOVE_TERRAIN);
} else {
plane.next_WP_loc.set_alt_cm(quadplane.qrtl_alt*100UL, Location::AltFrame::ABOVE_HOME);
}
#else
plane.next_WP_loc.set_alt_cm(quadplane.qrtl_alt*100UL, Location::AltFrame::ABOVE_HOME);
#endif
handle_guided_request(loiter_wp);

switch_qland();

Expand Down

0 comments on commit 22738cb

Please sign in to comment.