MAVLINKHUD

Overview

The FFT parameter group configures the In-Flight Fast Fourier Transform analysis engine. This is an advanced feature that allows the autopilot to listen to the vibration of the motors in real-time to identify precise noise frequencies.

This data is used to drive the Harmonic Notch Filter (INS_HNTCH_), which dynamically "tunes" its suppression center to match the motor RPM, effectively erasing vibration before it can destabilize the PID controllers.

Key Concepts

1. Dynamic Noise Tracking

Unlike a static low-pass filter (which creates delay), the FFT engine tracks the peak noise frequency as the pilot changes throttle. This allows for very high-performance tunes even on noisy airframes.

2. Frequency Range (FFT_MINHZ / FFT_MAXHZ)

Tells the engine where to look for noise.

  • Default: Usually 80-600Hz.
  • Large Drones: Look lower (40-150Hz).
  • Racer Drones: Look higher (150-1000Hz).

3. Sampling Mode (FFT_SAMPLE_MODE)

Controls how the data is pulled from the IMUs.

  • 0: Process all IMU data (CPU intensive).
  • 1: Process a subset of data (recommended for F4/F7).

Parameter Breakdown

  • FFT_ENABLE: Master switch.
  • FFT_WINDOW_SIZE: Analysis buffer size (larger = more accurate but more delay).
  • FFT_NUM_FRAMES: How many windows to average (reduces jitter).
  • FFT_SNR_REF: Signal-to-Noise ratio threshold to consider a peak valid.

Integration Guide

Setting up Dynamic Filtering

  1. Requirement: A fast processor (F7 or H7) is highly recommended.
  2. Enable: Set FFT_ENABLE = 1.
  3. Monitor: Perform a test flight. Check the FTN1 and FTN2 log messages.
  4. Filter: Once the FFT is tracking motor noise accurately, set INS_HNTCH_MODE = 4 (FFT) to use this data for the notch filter.

Developer Notes

  • Library: libraries/AP_InertialSensor/AP_InertialSensor_HarmonicNotch.cpp.
  • Backend: Uses the KISS FFT library or CMSIS-DSP on ARM processors.

FFT_ATT_REF

dB
Default 15
Range 0 100

FFT attenuation for bandwidth calculation (FFT_ATT_REF)

Description

Specifies the power drop (in dB) from the center frequency used to define the boundaries of a noise peak, determining its bandwidth.

FFT_BW_HOVER

Hz
Default 20
Range 0 200

FFT learned bandwidth at hover (FFT_BW_HOVER)

Description

Records the typical width of the motor vibration peak during stable hover, used to configure the "Q" factor of the dynamic notch filter.

FFT_ENABLE

Default 0
Range 0 1

Enable Gyro FFT analyser (FFT_ENABLE)

Description

Master switch for the Gyro FFT module. When enabled, the autopilot performs continuous frequency analysis of gyro noise, allowing for dynamic filtering of motor vibrations via the harmonic notch filter.

Tuning & Behavior

  • Default Value: 0 (Disabled)
  • Requires reboot to take effect.
  • Highly recommended for modern multicopters to improve flight performance.

FFT_FREQ_HOVER

Hz
Default 80.0
Range 0 250

FFT learned hover frequency (FFT_FREQ_HOVER)

Description

This value is automatically populated by the flight controller as it identifies the primary motor noise frequency while hovering. It serves as a baseline for the harmonic notch filter.

FFT_HMNC_FIT

%
Default 10
Range 0 100

FFT harmonic fit threshold (FFT_HMNC_FIT)

Description

Advanced setting used to group multiple detected frequencies as harmonics of a single fundamental motor frequency. This improves the reliability of the dynamic notch filter by ensuring it tracks the core vibration source.

Tuning & Behavior

  • Default Value: 10 %
  • A value of 0 disables harmonic matching.

FFT_HMNC_PEAK

Default 0
Range 0 5

FFT harmonic peak target (FFT_HMNC_PEAK)

Description

Specifies the strategy for selecting which vibration peak the FFT should track.

  • 0: Auto (Recommended)
  • 1: Highest energy peak
  • 4: Roll-Axis only
  • 5: Pitch-Axis only

FFT_MAXHZ

Hz
Default 450
Range 20 495

Maximum Frequency (FFT_MAXHZ)

Description

Defines the highest frequency the FFT engine will monitor. Typically set based on the maximum expected motor RPM.

FFT_MINHZ

Hz
Default 50
Range 20 400

Minimum Frequency (FFT_MINHZ)

Description

Defines the lowest frequency the FFT engine will monitor. This should be set slightly below the expected idle RPM of your motors (converted to Hz).

FFT_NUM_FRAMES

Default 0
Range 0 8

FFT output averaging (FFT_NUM_FRAMES)

Description

Smoothing factor for the FFT output. Averaging multiple frames reduces "jitter" in the tracked frequency but adds a small amount of latency to the filter's response.

  • 0: No averaging (Fastest)

FFT_OPTIONS

Default 0

FFT options (FFT_OPTIONS)

Description

Bitmask for advanced FFT behaviors.

  • Bit 0: Enable post-filter FFT (Analyze noise after software filters)
  • Bit 1: Check motor noise (Use ESC RPM as a reference)

FFT_SAMPLE_MODE

Default 0
Range 0 4

FFT Sample Mode (FFT_SAMPLE_MODE)

Description

Defines the source and rate of gyro data input to the FFT engine.

  • 0: Gyro rate (Standard)
  • 1: Fast loop rate
  • Requires reboot to take effect.

FFT_SNR_REF

dB
Default 25.0
Range 0.0 100.0

FFT SNR reference threshold (FFT_SNR_REF)

Description

Determines how prominent a vibration frequency must be above the background noise floor to be considered a "peak" and targeted by a filter.

FFT_THR_REF

Default 0.35
Range 0.01 0.9

FFT learned thrust reference (FFT_THR_REF)

Description

The throttle value (0.0 to 1.0) at which the aircraft was hovering when FFT_FREQ_HOVER was identified. This is used to scale the filter frequency as throttle changes.

FFT_WINDOW_OLAP

Default 0.5
Range 0 0.9

FFT window overlap (FFT_WINDOW_OLAP)

Description

Controls how much data from the previous FFT window is reused in the next calculation. A higher overlap (e.g., 0.75) results in smoother tracking of noise peaks.

FFT_WINDOW_SIZE

Default 32
Range 32 1024

FFT window size (FFT_WINDOW_SIZE)

Description

Determines the balance between frequency resolution and time resolution.

  • Larger windows (e.g., 128, 256) provide more precise frequency identification but have higher latency and CPU usage.
  • Smaller windows (e.g., 32, 64) react faster to changing noise but are less precise.