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
This commit is contained in:
Peter Barker 2023-05-19 10:04:32 +10:00 committed by Randy Mackay
parent 610e231f5f
commit c2e45a0f0a
1 changed files with 13 additions and 3 deletions

View File

@ -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