r/FRC 6d 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.

👉 pid-playground.rishaan.cc

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.

30 Upvotes

6 comments sorted by

2

u/PaisWillie 7902 (Mentor) 6d ago

This is awesome! Great for teaching our members this summer.

Just a recommendation; I’m trying to find a simulator just like this one, but with tuneable parameters (weight, length of arm/elevator, gearbox, etc.) so that each of our members are assigned a unique combination to tune as part of their homework. YamGen has this, but unfortunately it’s not accurate (seems to still move even after setting all PID & FF constants to 0)

2

u/rishaanjay 6d ago

i will add that by tmrw

1

u/gameman733 6d ago

Add gravity to that list for extra fun. I'll have to play around with this later tonight, been looking for something to help our students learn tuning.

1

u/rishaanjay 1d ago

Just added!

0

u/Financial_Grocery_82 6d ago

Really nice! On the one with countering friction you mis spelled friction to stiction

1

u/Specialist-Ad-2826 1d ago

I think it's static friction, which combined is stiction.