Skip to content
learnFRC.org
programminglesson30 min

Velocity Closed-Loop Tuning

Measuring static friction kS, calculating velocity feedforward kV, setting proportional gain kP, and testing flywheel recovery in Tuner X.

What you will learn

  • Measure static friction voltage (kS) and velocity feedforward (kV) on the bench.
  • Tune proportional gain (kP) to eliminate steady-state velocity error.
  • Test flywheel recovery response under simulated game-piece disturbance loads.

Prerequisites:Bench Diagnostics & Signal Plotting

Flywheel shooters, rollers, and indexers require precise rotational velocity control. When a game piece enters a shooter wheel spinning at 5,000 RPM, it steals kinetic energy from the rollers. The controller must rapidly compensate to restore firing velocity before the next shot.

Feedforward (kSkS and kVkV) supplies nearly all motor voltage for velocity control. Feedback (kPkP) only corrects for dynamic disturbances such as game piece compression.

Interactive Simulator

Want to observe how velocity feedforward and proportional feedback interact before configuring hardware? Test the PID & Feedforward Simulator with the Tuned Flywheel preset.


The Talon FX executes velocity closed-loop requests onboard at 1,000 Hz:

Target Velocity (rot/s) ──▶ [ kV · target + kS · sgn(target) ] ──(+)──▶ Motor Coils
▲
Measured Velocity (rot/s) ──▶ [ kP · (target - measured) ] ───────┘
  1. Static Friction Feedforward (kSkS): Overcomes Coulomb friction in the motor bearings and gearbox bushings.
  2. Velocity Feedforward (kVkV): Provides the electrical voltage required to match motor back-EMF at steady cruise speed.
  3. Proportional Feedback (kPkP): Restores speed when external drag (like compressing a foam game piece) slows the wheel down.

Step 1: Measure Static Friction Voltage (kSkS)

Section titled “Step 1: Measure Static Friction Voltage (kSkSkS)”
  1. Open the motor’s Control tab in Phoenix Tuner X.
  2. Select control mode Duty Cycle (Open Loop).
  3. Slowly increase output from 0.00 in 0.01 increments (each 0.01 is approximately 0.12V):
    • 0.01 (0.12V) -> Motor stationary
    • 0.02 (0.24V) -> Motor barely begins continuous rotation
  4. Record this threshold: kS = 0.02 · 12V = 0.24V

Step 2: Measure Velocity Feedforward (kVkV)

Section titled “Step 2: Measure Velocity Feedforward (kVkVkV)”
  1. In the Control tab, command +0.50 duty cycle (~6.0V on a fully charged battery).
  2. Allow the flywheel to reach steady state.
  3. Read the measured velocity in rotations per second (rot/s) from the signals list. Suppose the flywheel spins at 48.0 rot/s:
  4. Calculate kVkV: kV = (Applied Voltage - kS) / Measured Velocity kV = (6.00V - 0.24V) / 48.0 rot/s = 5.76V / 48.0 rot/s = 0.120 V/(rot/s)
  1. Navigate to the Config -> Slot 0 tab in Tuner X.
  2. Enter your calculated values:
    • kS = 0.24
    • kV = 0.120
    • kP = 0.0 (leave feedback at zero!)
  3. Click Apply.
  4. Return to the Control tab, select control mode Velocity Voltage, select Slot 0, and command a target of 50.0 rot/s.
  5. Observe the result: The flywheel should spin immediately to approximately 48 to 50 rot/s using feedforward alone.

With feedforward handling 95% of output voltage, proportional gain can be tuned strictly for disturbance rejection:

  1. Increase kP in increments of 0.05 (e.g., 0.10, 0.15, 0.20).
  2. Plot target velocity versus measured velocity in the Tuner X Plot window.
  3. The measured velocity should settle precisely on the target setpoint line without oscillations or audible hum.
Audible Motor Buzzing

If the flywheel produces an audible high-frequency buzz or vibration when running at steady speed, kP is too high. Decrease kP by 30% immediately to prevent bearing wear and motor heating.


To verify velocity tuning on a live flywheel:

  1. Spin the flywheel at competition firing speed (e.g., 60 rot/s).
  2. Feed a game piece into the rollers.
  3. In the Tuner X plot, observe:
    • Velocity dip during game-piece compression.
    • Time required to recover back to within 1% of the target setpoint.
    • A properly tuned flywheel recovers in under 150 milliseconds.

  • Symptom: Motor commands 50 rot/s, but settles at 35 rot/s.
  • Cause: kVkV was calculated with an inaccurate free speed, or battery voltage was sagging under load.
  • Fix: Re-measure kVkV using the formula kV = (6.0V - kS) / measured_velocity.
  • Symptom: Velocity oscillates wildly around the setpoint.
  • Cause: Derivative gain (kDkD) was added or kPkP is excessively high.
  • Fix: Flywheel inertia naturally dampens velocity changes. Set kD=0kD = 0 and reduce kPkP.

Record your calibrated gains for Stage 3 Java implementation:

  • kSkS (volts): ______ V
  • kVkV (volts per rot/s): ______ V/(rot/s)
  • kPkP (volts per rot/s error): ______
  • Steady-state error at target velocity is under 1.0 rot/s.

Verified Sources & Standards

Evergreen Standard Verified: Sep 25, 2026