mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
autotest: Update tests for relay
This commit is contained in:
parent
3937e96738
commit
a45353b17f
@ -1124,9 +1124,12 @@ class AutoTestPlane(vehicle_test_suite.TestSuite):
|
|||||||
|
|
||||||
def TestRCRelay(self):
|
def TestRCRelay(self):
|
||||||
'''Test Relay RC Channel Option'''
|
'''Test Relay RC Channel Option'''
|
||||||
self.set_parameter("RC12_OPTION", 28) # Relay On/Off
|
self.set_parameters({
|
||||||
|
"RELAY1_FUNCTION": 1, # Enable relay as a standard relay pin
|
||||||
|
"RC12_OPTION": 28 # Relay On/Off
|
||||||
|
})
|
||||||
self.set_rc(12, 1000)
|
self.set_rc(12, 1000)
|
||||||
self.reboot_sitl() # needed for RC12_OPTION to take effect
|
self.reboot_sitl() # needed for RC12_OPTION and RELAY1_FUNCTION to take effect
|
||||||
|
|
||||||
off = self.get_parameter("SIM_PIN_MASK")
|
off = self.get_parameter("SIM_PIN_MASK")
|
||||||
if off:
|
if off:
|
||||||
|
@ -24,8 +24,8 @@ RC1_MAX 2000
|
|||||||
RC1_MIN 1000
|
RC1_MIN 1000
|
||||||
RC3_MAX 2000
|
RC3_MAX 2000
|
||||||
RC3_MIN 1000
|
RC3_MIN 1000
|
||||||
RELAY_PIN 1
|
RELAY1_PIN 1
|
||||||
RELAY_PIN2 2
|
RELAY2_PIN 2
|
||||||
SERVO1_MIN 1000
|
SERVO1_MIN 1000
|
||||||
SERVO1_MAX 2000
|
SERVO1_MAX 2000
|
||||||
SERVO3_MAX 2000
|
SERVO3_MAX 2000
|
||||||
|
@ -456,10 +456,7 @@ RCMAP_ROLL,1
|
|||||||
RCMAP_THROTTLE,3
|
RCMAP_THROTTLE,3
|
||||||
RCMAP_YAW,4
|
RCMAP_YAW,4
|
||||||
RELAY_DEFAULT,0
|
RELAY_DEFAULT,0
|
||||||
RELAY_PIN,13
|
RELAY1_PIN,13
|
||||||
RELAY_PIN2,-1
|
|
||||||
RELAY_PIN3,-1
|
|
||||||
RELAY_PIN4,-1
|
|
||||||
RLL_RATE_D,0.000000
|
RLL_RATE_D,0.000000
|
||||||
RLL_RATE_FF,0.255000
|
RLL_RATE_FF,0.255000
|
||||||
RLL_RATE_I,0.050000
|
RLL_RATE_I,0.050000
|
||||||
|
@ -568,6 +568,13 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
|
|||||||
'''Test ServoRelayEvents'''
|
'''Test ServoRelayEvents'''
|
||||||
for method in self.run_cmd, self.run_cmd_int:
|
for method in self.run_cmd, self.run_cmd_int:
|
||||||
self.context_push()
|
self.context_push()
|
||||||
|
|
||||||
|
self.set_parameters({
|
||||||
|
"RELAY1_FUNCTION": 1, # Enable relay 1 as a standard relay pin
|
||||||
|
"RELAY2_FUNCTION": 1, # Enable relay 2 as a standard relay pin
|
||||||
|
})
|
||||||
|
self.reboot_sitl() # Needed for relay functions to take effect
|
||||||
|
|
||||||
method(mavutil.mavlink.MAV_CMD_DO_SET_RELAY, p1=0, p2=0)
|
method(mavutil.mavlink.MAV_CMD_DO_SET_RELAY, p1=0, p2=0)
|
||||||
off = self.get_parameter("SIM_PIN_MASK")
|
off = self.get_parameter("SIM_PIN_MASK")
|
||||||
method(mavutil.mavlink.MAV_CMD_DO_SET_RELAY, p1=0, p2=1)
|
method(mavutil.mavlink.MAV_CMD_DO_SET_RELAY, p1=0, p2=1)
|
||||||
@ -602,8 +609,14 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
|
|||||||
"on": 0,
|
"on": 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
# add another servo:
|
# add another relay and ensure that it changes the "present field"
|
||||||
self.set_parameter("RELAY_PIN6", 14)
|
self.set_parameters({
|
||||||
|
"RELAY6_FUNCTION": 1, # Enable relay 6 as a standard relay pin
|
||||||
|
"RELAY6_PIN": 14, # Set pin number
|
||||||
|
})
|
||||||
|
self.reboot_sitl() # Needed for relay function to take effect
|
||||||
|
self.set_message_rate_hz("RELAY_STATUS", 10) # Need to re-request the message since reboot
|
||||||
|
|
||||||
self.assert_received_message_field_values('RELAY_STATUS', {
|
self.assert_received_message_field_values('RELAY_STATUS', {
|
||||||
"present": 35,
|
"present": 35,
|
||||||
"on": 0,
|
"on": 0,
|
||||||
@ -5352,7 +5365,8 @@ Brakes have negligible effect (with=%0.2fm without=%0.2fm delta=%0.2fm)
|
|||||||
self.context_collect("STATUSTEXT")
|
self.context_collect("STATUSTEXT")
|
||||||
self.set_parameters({
|
self.set_parameters({
|
||||||
"SCR_ENABLE": 1,
|
"SCR_ENABLE": 1,
|
||||||
"RELAY_PIN": 1,
|
"RELAY1_FUNCTION": 1,
|
||||||
|
"RELAY1_PIN": 1
|
||||||
})
|
})
|
||||||
self.install_example_script_context("RCIN_test.lua")
|
self.install_example_script_context("RCIN_test.lua")
|
||||||
self.reboot_sitl()
|
self.reboot_sitl()
|
||||||
|
Loading…
Reference in New Issue
Block a user