Skip to content

Commit

Permalink
Rover: auto navigates while stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
rmackay9 committed Nov 24, 2023
1 parent 48d040f commit 515cabb
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions Rover/mode_auto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,15 @@ void ModeAuto::update()
switch (_submode) {
case SubMode::WP:
{
// check if we've reached the destination
if (!g2.wp_nav.reached_destination() || g2.wp_nav.is_fast_waypoint()) {
// update navigation controller
navigate_to_waypoint();
} else {
// we have reached the destination so stay here
if (rover.is_boat()) {
if (!start_loiter()) {
start_stop();
}
} else {
start_stop();
}
// boats loiter once the waypoint is reached
if (rover.is_boat() && g2.wp_nav.reached_destination() && !g2.wp_nav.is_fast_waypoint()) {
start_loiter();

// update distance to destination
_distance_to_destination = rover.current_loc.get_distance(g2.wp_nav.get_destination());
} else {
// update navigation controller
navigate_to_waypoint();
}
break;
}
Expand Down

0 comments on commit 515cabb

Please sign in to comment.