From f1a0ebfd10e6ebbde905cfc7a09a1393cbc7c21e Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 17 Aug 2018 12:48:36 +1000 Subject: [PATCH] Tools: autotest: reduce verbosity of wait-for-heading --- Tools/autotest/common.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index 8c4165cdf8..7fb0325fca 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -804,9 +804,19 @@ class AutoTest(ABC): tstart = self.get_sim_time() self.progress("Waiting for heading %u with accuracy %u" % (heading, accuracy)) - while self.get_sim_time() < tstart + timeout: + last_heading = -1 + last_print_time = 0 + while True: + now = self.get_sim_time_cached() + if now - tstart >= timeout: + break m = self.mav.recv_match(type='VFR_HUD', blocking=True) - self.progress("Heading %u" % m.heading) + if (last_heading != m.heading or + now - last_print_time > 1): + self.progress("Heading %u (want %f +- %f)" % ( + m.heading, heading, accuracy)) + last_print_time = now + last_heading = heading if math.fabs(m.heading - heading) <= accuracy: self.progress("Attained heading %u" % heading) return True