ControlsIntermediate

Velocity PID for Intake and Shooter Wheels

Velocity control is about holding speed under load, not merely sending a motor percentage.

PIDVelocityShooterFRC
Robotic drive chassis with velocity vectors, a planned trajectory, and fiducial field landmarks
Generated visual worldRobotics & planning

Motion, sensing, control loops, and plans made visible as a field of forces and trajectories.

Interactive model

Speed response to a setpoint

Change gain and damping to inspect overshoot, steady error, and recovery. The simplified curve does not model every flywheel, controller, or game-piece interaction.

Live HTML simulation · adjust the controls and watch the computed output respond.

Interactive

PID tuning changes speed, overshoot, and settling

This is a simplified teaching model. Its displayed values are computed from the controls; the article explains where the model stops.

Site connection

A practical guide to velocity feedback, feedforward, readiness checks, and disturbance recovery for FRC rollers and flywheels.

Definitions: Controlling a Rate

A velocity loop uses a target rate as its setpoint and a measured rate as its process variable. For a shooter, both might be RPM; for an intake, they might be rotations per second. The error is target velocity minus measured velocity.

Percent output is open-loop: the same command is sent whether the wheel is free-spinning or loaded. Velocity control is closed-loop: when a note slows the wheel, the increased error requests more effort, within current and voltage limits.

Velocity PID regulates speed; it does not guarantee that a note is present, centered, or launched accurately. Sensors and command sequencing must establish those separate facts.

Why Feedforward and Feedback Work Together

Feedforward estimates the voltage needed for the requested motion before an error appears. A simple rotating-mechanism model may include a static-friction term and a velocity term. PID feedback then corrects for battery sag, friction changes, imperfect modeling, and disturbances.

This division makes tuning easier: feedforward supplies most of the steady effort, while feedback stays small enough to correct rather than fight the mechanism. If the output is clamped, the requested sum must still respect hardware safety limits.

Reference table for this concept
SignalQuestion it answersExample
SetpointHow fast should it spin?4200 RPM
FeedforwardWhat voltage should approximately sustain that speed?8.0 V
FeedbackWhat correction does measured error require?+0.6 V
Clamped outputWhat safe command reaches the motor?8.6 V, limited to the allowed range

Worked Example: Recovering After a Shot

Assume a shooter target of 4500 RPM. Just before a shot it measures 4470 RPM, so the error is 30 RPM. Contact with a note drops the next measurement to 3900 RPM, increasing error to 600 RPM. With Kp = 0.002 V/RPM, the proportional correction rises from 0.06 V to 1.20 V.

If feedforward predicts 8.5 V at 4500 RPM, the post-shot request is 9.70 V before clamping. As the wheel recovers, error and correction shrink. These values are illustrative; the Team 1257 source confirms two-sided shooter velocity loops but does not publish these gains or setpoints.

A 'ready to fire' flag should normally require speed to remain inside a tolerance for several samples. Crossing the target once during overshoot is not the same as settling.

Intake and Shooter Are Similar—but Not Identical

Team 1257 described the intake and ground intake as programmatically similar, with a velocity PID loop on the intake. The intake also had a break-beam sensor and a command that ran until a note was detected; the ground intake did not. The shooter used velocity PID loops on both sides.

That distinction matters. The velocity loop answers whether a roller tracks speed, while the break beam answers whether a game piece crossed a location. A two-wheel shooter may also need both wheels within tolerance, and possibly a controlled speed differential, before feeding.

Reference table for this concept
MechanismPrimary feedbackSeparate state evidenceTypical disturbance
IntakeRoller velocityBreak beam or current/sensor logicNote contact or jam
Ground intakeRoller velocityCommand timing or another sensorCarpet and note contact
Two-wheel shooterLeft and right velocitiesBoth stable inside toleranceShot energy transfer

Implementation, Tuning, and Limits

Confirm encoder conversion factors and sign before tuning. Call the controller at its configured period; WPILib's default PIDController period is 20 ms, and irregular timing changes derivative and integral behavior. For a velocity loop, WPILib's position-error accessor represents velocity error, while its velocity-error accessor represents acceleration error.

Tune and log free-spin startup, steady running, a representative shot or note intake, and recovery. Compare target speed, each measured wheel speed, voltage, current, and battery voltage. A bad bearing, slipping belt, weak battery, or saturated motor cannot be corrected merely by increasing gain.

Do not copy position-loop gains into a velocity loop. Their units and plant dynamics are different even if the software class has the same method names.

Common Pitfalls

  • Tuning shooter speed without testing a real game-piece interaction.
  • Ignoring encoder conversion factors, sensor sign, or loop period.
  • Using position PID constants for velocity control.
  • Firing as soon as speed crosses the target instead of requiring stable readiness.
  • Looking only at average shooter speed when the left and right wheels differ.
  • Using higher gains to conceal voltage saturation or a mechanical fault.

Sources and Further Reading

Related Explainers