Tools: autotest: Copter: add battery unhealthy prearm and failsafe test

This commit is contained in:
Iampete1 2024-07-11 00:11:16 +01:00 committed by Peter Barker
parent b75c62d267
commit 49e77718ac
1 changed files with 38 additions and 0 deletions

View File

@ -1115,6 +1115,43 @@ class AutoTestCopter(vehicle_test_suite.TestSuite):
self.progress("All Battery failsafe tests complete")
def BatteryMissing(self):
''' Test battery health pre-arm and missing failsafe'''
self.context_push()
# Should be good to arm with no changes
self.wait_ready_to_arm()
# Make monitor unhealthy, this should result in unhealthy prearm
self.set_parameters({
'BATT_VOLT_PIN': -1,
})
self.drain_mav()
# Battery should go unhealthy immediately
self.assert_prearm_failure("Battery 1 unhealthy", other_prearm_failures_fatal=False)
# Return monitor to health
self.context_pop()
self.context_push()
self.wait_ready_to_arm()
# take off and then trigger in flight
self.takeoff(10, mode="LOITER")
self.set_parameters({
'BATT_VOLT_PIN': -1,
})
# Should trigger missing failsafe
self.wait_statustext("Battery 1 is missing")
# Done, reset params and reboot to clear failsafe
self.land_and_disarm()
self.context_pop()
self.reboot_sitl()
def VibrationFailsafe(self):
'''Test Vibration Failsafe'''
self.context_push()
@ -10449,6 +10486,7 @@ class AutoTestCopter(vehicle_test_suite.TestSuite):
'''return list of all tests'''
ret = ([
self.BatteryFailsafe,
self.BatteryMissing,
self.VibrationFailsafe,
self.EK3AccelBias,
self.StabilityPatch,