diff --git a/Tools/autotest/arducopter.py b/Tools/autotest/arducopter.py index 43101a94f7..77898e56bd 100644 --- a/Tools/autotest/arducopter.py +++ b/Tools/autotest/arducopter.py @@ -1044,6 +1044,34 @@ class AutoTestCopter(AutoTest): self.progress("All Battery failsafe tests complete") + # Tests the vibration failsafe + def test_vibration_failsafe(self): + self.context_push() + + # takeoff in Loiter to 20m + self.takeoff(20, mode="LOITER") + + # simulate accel bias caused by high vibration + self.set_parameters({ + 'SIM_ACC1_BIAS_Z': 2, + 'SIM_ACC2_BIAS_Z': 2, + 'SIM_ACC3_BIAS_Z': 2, + }) + + # wait for Vibration compensation warning and change to LAND mode + self.wait_statustext("Vibration compensation ON", timeout=30) + self.wait_mode("LAND") + + # check vehicle descends to 2m or less within 30 seconds + self.wait_altitude(-5, 2, timeout=30, relative=True) + + # force disarm of vehicle (it will likely not automatically disarm) + self.disarm_vehicle(force=True) + + # revert simulated accel bias and reboot to restore EKF health + self.context_pop() + self.reboot_sitl() + # fly_stability_patch - fly south, then hold loiter within 5m # position and altitude and reduce 1 motor to 60% efficiency def fly_stability_patch(self, @@ -7009,6 +7037,10 @@ class AutoTestCopter(AutoTest): "Fly Battery Failsafe", self.fly_battery_failsafe), # 164s + ("VibrationFailsafe", + "Test Vibration Failsafe", + self.test_vibration_failsafe), + ("StabilityPatch", "Fly stability patch", lambda: self.fly_stability_patch(30)), # 17s