From a1aefaff27a450fcc121d1c285e8f7ad1cddc083 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 1 Feb 2019 10:11:25 +1100 Subject: [PATCH] Tools: autotest: add parachute tests Tools: autotest: add test for triggering parachute via mavlink Tools: autotest: add Copter mission test for parachute release Tools: autotest: add Plane test for parachute deployment in auto --- Tools/autotest/arducopter.py | 23 +++++++++++++++++++++ Tools/autotest/arduplane.py | 18 ++++++++++++++++ Tools/autotest/copter_parachute_mission.txt | 4 ++++ Tools/autotest/plane-parachute-mission.txt | 5 +++++ 4 files changed, 50 insertions(+) create mode 100644 Tools/autotest/copter_parachute_mission.txt create mode 100644 Tools/autotest/plane-parachute-mission.txt diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 92ad834288..7a52d8d06c 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -1640,6 +1640,29 @@ class AutoTestCopter(AutoTest): self.set_parameter("SIM_PARA_ENABLE", 1) self.set_parameter("SIM_PARA_PIN", 9) + self.progress("Test triggering parachute in mission") + self.load_mission("copter_parachute_mission.txt") + self.change_mode('LOITER') + self.wait_ready_to_arm() + self.arm_vehicle() + self.change_mode('AUTO') + self.set_rc(3, 1600) + self.mavproxy.expect('BANG') + self.reboot_sitl() + + self.progress("Test triggering with mavlink message") + self.takeoff(20) + self.run_cmd(mavutil.mavlink.MAV_CMD_DO_PARACHUTE, + 2, # release + 0, + 0, + 0, + 0, + 0, + 0) + self.mavproxy.expect('BANG') + self.reboot_sitl() + self.progress("Testing three-position switch") self.set_parameter("RC9_OPTION", 23) # parachute 3pos diff --git a/Tools/autotest/arduplane.py b/Tools/autotest/arduplane.py index f4386f5880..80b5d2fad6 100644 --- a/Tools/autotest/arduplane.py +++ b/Tools/autotest/arduplane.py @@ -700,6 +700,22 @@ class AutoTestPlane(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.load_mission("plane-parachute-mission.txt") + self.mavproxy.send("wp set 1\n") + self.change_mode('AUTO') + self.wait_ready_to_arm() + self.arm_vehicle() + self.mavproxy.expect("BANG") + self.reboot_sitl() + def run_subtest(self, desc, func): self.start_subtest(desc) func() @@ -772,6 +788,8 @@ class AutoTestPlane(AutoTest): "Test Gripper mission items", self.test_gripper_mission), + ("Parachute", "Test Parachute", self.test_parachute), + ("LogDownLoad", "Log download", lambda: self.log_download( diff --git a/Tools/autotest/copter_parachute_mission.txt b/Tools/autotest/copter_parachute_mission.txt new file mode 100644 index 0000000000..9d43c8182c --- /dev/null +++ b/Tools/autotest/copter_parachute_mission.txt @@ -0,0 +1,4 @@ +QGC WPL 110 +0 1 0 16 0.000000 0.000000 0.000000 0.000000 -35.362881 149.165222 582.000000 1 +1 0 3 22 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 20.000000 1 +2 0 0 208 2.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1 diff --git a/Tools/autotest/plane-parachute-mission.txt b/Tools/autotest/plane-parachute-mission.txt new file mode 100644 index 0000000000..ea2924c2cc --- /dev/null +++ b/Tools/autotest/plane-parachute-mission.txt @@ -0,0 +1,5 @@ +QGC WPL 110 +0 0 0 16 0.000000 0.000000 0.000000 0.000000 -35.362045 149.165878 584.280029 1 +1 0 3 22 0.000000 0.000000 0.000000 0.000000 -35.362125 149.165039 10.000000 1 +2 0 3 16 0.000000 0.000000 0.000000 0.000000 -35.364845 149.163452 11.000000 1 +3 0 0 208 2.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1