From 5cc046b9ccc6bdb3947b3365ce25e5318ffbd32b Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 12 Apr 2023 15:23:26 +1000 Subject: [PATCH] Tools: AP_Arming ensures mission items present when in auto mode Co-authored-by: Henry Wurzburg --- Tools/autotest/arducopter.py | 1 + Tools/autotest/arduplane.py | 1 + Tools/autotest/common.py | 13 +++++++++++++ Tools/autotest/rover.py | 1 + 4 files changed, 16 insertions(+) diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 3aafe1a4f3..3633db2f4d 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -9854,6 +9854,7 @@ class AutoTestCopter(AutoTest): self.IMUConsistency, self.AHRSTrimLand, self.GuidedYawRate, + self.NoArmWithoutMissionItems, ]) return ret diff --git a/Tools/autotest/arduplane.py b/Tools/autotest/arduplane.py index 6f426449ab..497ea7146e 100644 --- a/Tools/autotest/arduplane.py +++ b/Tools/autotest/arduplane.py @@ -4571,6 +4571,7 @@ class AutoTestPlane(AutoTest): self.MissionJumpTags, self.GCSFailsafe, self.SDCardWPTest, + self.NoArmWithoutMissionItems, ]) return ret diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index 6ce9a81cc1..8e5ef4f1df 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -7309,6 +7309,19 @@ class AutoTest(ABC): # Check fence is not enabled self.assert_not_receiving_message('FENCE_STATUS', timeout=timeout) + def NoArmWithoutMissionItems(self): + '''ensure we can't arm in auto mode without mission items present''' + # load a trivial mission + items = [] + items.append((mavutil.mavlink.MAV_CMD_NAV_WAYPOINT, 0, 0, 20000),) + items.append((mavutil.mavlink.MAV_CMD_NAV_RETURN_TO_LAUNCH, 0, 0, 0)) + self.upload_simple_relhome_mission(items) + + self.change_mode('AUTO') + self.clear_mission(mavutil.mavlink.MAV_MISSION_TYPE_ALL) + self.assert_prearm_failure('Mode requires mission', + other_prearm_failures_fatal=False) + def assert_prearm_failure(self, expected_statustext, timeout=5, diff --git a/Tools/autotest/rover.py b/Tools/autotest/rover.py index 64e83424f1..1a8f71231a 100644 --- a/Tools/autotest/rover.py +++ b/Tools/autotest/rover.py @@ -6354,6 +6354,7 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm) self.GCSFailsafe, self.InitialMode, self.DriveMaxRCIN, + self.NoArmWithoutMissionItems, ]) return ret