mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 00:28:30 -04:00
autotest: add test for THR_FAILSAFE==2 and throttle output
This commit is contained in:
parent
de173707bc
commit
ef9341f8a9
@ -905,7 +905,7 @@ class AutoTestPlane(AutoTest):
|
|||||||
raise NotAchievedException("Bad absalt (want=%f vs got=%f)" % (original_alt+30, x.alt_msl))
|
raise NotAchievedException("Bad absalt (want=%f vs got=%f)" % (original_alt+30, x.alt_msl))
|
||||||
self.fly_home_land_and_disarm()
|
self.fly_home_land_and_disarm()
|
||||||
|
|
||||||
def test_throttle_failsafe(self):
|
def ThrottleFailsafe(self):
|
||||||
self.change_mode('MANUAL')
|
self.change_mode('MANUAL')
|
||||||
m = self.mav.recv_match(type='SYS_STATUS', blocking=True)
|
m = self.mav.recv_match(type='SYS_STATUS', blocking=True)
|
||||||
receiver_bit = mavutil.mavlink.MAV_SYS_STATUS_SENSOR_RC_RECEIVER
|
receiver_bit = mavutil.mavlink.MAV_SYS_STATUS_SENSOR_RC_RECEIVER
|
||||||
@ -3538,7 +3538,7 @@ function'''
|
|||||||
|
|
||||||
("ThrottleFailsafe",
|
("ThrottleFailsafe",
|
||||||
"Fly throttle failsafe",
|
"Fly throttle failsafe",
|
||||||
self.test_throttle_failsafe),
|
self.ThrottleFailsafe),
|
||||||
|
|
||||||
("NeedEKFToArm",
|
("NeedEKFToArm",
|
||||||
"Ensure we need EKF to be healthy to arm",
|
"Ensure we need EKF to be healthy to arm",
|
||||||
|
@ -5838,6 +5838,21 @@ class AutoTest(ABC):
|
|||||||
if comparator(m_value, value):
|
if comparator(m_value, value):
|
||||||
return m_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):
|
def get_rc_channel_value(self, channel, timeout=2):
|
||||||
"""wait for channel to hit value"""
|
"""wait for channel to hit value"""
|
||||||
channel_field = "chan%u_raw" % channel
|
channel_field = "chan%u_raw" % channel
|
||||||
@ -5870,6 +5885,16 @@ class AutoTest(ABC):
|
|||||||
if value == m_value:
|
if value == m_value:
|
||||||
return
|
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,
|
def wait_location(self,
|
||||||
loc,
|
loc,
|
||||||
accuracy=5.0,
|
accuracy=5.0,
|
||||||
|
Loading…
Reference in New Issue
Block a user