Skip to content

Commit

Permalink
Tools: add Plane autoland applet
Browse files Browse the repository at this point in the history
  • Loading branch information
Hwurzburg committed Dec 6, 2024
1 parent e88ec99 commit de019de
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions Tools/autotest/arduplane.py
Original file line number Diff line number Diff line change
Expand Up @@ -5326,6 +5326,40 @@ def AerobaticsScripting(self):
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,
"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'''
spiral_script = "mission_spiral.lua"
Expand Down Expand Up @@ -5446,7 +5480,7 @@ def mission_jump_tag(self, tag, target_system=1, target_component=1):
tag, # p1
0, # p2
0, # p3
0, # p4
libraries/AP_Scripting/applets/UniversalAutoLand.lua 0, # p4
0, # latitude
0, # longitude
0, # altitude
Expand Down Expand Up @@ -5887,7 +5921,7 @@ def DO_PARACHUTE(self):
self.reboot_sitl()

def _MAV_CMD_DO_GO_AROUND(self, command):
self.load_mission("mission.txt")
self.libraries/AP_Scripting/applets/UniversalAutoLand.luaload_mission("mission.txt")
self.set_parameter("RTL_AUTOLAND", 3)
self.change_mode('AUTO')
self.wait_ready_to_arm()
Expand Down Expand Up @@ -6457,6 +6491,7 @@ def tests1a(self):
self.Soaring,
self.Terrain,
self.TerrainMission,
self.UniversalAutoLandScript,
])
return ret

Expand Down

0 comments on commit de019de

Please sign in to comment.