autotest: anti-gravity test using THR_G_BOOST boost

This commit is contained in:
Andy Piper 2022-05-11 17:23:22 +01:00 committed by Andrew Tridgell
parent ad94c5cab1
commit d1b272fab7

View File

@ -5545,6 +5545,55 @@ class AutoTestCopter(AutoTest):
freqs.append(m.PkAvg)
return numpy.median(numpy.asarray(freqs)), len(freqs)
def ThrottleGainBoost(self):
"""Use PD and Angle P boost for anti-gravity."""
# basic gyro sample rate test
self.progress("Flying with Throttle-Gain Boost")
self.context_push()
ex = None
try:
# magic tridge EKF type that dramatically speeds up the test
self.set_parameters({
"AHRS_EKF_TYPE": 10,
"EK2_ENABLE": 0,
"EK3_ENABLE": 0,
"INS_FAST_SAMPLE": 0,
"LOG_BITMASK": 959,
"LOG_DISARMED": 0,
"ATC_THR_G_BOOST": 5.0,
})
self.reboot_sitl()
self.takeoff(10, mode="ALT_HOLD")
hover_time = 15
self.progress("Hovering for %u seconds" % hover_time)
tstart = self.get_sim_time()
while self.get_sim_time_cached() < tstart + hover_time:
self.mav.recv_match(type='ATTITUDE', blocking=True)
# fly fast forrest!
self.set_rc(3, 1900)
self.set_rc(2, 1200)
self.wait_groundspeed(5, 1000)
self.set_rc(3, 1500)
self.set_rc(2, 1500)
self.do_RTL()
except Exception as e:
self.print_exception_caught(e)
ex = e
self.context_pop()
# must reboot after we move away from EKF type 10 to EKF2 or EKF3
self.reboot_sitl()
if ex is not None:
raise ex
def test_gyro_fft_harmonic(self, averaging):
"""Use dynamic harmonic notch to control motor noise with harmonic matching of the first harmonic."""
# basic gyro sample rate test
@ -9557,7 +9606,8 @@ class AutoTestCopter(AutoTest):
self.GuidedEKFLaneChange,
self.Sprayer,
self.EK3_RNG_USE_HGT,
self.TerrainDBPreArm
self.TerrainDBPreArm,
self.ThrottleGainBoost,
])
return ret