Skip to content

feat(plots): gyro filter and rate controller analysis - #349

Draft
isak-aslund wants to merge 2 commits into
PX4:mainfrom
isak-aslund:feat/gyro-filter-analysis
Draft

isak-aslund wants to merge 2 commits into
PX4:mainfrom
isak-aslund:feat/gyro-filter-analysis

Conversation

@isak-aslund

Copy link
Copy Markdown

Flight Review doesn't show where PX4's dynamic notch filters were during a flight, the gyro before and after filtering side by side, or the filter delay, and the PID page step response often disagrees with the rate plot. This adds that, for RFC PX4/PX4-Autopilot#29065. It uses the new gyro_filter_status topic from PX4/PX4-Autopilot#29064; for older logs the notch positions are rebuilt from esc_status, sensor_gyro_fft and the parameters.

Existing plots keep their names and place:

  • Angular velocity Power Spectral Density: buttons for the gyro before or after filtering (same colour scale), and the notch filters drawn over time, per harmonic or per motor.
  • New: gyro noise per axis before and after filtering with the in-flight notch ranges, filter magnitude and delay of the gyro and D-term paths (delay at 20 Hz in the legend), and gyro and accelerometer noise vs throttle.
  • PID analysis: the step response per axis is estimated from the averaged cross spectrum of setpoint and response over the whole flight, with a button to show each window's estimate. Thrust in the rate plots gets its own 0–100 % axis. The unused PID-Analyzer module is removed.
  • Fixes the raw FIFO gyro being plotted twice.

Tested on PX4 SITL logs (SIH quadrotor with simulated motor vibration and per-axis excitation) and on older logs without the new topic; pylint 10/10. The step response estimate matches a simulated loop with a known response to within 0.033. This is one commit for review of the whole idea; it can be split into smaller PRs.

Spectrogram before filtering, with notches, after filtering
Gyro noise before and after filtering
Step response


Created on behalf of Isak Åslund with Claude (Claude Code): plots, response estimator, SITL testing and write-up.

Main page: the angular velocity spectrogram gets buttons for the gyro before and after filtering and draws the dynamic notch filters over time (per harmonic or per motor). New plots: gyro noise per axis before and after filtering with the notch ranges, filter magnitude and delay of the gyro and D-term paths, and gyro and accelerometer noise vs throttle. The notch positions come from gyro_filter_status, or are rebuilt from esc_status, sensor_gyro_fft and the parameters for older logs.

PID analysis page: the step response is estimated from the averaged cross spectrum of setpoint and response over the whole flight, with the estimate of each window on request. Thrust moves to its own axis. Removes the PID-Analyzer module.

Also fixes the raw FIFO gyro being plotted twice.
gyro_filter_status only holds the notch frequencies; the cutoffs, notch widths and static notches come from the parameters, the gyro and its sample rate from sensor_selection and vehicle_imu_status.
@dakejahl
dakejahl requested a review from AlexKlimaj October 9, 2026 23:49
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.

2 participants