From 0f67535350128aab5c44771f7e599625fc185eeb Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sun, 7 Apr 2024 15:08:16 +1000 Subject: [PATCH] autotest: augment WaitAndMaintain class, add WaitAndMaintainArmed --- Tools/autotest/vehicle_test_suite.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/Tools/autotest/vehicle_test_suite.py b/Tools/autotest/vehicle_test_suite.py index 55e7582fc4..848179176f 100644 --- a/Tools/autotest/vehicle_test_suite.py +++ b/Tools/autotest/vehicle_test_suite.py @@ -400,6 +400,18 @@ class WaitAndMaintain(object): text += f" (maintain={delta:.1f}/{self.minimum_duration})" self.progress(text) + def progress_text(self, value): + return f"want={self.get_target_value()} got={value}" + + def validate_value(self, value): + return value == self.get_target_value() + + def timeoutexception(self): + return AutoTestTimeoutException("Failed to attain or maintain value") + + def success_text(self): + return f"{type(self)} Success" + class WaitAndMaintainLocation(WaitAndMaintain): def __init__(self, test_suite, target, accuracy=5, height_accuracy=1, **kwargs): @@ -453,6 +465,17 @@ class WaitAndMaintainLocation(WaitAndMaintain): return (f"Want=({self.target.lat},{self.target.lng}) distance={self.horizontal_error(current_value)}") +class WaitAndMaintainArmed(WaitAndMaintain): + def get_current_value(self): + return self.test_suite.armed() + + def get_target_value(self): + return True + + def announce_start_text(self): + return "Ensuring vehicle remains armed" + + class MSP_Generic(Telem): def __init__(self, destination_address): super(MSP_Generic, self).__init__(destination_address)