diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 9f1b517e62..6741855c28 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -1504,6 +1504,54 @@ class AutoTestCopter(AutoTest): if ex is not None: raise ex + def test_parachute(self): + + self.set_rc(9, 1000) + self.set_parameter("CHUTE_ENABLED", 1) + self.set_parameter("CHUTE_TYPE", 10) + self.set_parameter("SERVO9_FUNCTION", 27) + self.set_parameter("SIM_PARA_ENABLE", 1) + self.set_parameter("SIM_PARA_PIN", 9) + + self.progress("Testing three-position switch") + self.set_parameter("RC9_OPTION", 23) # parachute 3pos + + self.progress("Test manual triggering") + self.takeoff(20) + self.set_rc(9, 2000) + self.mavproxy.expect('BANG') + self.set_rc(9, 1000) + self.reboot_sitl() + + self.context_push() + self.progress("Crashing with 3pos switch in enable position") + self.takeoff(40) + self.set_rc(9, 1500) + self.set_parameter("SIM_ENGINE_MUL", 0) + self.set_parameter("SIM_ENGINE_FAIL", 1) + self.mavproxy.expect('BANG') + self.set_rc(9, 1000) + self.reboot_sitl() + self.context_pop(); + + self.progress("Crashing with 3pos switch in disable position") + loiter_alt = 10 + self.takeoff(loiter_alt, mode='LOITER') + self.set_rc(9, 1100) + self.set_parameter("SIM_ENGINE_MUL", 0) + self.set_parameter("SIM_ENGINE_FAIL", 1) + tstart = self.get_sim_time() + while self.get_sim_time_cached() < tstart + 5: + m = self.mav.recv_match(type='STATUSTEXT', blocking=True, timeout=1) + if m is None: + continue + if "BANG" in m.text: + self.set_rc(9, 1000) + self.reboot_sitl() + raise NotAchievedException("Parachute deployed when disabled") + self.set_rc(9, 1000) + self.reboot_sitl() + def fly_precision_sitl(self): """Use SITL PrecLand backend precision messages to land aircraft.""" @@ -2612,6 +2660,10 @@ class AutoTestCopter(AutoTest): "Test RangeFinder Basic Functionality", self.test_rangefinder), + ("Parachute", + "Test Parachute Functionality", + self.test_parachute), + ("LogDownLoad", "Log download", lambda: self.log_download( diff --git a/Tools/autotest/arduplane.py b/Tools/autotest/arduplane.py index de723e93d2..e84f474bd1 100644 --- a/Tools/autotest/arduplane.py +++ b/Tools/autotest/arduplane.py @@ -690,11 +690,6 @@ class AutoTestPlane(AutoTest): if ex is not None: raise ex - def start_subtest(self, description): - self.progress("-") - self.progress("---------- %s ----------" % description) - self.progress("-") - def run_subtest(self, desc, func): self.start_subtest(desc) func() diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index bcfcf96f7c..79fa433c1e 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -2003,6 +2003,11 @@ switch value''' self.progress("Waiting for mode-switch mode %s" % want) self.wait_mode(want) + def start_subtest(self, description): + self.progress("-") + self.progress("---------- %s ----------" % description) + self.progress("-") + def run_tests(self, tests): """Autotest vehicle in SITL.""" self.check_test_syntax(test_file=os.path.realpath(__file__))