From 001a06d17d0c82185bf2eb365481d1711314a6d1 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 18 Feb 2022 17:47:13 +1100 Subject: [PATCH] autotest: add tests to a pair of lua scripts --- Tools/autotest/rover.py | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/Tools/autotest/rover.py b/Tools/autotest/rover.py index 3ecbc871cc..fb10d75c03 100644 --- a/Tools/autotest/rover.py +++ b/Tools/autotest/rover.py @@ -5125,7 +5125,61 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm) if ex is not None: raise ex + def test_scripting_print_home_and_origin(self): + self.start_subtest("Scripting print home and origin") + + self.context_push() + + ex = None + example_script = "ahrs-print-home-and-origin.lua" + try: + self.set_parameter("SCR_ENABLE", 1) + self.install_example_script(example_script) + self.reboot_sitl() + self.wait_ready_to_arm() + self.wait_statustext("Home - ") + self.wait_statustext("Origin - ") + except Exception as e: + self.print_exception_caught(e) + ex = e + + self.remove_example_script(example_script) + + self.context_pop() + + self.reboot_sitl() + + if ex is not None: + raise ex + + def test_scripting_set_home_to_vehicle_location(self): + self.start_subtest("Scripting set home to vehicle location") + + self.context_push() + + ex = None + example_script = "ahrs-set-home-to-vehicle-location.lua" + try: + self.set_parameter("SCR_ENABLE", 1) + self.install_example_script(example_script) + self.reboot_sitl() + self.wait_statustext("Home position reset") + except Exception as e: + self.print_exception_caught(e) + ex = e + + self.remove_example_script(example_script) + + self.context_pop() + + self.reboot_sitl() + + if ex is not None: + raise ex + def test_scripting(self): + self.test_scripting_set_home_to_vehicle_location() + self.test_scripting_print_home_and_origin() self.test_scripting_hello_world() self.test_scripting_simple_loop() self.test_scripting_internal_test()