@@ -1675,16 +1675,60 @@ def FenceFloorEnabledLanding(self):
1675
1675
self .set_rc (3 , 1800 )
1676
1676
1677
1677
self .wait_mode ('RTL' , timeout = 120 )
1678
+
1678
1679
self .wait_landed_and_disarmed ()
1679
1680
self .assert_fence_enabled ()
1680
1681
1681
- # Assert fence is not healthy
1682
+ # Assert fence is healthy now that we have landed disarmed
1682
1683
self .assert_sensor_state (fence_bit , healthy = False )
1683
1684
1684
1685
# Disable the fence using mavlink command to ensure cleaned up SITL state
1685
1686
self .do_fence_disable ()
1686
1687
self .assert_fence_disabled ()
1687
1688
1689
+ def FenceFloorAutoDisableLanding (self ):
1690
+ """Ensures we can initiate and complete an RTL while the fence is
1691
+ enabled.
1692
+ """
1693
+ fence_bit = mavutil .mavlink .MAV_SYS_STATUS_GEOFENCE
1694
+
1695
+ self .progress ("Test Landing while fence floor enabled" )
1696
+ self .set_parameters ({
1697
+ "AVOID_ENABLE" : 0 ,
1698
+ "FENCE_TYPE" : 15 ,
1699
+ "FENCE_ALT_MIN" : 10 ,
1700
+ "FENCE_ALT_MAX" : 20 ,
1701
+ "FENCE_OPTIONS" : 4 ,
1702
+ })
1703
+
1704
+ self .change_mode ("GUIDED" )
1705
+ self .wait_ready_to_arm ()
1706
+ self .arm_vehicle ()
1707
+ self .user_takeoff (alt_min = 15 )
1708
+
1709
+ # Check fence is enabled
1710
+ self .do_fence_enable ()
1711
+ self .assert_fence_enabled ()
1712
+
1713
+ # Change to RC controlled mode
1714
+ self .change_mode ('LOITER' )
1715
+
1716
+ self .set_rc (3 , 1800 )
1717
+
1718
+ self .wait_mode ('RTL' , timeout = 120 )
1719
+ # Assert fence is not healthy now that we are in RTL
1720
+ self .assert_sensor_state (fence_bit , healthy = False )
1721
+
1722
+ self .wait_landed_and_disarmed ()
1723
+ self .assert_fence_enabled ()
1724
+
1725
+ # Assert fence is healthy now that we have landed disarmed
1726
+ self .assert_sensor_state (fence_bit , healthy = True )
1727
+
1728
+ # Disable the fence using mavlink command to ensure cleaned up SITL state
1729
+ self .do_fence_disable ()
1730
+ self .assert_fence_disabled ()
1731
+
1688
1732
def GPSGlitchLoiter (self , timeout = 30 , max_distance = 20 ):
1689
1733
"""fly_gps_glitch_loiter_test. Fly south east in loiter and test
1690
1734
reaction to gps glitch."""
@@ -10056,6 +10100,7 @@ def tests1d(self):
10056
10100
self .MaxAltFence ,
10057
10101
self .MinAltFence ,
10058
10102
self .FenceFloorEnabledLanding ,
10103
+ self .FenceFloorAutoDisableLanding ,
10059
10104
self .AutoTuneSwitch ,
10060
10105
self .GPSGlitchLoiter ,
10061
10106
self .GPSGlitchLoiter2 ,
0 commit comments