Skip to content

Commit

Permalink
autotest: simplify AC_Avoidance_Proximity test
Browse files Browse the repository at this point in the history
take advantage of new infrastructure
  • Loading branch information
peterbarker committed Jun 6, 2024
1 parent 3968652 commit e69c348
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7386,33 +7386,28 @@ def OBSTACLE_DISTANCE_3D(self):

def AC_Avoidance_Proximity(self):
'''Test proximity avoidance slide behaviour'''

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.assert_current_onboard_log_contains_message("PRXR")
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.assert_current_onboard_log_contains_message("PRXR")

except Exception as e:
self.print_exception_caught(e)
ex = e
self.context_pop()
self.clear_fence()

self.disarm_vehicle(force=True)
self.reboot_sitl()
if ex is not None:
raise ex

def ProximitySensors(self):
'''ensure proximity sensors return appropriate data'''
Expand Down

0 comments on commit e69c348

Please sign in to comment.