My team is relatively new to PID tuning - it’s something we’ve always struggled with. I’ve been collecting guides on how to do it, but I’m trying to figure out how to get some practice.
Our test bench includes multiple motors, but we’ve found that PID tuning on a “bare” motor shaft is very tricky because of how sensitive they are to changes in input. We’ve had slightly more success with ones that have gearboxes attached, but it’s still a challenge.
This summer I hope to practice with old competition bots, but does anyone have a good test bench setup that lets kids practice with PID tuning? (Practicing with SysID would be a dream, if you do that, too.)
docs.wpilib.org has interactive PID tuning tutorials in Javascript:
2 Likes
I’m not usually a fan of simulation for beginners; it leaves out things they aren’t yet aware of. That said, the wpilib tutorials are great, and can help cover a lot of ground.
I highly recommend having a test mechanism – not just a bare motor or gearbox, but something that resembles a competition robot part.
You also need to provide insight into what is happening and why. Set up a dashboard to display plots of your process variable, error, loop output. Output should be broken down by component – if you have a feedforward term, show that separately from the proportional controller’s output. If you’re using integral or derivative, make sure those are broken out as well.
Ideally, hook up some joysticks and show that you can accomplish the same thing as the control loop would, and show the plots for it. I recommend joysticks over gamepads because the throttle is a useful way to choose a setpoint.
The simplest and least-destructible device is probably a flywheel shooter. Make sure you can feed game pieces through it, or you don’t have any test cases. This makes a great testbed for simple feedforward and proportional control – the goal is for the feedforward to get you most of the way there and the proportional to reduce the recovery time after a shot. I wouldn’t use any of the wpilib feedforward models yet; just a constant, but you could work up to it. Nowadays, you could just buy a Greyt Shooter for this purpose and use a brushless motor’s encoder for feedback.
My second-favorite testbed is a skidsteer chassis with a gyro. Implement a proportional-only control loop that holds a constant heading, despite external forces (e.g., another robot pushing it). You can take this one step farther and use it to teach trapezoidal motion profiles for a “turn-to-this-heading” command.
2 Likes