PID Tuning in Tuner X
The Talon FX runs the control loop itself. We can send it a setpoint from Tuner X, plot the response, and save the gains onto the motor.
- Motor, encoder direction, and mechanism zero verified in Motor Setup & CAN IDs.
- Tuner X connected to the CANivore, with CANivore USB on.
- The mechanism, with a clear path to swing, and no obstacles.
What mechanism are you working on?
The lesson below is written for the one you pick. Switch back any time to read it for the other.
How to tune
CTRE has an excellent guide that explains how to tune a PID loop. We strongly suggest following it.
CTRE: Manual PID tuningIf that site is blocked, the steps on this page recreate the guide. CTRE tunes in torque current with FOC, and we rewrote it in volts. It is based on CTRE's dyno testing, so it should be fairly accurate.
Play with the gains
Drag a gain and watch what happens. Find out what too much kP looks like here, where it costs nothing, rather than on a real gearbox.
Units and sizes
Every gain is output per unit of input. Here the output is volts and the input is rotations. The numbers you tune can look nothing like a guide written for another unit.
Rotations are why an arm kP looks big. An error of 0.01 rotations is 3.6 degrees, so a kP of 20 answers it with only 0.2 V. A Kraken X44 needs about 0.093 V per rps of its own speed, so a flywheel kV in motor rotations lands near that.
Tune the gains
- Open Signal & Control and add the Talon FX you are tuning.
- Plot the target and the measured position, or velocity for a flywheel. Drag both into Group 1 under Enabled Signals so they share an axis, and set Timespan to about
0.25. It is in minutes, and the default of 10 squeezes a move into a sliver. - On the Control tab, set Control Mode to
PositionVoltageVelocityVoltageand select Slot 0. Enter a small target: 0.1 rotations for position, 10 rps for velocity. Changing Control Mode switches the device back to DISABLED, so enable it again.


Run these steps on your actual mechanism. Press Apply, the arrow icon above the config list, after every gain change. A gain that was never applied never reaches the motor.
- Set every gain in Slot 0 to zero and press Apply. Set Gravity Type to
Arm_Cosine. - Feedforward first. Raise
kGto find the smallest and the largest values that hold the arm level. SetkGto the midpoint andkSto half the gap between them. - Feedforward first. At a low target, raise
kSuntil the wheel just turns. At a high target, raisekVuntil the measured speed meets the target withkPstill at zero. - Raise
kP, doubling it each run, until the mechanism overshoots or oscillates. Then back off to about half of that value. - Add
kDin small steps until the overshoot stops. If the arm starts to buzz, you have gone too far. - Leave
kIat zero. Fix a steady gap with feedforward orkPfirst, and you will rarely need it. - Once short moves work, try longer ones. You may find the mechanism starts to overshoot. If it does, go back to the feedback steps above.
- Try other targets in both directions, then press Apply one last time.
Three failure shapes
Nearly everything that goes wrong on a mechanism looks like one of these. Read the plot, not the mechanism.
- Wrong direction
- Error grows instead of shrinking and output pins. Disable now. The sensor or the motor is inverted, so go back to Motor Setup.
- Too much gain
- Voltage chatters and the mechanism hums at rest. Cut
kPbefore reaching forkD. Damping will not fix a loop that is too stiff. - Not enough output (position control)
- Error settles at a constant gap. Increase your
kPto correct this, likely followed by akDto dampen the overshoot.
When the plot looks like none of these, check the setup before the gains.
- The request and the gains must both be on Slot 0. Gains in another slot do nothing.
- A gain from an amps or duty cycle guide is meaningless in a voltage request.
- A tired battery cannot reach the voltage a fresh one can. Re-check your gains on a charged battery.
- A current limit that clips the output looks like too little gain. Watch for current sitting flat at the limit.
- A runaway means the sensor or motor direction changed since Motor Setup & CAN IDs. Fix it there.
- Gains that were never applied are lost. Power cycle, reopen the config, and confirm the numbers are still there.
Check your work
Drive the mechanism to its target in both directions, from a standstill, three times. You are done when all three runs look alike.
You should see
- The measured trace meets the target and stays there.
- Closed-loop error settles near zero and does not drift back out.
- Voltage is steady at rest, not chattering.
- The same gains behave across the full range of travel.
Check yourself
You set every gain to zero, send a position target, and enable. The arm does nothing. What is wrong?
Your arm holds its angle perfectly at 90 degrees and sags badly at 30. Which term is wrong?
What order do you tune an arm in?
The arm reaches its target and then buzzes, sitting still. What do you reach for first?