Skip to content

Commit

Permalink
Tools: add Copter flight option for requiring position to arm
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbarker committed Jun 25, 2024
1 parent 180484e commit 6bb0709
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11535,6 +11535,39 @@ def GripperReleaseOnThrustLoss(self):
self.do_RTL()
self.reboot_sitl()

def assert_home_position_not_set(self):
try:
self.poll_home_position()
except NotAchievedException:
return

# if home.lng != 0: etc

raise NotAchievedException("Home is set when it shouldn't be")

def REQUIRE_POSITION_FOR_ARMING(self):
'''check FlightOption::REQUIRE_POSITION_FOR_ARMING works'''
self.context_push()
self.set_parameters({
"SIM_GPS_NUMSATS": 3, # EKF does not like < 6
})
self.reboot_sitl()
self.change_mode('STABILIZE')
self.wait_prearm_sys_status_healthy()
self.assert_home_position_not_set()
self.arm_vehicle()
self.disarm_vehicle()
self.change_mode('LOITER')
self.assert_prearm_failure("waiting for home", other_prearm_failures_fatal=False)

self.change_mode('STABILIZE')
self.set_parameters({
"FLIGHT_OPTIONS": 8,
})
self.assert_prearm_failure("Need Position Estimate", other_prearm_failures_fatal=False)
self.context_pop()
self.reboot_sitl()

def tests2b(self): # this block currently around 9.5mins here
'''return list of all tests'''
ret = ([
Expand Down Expand Up @@ -11626,6 +11659,7 @@ def tests2b(self): # this block currently around 9.5mins here
self.GuidedWeatherVane,
self.Clamp,
self.GripperReleaseOnThrustLoss,
self.REQUIRE_POSITION_FOR_ARMING,
])
return ret

Expand Down

0 comments on commit 6bb0709

Please sign in to comment.