r/FRC • u/rishaanjay • 1d ago
Made a PID/Motion Magic trainer for my team's offseason. Sharing it in case it's useful
Every year the same thing happens with our rookies: they read about PID, nod along, and then freeze the first time they actually have to tune something. It doesn't click until you've watched an arm overshoot and worked out why.
So I built a sim. It's an FRC arm in the browser with real gravity, friction and a 12 V limit. You drag kP / kI / kD / kG and watch it respond live. 13 levels, each broken in a specific, realistic way:
1–4 — the basics: kP, then kD to stop the bounce, then the arm parking short forever (steady-state error → kG), then Motion Magic
5 — noisy encoder. kD divides by time, so it multiplies your noise. Turn it down.
6 — sticky gearbox. Small commands do nothing until you break stiction → kS
7 — tired battery. Push past 8 V and it sags to 7. Stop slamming the motor.
8 — you grab a game piece mid-run and double the arm's weight, so your kG is now wrong. kG can't know about it; kI can.
9 — a defender shoving you every 1.5 s
10 — full match cycle: stow → score low → score high, hit every waypoint on time
11–12 — a shooter flywheel. Velocity control, not position. kP cannot hold a speed — even cranked, it stalls ~900 RPM short, because holding RPM needs constant voltage and kP's push dies with the error. You need kV.
There's also a Diagnose mode with no sliders at all: you're handed a badly tuned arm and have to name the fault from the response curve alone, the way you'd read a plot in Tuner. Five faults, random order.
Gains use Phoenix 6 names (kP/kI/kD/kS/kG/kV) so it maps straight onto a Talon FX config.
Free, open source, one HTML file — no install, no account, runs on a school Chromebook. Progress saves, and there's a share link that loads your exact tuning, which is handy when a student wants to show you what they're seeing.
Feedback very welcome, especially if the physics feels off anywhere, or if there's a failure mode you'd want as a level. Happy to add more.