From 2aacebcd26f0d5cdc9c10c9ffe5d54490e25e065 Mon Sep 17 00:00:00 2001 From: Henry Wurzburg Date: Fri, 6 Dec 2024 10:16:05 -0600 Subject: [PATCH] Tools: add Plane autoland applet --- Tools/autotest/arduplane.py | 38 +++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/Tools/autotest/arduplane.py b/Tools/autotest/arduplane.py index 7fabd6cd07816..8d4dffac51753 100644 --- a/Tools/autotest/arduplane.py +++ b/Tools/autotest/arduplane.py @@ -5325,6 +5325,43 @@ def AerobaticsScripting(self): self.progress("Completed trick %s" % t) else: raise NotAchievedException("Missing trick %s" % t) + + def UniversalAutoLandScript(self): + '''Test UniversalAutoLandScript''' + applet_script = "UniversalAutoLand.lua" + self.customise_SITL_commandline(["--home", "-35.362938,149.165085,585,173"]) + + self.install_applet_script_context(applet_script) + self.context_collect('STATUSTEXT') + self.set_parameters({ + "SCR_ENABLE" : 1, + "SCR_VM_I_COUNT" : 1000000, + "RTL_AUTOLAND" : 2 + }) + self.reboot_sitl() + self.wait_text("Loaded UniversalAutoLand.lua", check_context=True) + self.set_parameters({ + "AUTOLAND_ENABLE" :1 + }) + self.set_parameters({ + "AUTOLAND_WP_ALT" : 55, + "AUTOLAND_WP_DIST" : 400 + }) + self.scripting_restart() + self.wait_text("Scripting: restarted", check_context=True) + + self.wait_ready_to_arm() + self.arm_vehicle() + self.change_mode("AUTO") + self.wait_text("Captured initial takeoff direction", check_context=True) + + self.wait_disarmed(120) + self.progress("Check the landed heading matches takeoff") + self.wait_heading(173, accuracy=5, timeout=1) + loc = mavutil.location(-35.362938, 149.165085, 585, 173) + if self.get_distance(loc, self.mav.location()) > 35: + raise NotAchievedException("Did not land close to home") + def SDCardWPTest(self): '''test BRD_SD_MISSION support''' @@ -6506,6 +6543,7 @@ def tests1b(self): self.HIGH_LATENCY2, self.MidAirDisarmDisallowed, self.AerobaticsScripting, + self.UniversalAutoLandScript, self.MANUAL_CONTROL, self.RunMissionScript, self.WindEstimates,