Rover: allow clearing mission in AUTO when disarmed

This commit is contained in:
Henry Wurzburg 2023-03-23 19:01:47 -05:00 committed by Andrew Tridgell
parent 67f19c6ddb
commit 09331259bf
2 changed files with 9 additions and 0 deletions

View File

@ -200,6 +200,9 @@ bool AP_Arming_Rover::mode_checks(bool report)
if (!rover.control_mode->allows_arming()) {
check_failed(report, "Mode not armable");
return false;
} else if (rover.control_mode == &rover.mode_auto && rover.mode_auto.mission.num_commands() <= 1) {
check_failed(report, "AUTO requires mission");
return false;
}
return true;
}

View File

@ -44,6 +44,12 @@ void ModeAuto::_exit()
void ModeAuto::update()
{
// check if mission exists (due to being cleared while disarmed in AUTO,
// if no mission, then stop...needs mode change out of AUTO, mission load,
// and change back to AUTO to run a mission at this point
if (!hal.util->get_soft_armed() && mission.num_commands() <= 1) {
start_stop();
}
// start or update mission
if (waiting_to_start) {
// don't start the mission until we have an origin