From c2e45a0f0abf05246f8edd3a081abd7513c561b5 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Fri, 19 May 2023 10:04:32 +1000 Subject: [PATCH] autotest: add an epsilon for achieved servo output for speed scaling test right on the threshold backport from PR https://github.com/ArduPilot/ardupilot/pull/23823 --- Tools/autotest/arducopter.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 97cad92989..fb056527ac 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -11,7 +11,6 @@ import os import shutil import time import numpy -import operator from pymavlink import quaternion from pymavlink import mavutil @@ -9531,7 +9530,12 @@ class AutoTestCopter(AutoTest): self.set_rc(1, 1700) # start driving forward # this is somewhat empirical... - self.wait_servo_channel_value(pump_ch, 1458, timeout=60) + self.wait_servo_channel_value( + pump_ch, + 1458, + timeout=60, + comparator=lambda x, y : abs(x-y) < 5 + ) self.progress("Turning it off again") self.set_rc(rc_ch, 1000) @@ -9550,7 +9554,13 @@ class AutoTestCopter(AutoTest): 0) # p7 self.progress("Testing speed-ramping") - self.wait_servo_channel_value(pump_ch, 1458, timeout=60, comparator=operator.gt) + self.wait_servo_channel_value( + pump_ch, + 1458, + timeout=60, + comparator=lambda x, y : abs(x-y) < 5 + ) + self.start_subtest("Stopping Sprayer") self.run_cmd(mavutil.mavlink.MAV_CMD_DO_SPRAYER, 0, # p1