Skip to content

Commit

Permalink
autotest: test that vehicle can be landed manually after descending b…
Browse files Browse the repository at this point in the history
…elow fence floor
  • Loading branch information
andyp1per committed Jun 22, 2024
1 parent f2268c7 commit aad02a1
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1476,7 +1476,7 @@ def HorizontalFence(self, timeout=180):
self.load_fence("fence-in-middle-of-nowhere.txt")

self.delay_sim_time(5) # let fence check run so it loads-from-eeprom
self.assert_prearm_failure("vehicle outside fence")
self.assert_prearm_failure("vehicle outside Polygon fence")
self.progress("Failed to arm outside fence (good!)")
self.clear_fence()
self.delay_sim_time(5) # let fence breach clear
Expand All @@ -1486,7 +1486,7 @@ def HorizontalFence(self, timeout=180):
self.start_subtest("ensure we can't arm with bad radius")
self.context_push()
self.set_parameter("FENCE_RADIUS", -1)
self.assert_prearm_failure("Invalid FENCE_RADIUS value")
self.assert_prearm_failure("Invalid Circle FENCE_RADIUS value")
self.context_pop()
self.progress("Failed to arm with bad radius")
self.drain_mav()
Expand Down Expand Up @@ -1704,14 +1704,14 @@ def FenceFloorEnabledLanding(self):
"AVOID_ENABLE": 0,
"FENCE_ENABLE" : 1,
"FENCE_TYPE": 15,
"FENCE_ALT_MIN": 10,
"FENCE_ALT_MAX": 20,
"FENCE_ALT_MIN": 20,
"FENCE_ALT_MAX": 30,
})

self.change_mode("GUIDED")
self.wait_ready_to_arm()
self.arm_vehicle()
self.user_takeoff(alt_min=15)
self.user_takeoff(alt_min=25)

# Check fence is enabled
self.do_fence_enable()
Expand All @@ -1723,8 +1723,19 @@ def FenceFloorEnabledLanding(self):
self.set_rc(3, 1800)

self.wait_mode('RTL', timeout=120)
# center throttle
self.set_rc(3, 1500)

self.wait_landed_and_disarmed()
# wait until we are below the fence floor and re-enter loiter
self.wait_altitude(5, 15, relative=True)
self.change_mode('LOITER')
# wait for manual recovery to expire
self.delay_sim_time(15)

# lower throttle and try and land
self.set_rc(3, 1300)
self.wait_altitude(0, 2, relative=True)
self.wait_disarmed()
self.assert_fence_enabled()

# Assert fence is not healthy since it was enabled manually
Expand Down

0 comments on commit aad02a1

Please sign in to comment.