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 cc1728b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 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
10 changes: 5 additions & 5 deletions Tools/autotest/rover.py
Original file line number Diff line number Diff line change
Expand Up @@ -6864,10 +6864,10 @@ def MissionPolyEnabledPreArm(self):
]
)

self.assert_prearm_failure('vehicle outside fence', other_prearm_failures_fatal=False)
self.assert_prearm_failure('vehicle outside Polygon fence', other_prearm_failures_fatal=False)
self.reboot_sitl()

self.assert_prearm_failure('vehicle outside fence', other_prearm_failures_fatal=False, timeout=120)
self.assert_prearm_failure('vehicle outside Polygon fence', other_prearm_failures_fatal=False, timeout=120)

self.progress("Ensure we can arm when a polyfence fence is cleared when we've previously been in breach")
self.clear_fence()
Expand All @@ -6885,7 +6885,7 @@ def MissionPolyEnabledPreArm(self):
]
)
self.reboot_sitl()
self.assert_prearm_failure('vehicle outside fence', other_prearm_failures_fatal=False, timeout=120)
self.assert_prearm_failure('vehicle outside Polygon fence', other_prearm_failures_fatal=False, timeout=120)
self.clear_fence()
self.wait_ready_to_arm()

Expand All @@ -6901,11 +6901,11 @@ def MissionPolyEnabledPreArm(self):
]
]
)
self.assert_prearm_failure('vehicle outside fence', other_prearm_failures_fatal=False, timeout=120)
self.assert_prearm_failure('vehicle outside Polygon fence', other_prearm_failures_fatal=False, timeout=120)
self.set_parameter('FENCE_TYPE', 2)
self.wait_ready_to_arm()
self.set_parameter('FENCE_TYPE', 6)
self.assert_prearm_failure('vehicle outside fence', other_prearm_failures_fatal=False, timeout=120)
self.assert_prearm_failure('vehicle outside Polygon fence', other_prearm_failures_fatal=False, timeout=120)

def OpticalFlow(self):
'''lightly test OpticalFlow'''
Expand Down

0 comments on commit cc1728b

Please sign in to comment.