Skip to content

Commit

Permalink
Update PID tuning.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kestrel253 committed Feb 6, 2016
1 parent 360fd1a commit 6c88e3e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/PID tuning.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,13 @@ For PID Controllers MWREWRITE and LUX, this is an multiplier on overall stick se
### Yaw Rate

In PID Controllers MWREWRITE and LUX, it acts as a stick sensitivity multiplier, as explained above.

### Filters

gyro_lpf sets the hardware gyro low pass filter value. if 0 or 256 the gyro uses the least hardware filtering available (256Hz) and the internal sampling rate is the fastest possible (8kHz) with the least possible delay. The lower the number the stronger the filtering. Stronger filtering reduces noise in the gyro signal before that data gets into the PID calculations. Stronger filtering adds delays that can be associated with wobble and reduced responsiveness. Filtering is needed because motor/frame noise can cause overheating of motors especially when amplified by Dterm in quads with low mass and fast braking ESCs. If 188 or lower are chosen, the gyro sampling is internally at 1kHz and delays are greater. Faster sampling is good because things are slightly more responsive but can cause aliasing noise. Setting to 188 allows syncing of the FC to the gyro at 1kHz (if gyro_sync is enabled and available in the code) which reduces aliasing a lot.

gyro_cut_hz is an IIR software low-pass filter that can be configured to any desired frequency. If set to a value above zero it is active. It works after the hardware filter on the gyro (in the FC code) and further reduces noise. The two filters in series have twice the cut rate of one alone. There's not a lot of sense running gyro_cut_hz at a value above gyro_lpf. if used, it is typically set about half the hardware filter rate to enhance the cut of higher frequencies before the PID calculations. Frequencies above 100Hz are of no interest to us from a flight control perspective - they can and should be removed from the signal before it gets to the PID calculation stage.

pterm_cut_hz is an IIR software low-pass filter that can be configured to any desired frequency. If enabled, it works after both the gyro_cut filters. It specifically filters only the P term data. Lower values can therefore specifically help remove noise in the P term part of the PID calculation. Blackbox recording is needed to determine what value works best on this filter. It is only really needed if you have P term noise despite the gyro filters, but typically it is needed with the commonly used relatively high gyro filter values.

dterm_cut_hz is an IIR software low-pass filter that can be configured to any desired frequency. It works after the gyro_cut filters and specifically filters only the D term data. D term data is frequency dependent, the higher the frequency, the greater the computed D term value. This filter is required if despite the gyro filtering there remains excessive D term noise. Typically it needs to be set quite low because D term noise is a major problem with typical IIR filters. If set too low the phase shift in D term reduces the effectiveness of D term in controlling stop wobble, so this value needs some care when varying it. Again blackbox recording is needed to properly optimise the value for this filter.

0 comments on commit 6c88e3e

Please sign in to comment.