From ee18db36fa984001a7723cbadc280dca4202fc1d Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Sat, 22 Feb 2020 20:31:52 +0000 Subject: [PATCH] autotest: be more lenient on frequency with harmonic matching test --- Tools/autotest/arducopter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 288871f087..cc8ec2b1c5 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -3661,7 +3661,7 @@ class AutoTestCopter(AutoTest): self.do_RTL() - def hover_and_check_matched_frequency(self, dblevel=-15, minhz=200, maxhz=300, peakhz=None): + def hover_and_check_matched_frequency(self, dblevel=-15, minhz=200, maxhz=300, peakhz=None, freqMatch=0.05): # find a motor peak self.takeoff(10, mode="ALT_HOLD") @@ -3702,7 +3702,7 @@ class AutoTestCopter(AutoTest): self.progress("Detected motor peak at %fHz processing %d messages" % (pkAvg, nmessages)) # peak within 5% - if abs(pkAvg - freq) / freq > 0.1: + if abs(pkAvg - freq) / freq > freqMatch: raise NotAchievedException("FFT did not detect a motor peak at %f, found %f, wanted %f" % (dblevel, pkAvg, freq)) return freq @@ -3767,7 +3767,7 @@ class AutoTestCopter(AutoTest): self.set_parameter("SIM_VIB_MOT_MULT", 0.25) # halve the motor noise so that the higher harmonic dominates self.reboot_sitl() - self.hover_and_check_matched_frequency(-15, 100, 250) + self.hover_and_check_matched_frequency(-15, 100, 250, None, 0.15) self.set_parameter("SIM_VIB_FREQ_X", 0) self.set_parameter("SIM_VIB_FREQ_Y", 0) self.set_parameter("SIM_VIB_FREQ_Z", 0)