UAV Tech Pid Tuning - trunglp/PA-Readme GitHub Wiki

THE BASIC 4:

Step #1:

– Set your Filters: Do a blackbox log with "set debug_mode=gyro_scaled" pasted in the CLI. Make sure to save with the “save” command after pasting the above. Just fly the Defaults. Make sure to fly it hard! Full throttle and hard moves. It may not fly the best depending on if the Defaults work for your rig or not, but that's not the point. Do NOT hit stuff and avoid any ground bouncing at the beginning or ending of the flight (not critical, but can throw analytical tools off if not trimmed out).

To set your filters see:

https://www.youtube.com/playlist?list=PLcYNkvInloJGMXvYQOaTO2Wtqqx06FEX5

In general, you want to use Gyro filters to crush out any motor peaks of high frequency vibrations (“noise”). Then use the D-term filtering to tame the D-term property of doubling gain response to noise as the noise doubles in frequency. Meaning, higher frequency noise (100hz+) drives the D-term to go crazy, resulting in vibrations in smooth flight or HOT motors.

Before leaving this step, it is critical to have a filter setup that gives you the least amount of Phase Delay possible on your rig based on the raw noise level of your craft. Hopefully the above videos, specifically “Betaflight 4.0 Filter Strategy”, can give you a sense of what that looks like when you do a spectrum on the filtered Gyro traces

Step #2:

Tune the PID Controller: Paste the below into the CLI. This will turn off all the BetaFlight advance PID controller features (features to push the PID controller beyond basic limitations). Once pasted, do a flight with lots of flips and rolls (Line-of-Sightor FPV) and keep increasing D-gains (or lower P-gains) until you do NOT have ANY bounce back after a sharp (full stick) flip or roll.Keep D-gains in the 30’s or lower. If you keep raising D-gains and are at the upper 30’s values and still have bounce back, switch to lowering your P-gains instead. CLI commands to paste and save before completing Step #2:

#PID Gains Settings

set vbat_pid_gain = ON
set anti_gravity_gain = 10000
set f_pitch = 0
set f_roll = 0
set f_yaw = 0
set d_min_pitch = 0
set d_min_roll = 0

#PID Controller Settings

set feedforward_transition = 0
set abs_control_gain = 0
set use_integrated_yaw = OFF
set iterm_relax_type = GYRO
set iterm_relax_cutoff = 11