diff --git a/Tools/autotest/arduplane.py b/Tools/autotest/arduplane.py index 4961dbcf2f..c703b85fdb 100644 --- a/Tools/autotest/arduplane.py +++ b/Tools/autotest/arduplane.py @@ -905,7 +905,7 @@ class AutoTestPlane(AutoTest): raise NotAchievedException("Bad absalt (want=%f vs got=%f)" % (original_alt+30, x.alt_msl)) self.fly_home_land_and_disarm() - def test_throttle_failsafe(self): + def ThrottleFailsafe(self): self.change_mode('MANUAL') m = self.mav.recv_match(type='SYS_STATUS', blocking=True) receiver_bit = mavutil.mavlink.MAV_SYS_STATUS_SENSOR_RC_RECEIVER @@ -3538,7 +3538,7 @@ function''' ("ThrottleFailsafe", "Fly throttle failsafe", - self.test_throttle_failsafe), + self.ThrottleFailsafe), ("NeedEKFToArm", "Ensure we need EKF to be healthy to arm", diff --git a/Tools/autotest/common.py b/Tools/autotest/common.py index 4ada08a10a..4ff2a92a91 100644 --- a/Tools/autotest/common.py +++ b/Tools/autotest/common.py @@ -5838,6 +5838,21 @@ class AutoTest(ABC): if comparator(m_value, value): return m_value + def assert_servo_channel_value(self, channel, value, comparator=operator.eq): + """assert channel value (default condition is equality)""" + channel_field = "servo%u_raw" % channel + opstring = ("%s" % comparator)[-3:-1] + m = self.assert_receive_message('SERVO_OUTPUT_RAW', timeout=1) + m_value = getattr(m, channel_field, None) + if m_value is None: + raise ValueError("message (%s) has no field %s" % + (str(m), channel_field)) + self.progress("assert SERVO_OUTPUT_RAW.%s=%u %s %u" % + (channel_field, m_value, opstring, value)) + if comparator(m_value, value): + return m_value + raise NotAchievedException("Wrong value") + def get_rc_channel_value(self, channel, timeout=2): """wait for channel to hit value""" channel_field = "chan%u_raw" % channel @@ -5870,6 +5885,16 @@ class AutoTest(ABC): if value == m_value: return + def assert_rc_channel_value(self, channel, value): + channel_field = "chan%u_raw" % channel + + m_value = self.get_rc_channel_value(channel, timeout=1) + self.progress("RC_CHANNELS.%s=%u want=%u" % + (channel_field, m_value, value)) + if value != m_value: + raise NotAchievedException("Expected %s to be %u got %u" % + (channel, value, m_value)) + def wait_location(self, loc, accuracy=5.0,