A Methodical PID Tuning Process
A repeatable, safe procedure for tuning kP, kI, and kD instead of guessing.
Sign in to track progress, earn XP, and save lessons.
Random guessing wastes time and breaks mechanisms. Use a structured process and live telemetry.
Set up to see what you are doing
Before touching gains, plot the setpoint and the measurement together on AdvantageScope, Glass, or Shuffleboard. You cannot tune what you cannot see. Make the gains editable live (e.g., via a tunable number) so you can adjust without redeploying.
A safe starting procedure
Start with all gains at zero, then:
- Tune kP first. Raise kP until the mechanism reaches the setpoint reasonably quickly. Keep increasing until you see sustained oscillation, then back off to roughly half that value.
- Add kD. Increase kD to damp the overshoot and oscillation from kP. kD makes the approach smoother but too much causes jitter (it amplifies sensor noise) or sluggishness.
- Add kI last, sparingly. Only if a persistent steady-state error remains that kP/feedforward cannot remove. Use a small value and consider
setIZone()so integral only acts when you are already close. For most velocity/position control, a good feedforward removes the need for kI entirely.
What good tuning looks like
You want a fast rise to the setpoint, little or no overshoot, and a quick, stable settle. A small overshoot that settles fast is usually better than a slow, creeping approach.
Practical cautions
- Tune under realistic load. A flywheel with no game piece behaves differently than one shooting; an elevator behaves differently with and without an arm extended.
- Mind units. If your error is in meters but you expected encoder ticks, your kP will be wildly off. Always convert sensor output to real units first.
- Re-tune after mechanical changes. New gear ratios, belts, or weight change the dynamics.
- Combine with feedforward. PID is best at correcting error, not predicting motion. The next lesson shows how feedforward does the heavy lifting so PID only handles the leftover error.
Keep notes of the gains that work — and the units they assume — in your code or build log so they survive the season.
Key takeaways
- Always plot setpoint vs. measurement and make gains live-editable before tuning.
- Tune kP first (to half the oscillation point), then kD to damp, then kI sparingly only for steady-state error.
- Tune under realistic load and correct units; re-tune after any mechanical change.
Lesson quiz
RequiredAnswer all 3 questions correctly to complete this lesson.
1.When tuning a PID controller methodically, which gain should you typically tune first?
2.What is the primary purpose of increasing the derivative gain (kD) during tuning?
3.Why is integral gain (kI) generally discouraged for most FRC mechanisms?
Answer every question to submit.