PID Tuning Practice - Elevator

intermediate55 min

Overview

Tune an elevator with gravity feedforward first, then proportional gain. The order matches SuperNURDS FRC 3255 and WPILib practice guidance.

kG is feedforward that fights gravity (volts). kS fights static friction. Setpoint units depend on your template; the YAMS lesson uses meters for height.

Video Tutorial

Elevator tuning walkthrough:

Prerequisites

  • Setup complete
  • Elevator selected in SmartDashboard
  • Live tuning on in Elastic
  • Position and velocity on an AdvantageScope line graph
  • Teleop enabled in the sim

Tuning Steps

  1. Set the setpoint to an unreasonable value (outside the mechanism’s normal range). Setpoint units depend on your mechanism - for an elevator, this might be 2-3 meters.
  2. Find the smallest kG value that holds position without moving up:
    • Start with a low value (e.g., 0.1)
    • Watch the position graph (blue line) - it should stay flat
    • If it creeps up, the value is too high
    • Double the value until it starts moving
    • Use binary search between the last good value and the first value that moves
    • Example: 0.4 (good) → 0.8 (too high) → 0.6 (good) → 0.7 (too high) → 0.61 (final)
  3. Verify the kG result:
    • Position stays stable
    • Velocity stays stable
    • Small velocity changes may be due to simulation limitations
  4. Set the setpoint to a valid position.
  5. Start with a low P value (e.g., 0.1).
  6. Double P until the response looks good:
    • Watch the position graph
    • Target: rectangular shape (sharp rise, flat hold, sharp fall)
    • Avoid slow curves or gradual taper
  7. Watch the mechanism’s motion.
  8. Continue increasing P until the response is fast and clean.
  9. Compare response times as you increase P. At low P, the mechanism reaches the target slowly. As P increases, it should reach the target faster with sharper transitions. The final P value depends on your mechanism’s characteristics (gear ratio, weight, design). In the video example, a P value around 25.6–51.2 worked well for the YAMS simulated elevator on SparkMax tuners. The browser PID Simulation uses motor-rotation PID (V/rot) with REV NEO or CTRE Kraken physics — start at 0.1 and double. kP numbers from the video may transfer more closely than the old meter-based sim, but still retune on your setup.

Browser vs desktop tuning units

  • kG (gravity feedforward) is in volts — the value depends on plant mass, gearing, and motor. Use binary search; one lesson video landed near ~0.61 V for a similar plant, but your sim may differ.
  • kP is in volts per motor rotation (V/rot) in the browser sim and in SparkMax / Phoenix tuners — same unit family. Start at 0.1 and double; lesson videos may show values in a similar range for this plant.
  • Use the same workflow (binary search kG, double kP) on every tool — do not copy kP numbers from the video into the browser sim without retuning.

Elevator Tuning Summary

The process:

  • Set setpoint to unreasonable value (out of range) - units depend on your mechanism
  • Tune kG using binary search - find smallest value that holds position
  • Tune P by doubling until position graph is rectangular
  • Look for sharp up, sharp across, sharp down in position graph
  • Compare response times - should get faster as P increases

Important Notes

This elevator did not need motion profiling. The arm lesson adds tighter kG precision, overshoot risk, and trapezoidal limits—watch that video if you want the full workflow.

Applying to Physical Hardware

Use Phoenix Tuner or REV Hardware Client with the same kG-then-kP order. Graph rotor position and velocity (names vary slightly by vendor). Aim for the same rectangular position trace as in sim.

Resources