Skip to content

Commit

Permalink
Plane: trajectory loiter last point
Browse files Browse the repository at this point in the history
  • Loading branch information
magicrub committed Oct 26, 2024
1 parent 9db70f9 commit 97b5e40
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions ArduPlane/mode_guided.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,21 @@ void ModeGuided::navigate_trajectory()
const bool wp_has_been_reached = plane.verify_nav_wp(mission_cmd);

if (wp_has_been_reached) {
// we have reached it, remove the first index
trajectory.pop_front();
// we have reached it.
plane.gcs().send_mission_item_reached_message(0);

// TODO: notify AP_DDS of waypoint reached

// remove it from the list
const Location prev_loc = trajectory.front();
trajectory.pop_front();

if (is_doing_trajectory()) {
// start the next one
// there are more point(s), start the next one
plane.do_nav_wp(trajectory_to_mission_cmd());
} else {
// act as if we just entered Guided and loiter acount current point
_enter();
// act as if we just entered Guided and loiter around the last waypoint
plane.set_guided_WP(prev_loc);
}
}
}
Expand Down

0 comments on commit 97b5e40

Please sign in to comment.