TauLabs/TauLabs — pull request #1280 by peabody124 (2014-09-13 20:36:34+00:00)
Title: Throttle pid attenuation

Calculate the desired PID suppression based on throttle
settings. This is similar to an algorithm used by MultiWii
and empirically works well. It creates a piecewise linear
suppression of PIDs versus throttle.

i.e. the Kp will look like this:

------------- <-- rateKp
\
\
\ <-- rateKp * (1 - attenuation / 100.0)
^
|
threshold

For safety the maximum allow attenuation the firmware will pay
attention to is 90%

This is a refactoring of #1214 to put the PID calculation into a single function instead of
moving it into pid_apply itself. The benefit of this approach is that we can more flexibly
apply attenuation schemes. Hopefully in the future this can be optimally determined
based on the results of autotuning.