Skip to content

Commit

Permalink
autotest: test for scripted notches
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per committed Nov 30, 2024
1 parent a9f036e commit 07910ac
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions Tools/autotest/arducopter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6405,6 +6405,43 @@ def StaticNotches(self):
})
self.reboot_sitl()

self.hover_and_check_matched_frequency_with_fft(dblevel=-15, minhz=20, maxhz=350, reverse=True, instance=2)

def StaticScriptedNotches(self):
"""Use a scripted static harmonic notch to control motor noise."""
self.progress("Flying with Scripted Static notches")
self.set_parameters({
"AHRS_EKF_TYPE": 10,
"INS_LOG_BAT_MASK": 3,
"INS_LOG_BAT_OPT": 4,
"INS_GYRO_FILTER": 100, # set the gyro filter high so we can observe behaviour
"LOG_BITMASK": 65535,
"LOG_DISARMED": 0,
"SIM_VIB_FREQ_X": 120, # roll
"SIM_VIB_FREQ_Y": 120, # pitch
"SIM_VIB_FREQ_Z": 120, # yaw
"SIM_VIB_MOT_MULT": 0,
"SIM_GYR1_RND": 5,
"INS_HNTCH_ENABLE": 1,
#"INS_HNTCH_FREQ": 120,
"INS_HNTCH_REF": 1.0,
"INS_HNTCH_HMNCS": 1, # first and second harmonic
"INS_HNTCH_ATT": 50,
"INS_HNTCH_BW": 40,
"INS_HNTCH_MODE": 6, # static notch
"SCR_ENABLE": 1,
})

# install copter-posoffset script
self.install_test_script_context('static_notches.lua')
self.reboot_sitl()

self.set_parameters({
"SNOTCH1_FREQ": 120,
"SNOTCH2_FREQ": 240,
})


self.hover_and_check_matched_frequency_with_fft(dblevel=-15, minhz=20, maxhz=350, reverse=True, instance=2)

def ThrottleGainBoost(self):
Expand Down Expand Up @@ -12177,6 +12214,7 @@ def tests2b(self): # this block currently around 9.5mins here
self.DynamicRpmNotches, # Do not add attempts to this - failure is sign of a bug
self.PIDNotches,
self.StaticNotches,
self.StaticScriptedNotches,
self.RefindGPS,
Test(self.GyroFFT, attempts=1, speedup=8),
Test(self.GyroFFTHarmonic, attempts=4, speedup=8),
Expand Down

0 comments on commit 07910ac

Please sign in to comment.