autotest: simplify AC_Avoidance_Proximity test

take advantage of new infrastructure
This commit is contained in:
Peter Barker 2024-06-06 17:39:41 +10:00 committed by Peter Barker
parent c783f632c1
commit eaf5767bfa

View File

@ -7386,33 +7386,28 @@ class AutoTestCopter(vehicle_test_suite.TestSuite):
def AC_Avoidance_Proximity(self): def AC_Avoidance_Proximity(self):
'''Test proximity avoidance slide behaviour''' '''Test proximity avoidance slide behaviour'''
self.context_push() self.context_push()
ex = None
try:
self.load_fence("copter-avoidance-fence.txt")
self.set_parameters({
"FENCE_ENABLE": 1,
"PRX1_TYPE": 10,
"PRX_LOG_RAW": 1,
"RC10_OPTION": 40, # proximity-enable
})
self.reboot_sitl()
self.progress("Enabling proximity")
self.set_rc(10, 2000)
self.check_avoidance_corners()
self.assert_current_onboard_log_contains_message("PRX") self.load_fence("copter-avoidance-fence.txt")
self.assert_current_onboard_log_contains_message("PRXR") self.set_parameters({
"FENCE_ENABLE": 1,
"PRX1_TYPE": 10,
"PRX_LOG_RAW": 1,
"RC10_OPTION": 40, # proximity-enable
})
self.reboot_sitl()
self.progress("Enabling proximity")
self.set_rc(10, 2000)
self.check_avoidance_corners()
self.assert_current_onboard_log_contains_message("PRX")
self.assert_current_onboard_log_contains_message("PRXR")
except Exception as e:
self.print_exception_caught(e)
ex = e
self.context_pop() self.context_pop()
self.clear_fence()
self.disarm_vehicle(force=True) self.disarm_vehicle(force=True)
self.reboot_sitl() self.reboot_sitl()
if ex is not None:
raise ex
def ProximitySensors(self): def ProximitySensors(self):
'''ensure proximity sensors return appropriate data''' '''ensure proximity sensors return appropriate data'''