PID stands for proportional-integral-derivative controller, and is defined by this formula on the right, where e(t) is the error from setpoint at time t. If you don’t already know this, this is not the doc for you, and I recommend beginning learning about PID from online documentation (feedback loops are a very common tool in robotics theory) or WPI. Feedforward + PID
$u(t)=K_pe(t) + K_i\int_0^t{e(\tau)d\tau} + K_d\frac{de(t)}{dt}$
PID has three gains to worry about, $K_p$, $K_i$, and $K_d$. In FRC, you will (hopefully) never have to use $K_i$. If you feel the need to, then you likely forgot about or mistuned your feedforward gains and need to revist those. $K_i$ typically accounts for steady-state error, but all steady-state errors are resolved with feedforward, including static & viscous friction, back-emf, rotational inertia, and gravity.
Tuning raw PID is easy! Of course, if necessary, do this after tuning your feedforward, as you need accurate efforts that don’t depend on things that your feedforward would account for. For example, you want your pivot to act the same at any position, regardless of gravity pulling it down, which is why $K_g$ needs to be tuned first. Here are my personal tips on how to tune PID quickly:
<aside> 💡
You must do feedforward first for velocity control, as your $K_s$ and $K_v$ (and possibly $K_a$ if using a MotionMagic profile) are your main drivers for your control effort. PID is just used in velocity control to get to setpoint faster.
</aside>
Now wasn’t that easy?
Now, feedforward is really the beast that hides among all the gains. It’s less intuitive to understand than PID, so if you don’t understand it, make sure to read over the doc Feedforward + PID . Note that the doc talks about