autotest: add test for scripting guided-steering-throttle example

This commit is contained in:
Peter Barker 2020-06-22 16:23:41 +10:00 committed by Peter Barker
parent 30bcf4d13b
commit 29e6f058a9
1 changed files with 35 additions and 0 deletions

View File

@ -4932,6 +4932,37 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
return # success!
raise NotAchievedException("Did not get expected text")
def test_scripting_steering_and_throttle(self):
self.start_subtest("Scripting square")
ex = None
example_script = "rover-set-steering-and-throttle.lua"
try:
self.install_example_script(example_script)
self.set_parameter("SCR_ENABLE", 1)
self.reboot_sitl()
self.wait_ready_to_arm()
self.arm_vehicle()
self.set_rc(6, 2000)
tstart = self.get_sim_time()
while not self.mode_is("HOLD"):
if self.get_sim_time_cached() - tstart > 30:
raise NotAchievedException("Did not move to hold")
m = self.mav.recv_match(type='VFR_HUD', blocking=True, timeout=1)
if m is not None:
self.progress("Current speed: %f" % m.groundspeed)
self.disarm_vehicle()
self.reboot_sitl()
except Exception as e:
self.progress("Caught exception: %s" %
self.get_exception_stacktrace(e))
self.disarm_vehicle()
ex = e
self.remove_example_script(example_script)
self.reboot_sitl()
if ex is not None:
raise ex
def test_scripting(self):
self.test_scripting_hello_world()
self.test_scripting_simple_loop()
@ -5224,6 +5255,10 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
"Scripting test",
self.test_scripting),
("ScriptingSteeringAndThrottle",
"Scripting test - steering and throttle",
self.test_scripting_steering_and_throttle),
("MissionFrames",
"Upload/Download of items in different frames",
self.test_mission_frames),