Skip to content

FilterReview: add auto fit for the first notch - #363

Draft
j-w9 wants to merge 1 commit into
ArduPilot:mainfrom
j-w9:filter-auto-fit
Draft

j-w9 wants to merge 1 commit into
ArduPilot:mainfrom
j-w9:filter-auto-fit

Conversation

@j-w9

@j-w9 j-w9 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Adds an "Auto fit" button to the first notch that sets it up from the log: ESC telemetry first, then per motor throttle (then average throttle), with peak detection to verify the tracking and the noise floor setting the attenuation.

Method: the pre-filter spectrum of each FFT window in the analysis time is resampled against the tracked frequency and averaged. Noise that follows the motors adds up into peaks at multiples of the tracked frequency, and noise that doesn't is spread out.

  • ESC is rejected if the largest peak is well away from a whole multiple of the ESC frequency, with a message to check the motor poles.
  • Harmonics whose peak is at least 6 dB above the local noise floor are enabled. ATT is how far the largest one stands out, limited to 10–50 dB.
  • Rules of thumb: ESC FREQ is 80% of the lowest motor frequency seen. For throttle, REF is the mean throttle and FREQ is fitted from the peaks, and FM_RAT is lowered to keep tracking below REF. BW is FREQ/2. OPTS is set to multi-source with a single notch per harmonic.

These are all in one block at the top of AutoFit.js and are the main thing I'd like your view on.

Tested on six batch-logged copter logs, with estimated noise above 30 Hz:

  • On the four flights where it picked ESC, the fit matched or beat the existing hand-set notch.
  • On a ground run, it reports the ESC frequency mismatch and that throttle is zero.
  • Synthetic spectra with known peaks recover the harmonics and attenuation, and a 14/12 pole error is caught.

Known limitation: a fixed resonance that sits near a motor harmonic in hover can be picked up as a harmonic.

Sets up the first harmonic notch from the log. The tracking source is ESC
telemetry if logged, then per motor throttle, then average throttle.

The pre-filter spectrum of each FFT window is resampled against the
tracked frequency and averaged, so noise that follows the motors forms
peaks at multiples of the tracked frequency. This verifies the tracking:
ESC is rejected if the largest peak is well away from a whole multiple of
the motor frequency, which points to wrong motor poles. Harmonics whose
peaks stand out from the local noise floor are notched, and the
attenuation is set from how far the largest of them stands out.

Frequency and bandwidth use rules of thumb, collected at the top of
AutoFit.js.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant