Copter: WP Pause support

This commit is contained in:
Leonard Hall 2022-01-26 15:17:14 +10:30 committed by Randy Mackay
parent 2aa3c0c478
commit 98fa2f35ae
3 changed files with 19 additions and 3 deletions

View File

@ -1003,15 +1003,16 @@ MAV_RESULT GCS_MAVLINK_Copter::handle_command_pause_continue(const mavlink_comma
// requested pause from GCS // requested pause from GCS
if ((int8_t) packet.param1 == 0) { if ((int8_t) packet.param1 == 0) {
copter.mode_auto.mission.stop(); // copter.mode_auto.mission.stop();
copter.mode_auto.loiter_start(); copter.mode_auto.pause_mission();
gcs().send_text(MAV_SEVERITY_INFO, "Paused mission"); gcs().send_text(MAV_SEVERITY_INFO, "Paused mission");
return MAV_RESULT_ACCEPTED; return MAV_RESULT_ACCEPTED;
} }
// requested resume from GCS // requested resume from GCS
if ((int8_t) packet.param1 == 1) { if ((int8_t) packet.param1 == 1) {
copter.mode_auto.mission.resume(); // copter.mode_auto.mission.resume();
copter.mode_auto.continue_mission();
gcs().send_text(MAV_SEVERITY_INFO, "Resumed mission"); gcs().send_text(MAV_SEVERITY_INFO, "Resumed mission");
return MAV_RESULT_ACCEPTED; return MAV_RESULT_ACCEPTED;
} }

View File

@ -427,6 +427,9 @@ public:
void circle_movetoedge_start(const Location &circle_center, float radius_m); void circle_movetoedge_start(const Location &circle_center, float radius_m);
void circle_start(); void circle_start();
void nav_guided_start(); void nav_guided_start();
void pause_mission();
void continue_mission();
bool is_landing() const override; bool is_landing() const override;

View File

@ -673,6 +673,18 @@ void ModeAuto::exit_mission()
} }
} }
// pause_mission - Prevent aircraft from progressing along the track
void ModeAuto::pause_mission()
{
wp_nav->set_pause();
}
// continue_mission - Allow aircraft to progress along the track
void ModeAuto::continue_mission()
{
wp_nav->set_continue();
}
// do_guided - start guided mode // do_guided - start guided mode
bool ModeAuto::do_guided(const AP_Mission::Mission_Command& cmd) bool ModeAuto::do_guided(const AP_Mission::Mission_Command& cmd)
{ {