From 754192ff2698c655bd2bb82daf1bc651d9a67f03 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Thu, 21 Oct 2021 08:48:54 +1100 Subject: [PATCH] autotest: improve gps-for-yaw test There are flag values in the mavlink definitions for this message, so make sure we get something approaching the right number. --- Tools/autotest/arducopter.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 4b7264c4bb..0f0fa6a920 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -7337,6 +7337,7 @@ class AutoTestCopter(AutoTest): self.do_RTL() def GPSForYaw(self): + self.context_push() self.load_default_params_file("copter-gps-for-yaw.parm") self.reboot_sitl() ex = None @@ -7344,12 +7345,18 @@ class AutoTestCopter(AutoTest): self.wait_gps_fix_type_gte(6, message_type="GPS2_RAW", verbose=True) m = self.assert_receive_message("GPS2_RAW") self.progress(self.dump_message_verbose(m)) - if m.yaw == 0: - raise NotAchievedException("Expected to get GPS-from-yaw") + want = 27000 + if abs(m.yaw - want) > 500: + raise NotAchievedException("Expected to get GPS-from-yaw (want %f got %f)" % (want, m.yaw)) self.wait_ready_to_arm() except Exception as e: self.print_exception_caught(e) ex = e + + self.context_pop() + + self.reboot_sitl() + if ex is not None: raise ex