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 ( and ) supplies nearly all motor voltage for velocity control. Feedback () only corrects for dynamic disturbances such as game piece compression.
Want to observe how velocity feedforward and proportional feedback interact before configuring hardware? Test the PID & Feedforward Simulator with the Tuned Flywheel preset.
1. Velocity Control Architecture
Section titled “1. Velocity Control Architecture”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) ] ───────┘- Static Friction Feedforward (): Overcomes Coulomb friction in the motor bearings and gearbox bushings.
- Velocity Feedforward (): Provides the electrical voltage required to match motor back-EMF at steady cruise speed.
- Proportional Feedback (): Restores speed when external drag (like compressing a foam game piece) slows the wheel down.
2. Step-by-Step Tuning Procedure
Section titled “2. Step-by-Step Tuning Procedure”Step 1: Measure Static Friction Voltage ()
Section titled “Step 1: Measure Static Friction Voltage (kSkSkS)”- Open the motor’s Control tab in Phoenix Tuner X.
- Select control mode Duty Cycle (Open Loop).
- Slowly increase output from
0.00in0.01increments (each 0.01 is approximately 0.12V):0.01(0.12V) -> Motor stationary0.02(0.24V) -> Motor barely begins continuous rotation
- Record this threshold:
kS = 0.02 · 12V = 0.24V
Step 2: Measure Velocity Feedforward ()
Section titled “Step 2: Measure Velocity Feedforward (kVkVkV)”- In the Control tab, command
+0.50duty cycle (~6.0V on a fully charged battery). - Allow the flywheel to reach steady state.
- Read the measured velocity in rotations per second (rot/s) from the signals list. Suppose the flywheel spins at
48.0 rot/s: - Calculate :
kV = (Applied Voltage - kS) / Measured VelocitykV = (6.00V - 0.24V) / 48.0 rot/s = 5.76V / 48.0 rot/s = 0.120 V/(rot/s)
Step 3: Test Feedforward in Slot 0
Section titled “Step 3: Test Feedforward in Slot 0”- Navigate to the Config -> Slot 0 tab in Tuner X.
- Enter your calculated values:
kS = 0.24kV = 0.120kP = 0.0(leave feedback at zero!)
- Click Apply.
- Return to the Control tab, select control mode Velocity Voltage, select Slot 0, and command a target of
50.0 rot/s. - Observe the result: The flywheel should spin immediately to approximately 48 to 50 rot/s using feedforward alone.
Step 4: Add Proportional Gain ()
Section titled “Step 4: Add Proportional Gain (kPkPkP)”With feedforward handling 95% of output voltage, proportional gain can be tuned strictly for disturbance rejection:
- Increase
kPin increments of0.05(e.g.,0.10,0.15,0.20). - Plot target velocity versus measured velocity in the Tuner X Plot window.
- The measured velocity should settle precisely on the target setpoint line without oscillations or audible hum.
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.
3. The Disturbance Recovery Test
Section titled “3. The Disturbance Recovery Test”To verify velocity tuning on a live flywheel:
- Spin the flywheel at competition firing speed (e.g., 60 rot/s).
- Feed a game piece into the rollers.
- 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.
Common Failure Modes
Section titled “Common Failure Modes”1. Velocity Stalls Far Below Setpoint
Section titled “1. Velocity Stalls Far Below Setpoint”- Symptom: Motor commands 50 rot/s, but settles at 35 rot/s.
- Cause: was calculated with an inaccurate free speed, or battery voltage was sagging under load.
- Fix: Re-measure using the formula
kV = (6.0V - kS) / measured_velocity.
2. Motor Jitters Violent Oscillations
Section titled “2. Motor Jitters Violent Oscillations”- Symptom: Velocity oscillates wildly around the setpoint.
- Cause: Derivative gain () was added or is excessively high.
- Fix: Flywheel inertia naturally dampens velocity changes. Set and reduce .
Check Your Work
Section titled “Check Your Work”Record your calibrated gains for Stage 3 Java implementation:
- (volts):
______ V - (volts per rot/s):
______ V/(rot/s) - (volts per rot/s error):
______ - Steady-state error at target velocity is under 1.0 rot/s.
Verified Sources & Standards
- CTRE Phoenix 6 Velocity Closed-Loop Tuning Guidev6.docs.ctr-electronics.comHardware Vendor
- WPILib Feedforward Controllers in Javadocs.wpilib.orgWPILib Standard