From 6354a8b9127deeed5393cf63a488b7f9e9385c26 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Wed, 31 Jul 2024 11:43:04 +1000 Subject: [PATCH] autotest: add test for forced arm/disarm --- Tools/autotest/arduplane.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Tools/autotest/arduplane.py b/Tools/autotest/arduplane.py index 099d0f8826..3ca7780e5f 100644 --- a/Tools/autotest/arduplane.py +++ b/Tools/autotest/arduplane.py @@ -6028,6 +6028,30 @@ class AutoTestPlane(vehicle_test_suite.TestSuite): self.disarm_vehicle(force=True) self.reboot_sitl() + def ForceArm(self): + '''check force-arming functionality''' + self.set_parameter("SIM_GPS_DISABLE", 1) + # 21196 is the mavlink standard, 2989 is legacy + for magic_value in 21196, 2989: + self.wait_sensor_state(mavutil.mavlink.MAV_SYS_STATUS_PREARM_CHECK, + present=True, + enabled=True, + healthy=False, + ) + self.run_cmd( + mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, + p1=1, # ARM + p2=0, + want_result=mavutil.mavlink.MAV_RESULT_FAILED, + ) + self.run_cmd( + mavutil.mavlink.MAV_CMD_COMPONENT_ARM_DISARM, + p1=1, # ARM + p2=magic_value, + want_result=mavutil.mavlink.MAV_RESULT_ACCEPTED, + ) + self.disarm_vehicle() + def tests(self): '''return list of all tests''' ret = super(AutoTestPlane, self).tests() @@ -6158,6 +6182,7 @@ class AutoTestPlane(vehicle_test_suite.TestSuite): self.ScriptStats, self.GPSPreArms, self.SetHomeAltChange, + self.ForceArm, ]) return ret