PID Tuning without access to robot

With only about three hours of time dedicated to testing this year, it is no surprise we were unable to tune anything. This is rather concerning considering we have four separate mechanisms which run off of PID loops, some of them using multiple sets of parameters. It has been suggested that we might be able to do tuning at competition in pits / during practice matches, but that seems unreasonable and, frankly, dangerous to me. Is there any hope of getting each PID-controlled system tuned without access to the robot, or should we resort to a different method? My initial thoughts are to try to tune in simulation to get “close enough” and make minor adjustments after practice matches, or to use some sort of adaptive algorithm instead of PID. Does anybody have any experience with this problem?

1 Like

If you can, it may be easy to use extra parts to make a “test chassis” to test PID loops on. That’s what were doing and it works pretty well. You can even tune it just by putting strings on the motors to see how fast their moving.

1 Like

No - tuning in the simulator will not work to transfer over to the robot and have it function correctly. Tuning the PID on the robot accounts for real world problems like friction, binding, etc. However, tuning PID in the pits in not inherently unsafe. Just get everyone out of the possible motion arc of the mechanism, and tune it.

1 Like

Yes that would likely be fine for tuning most mechanisms, but what about tuning the drivebase PID? We can’t exactly have it driving about in the pits.

Very true. Your best bet there is to do it on the practice field at competition.

1 Like

Watch Austin Schuh’s lectures on physical simulations/Test driven development. He writes software that simulates an elevator mechanism, tunes PID values in the simulation, and then deploys and runs the working code to another teams robot. It’s incredibly powerful, and if done right I would feel comfortable using it at competition. It’s also taken them an incredible amount of effort to get their environment to that level, but writing a quick python/matlab simulation can simply help you tune values. Faced with the alternative of building a second mechanism, it is an option worth exploring.

(I’d link to the lectures but Youtube is blocked at work, sorry)


Is drivebase PID worth it? It may be better to switch to open loop controls. Many teams have been successful without PID. Sacrifing driver practice for tuning PID may not be worth it.

If you do decide to tune on field, make sure you can adjust the parameters from the driver station computer (e.g. via smartdashboard).

1 Like

I would recommend Motion Magic. It is a lot more forgiving to tune, Feed-Forward, Max Accel. and Max. Velocity can all be calculated beforehand, and once those are in place tuning the remaining PID is extremely easy and forgiving. Also, I second pushing the parameters to the dashboard, it saves sooo much time.

1 Like

To make this more general, tuning a PID in simulation requires a sufficiently accurate plant model of the mechanism in question. For that matter, testing any controller (adaptive, bang-bang, etc.) in simulation requires this.

Creating a reasonable plant model for FRC purposes is not impossible. I did it this year for our arm, and in previous years for various other mechanisms. They’re usually made up of things for which the physics is well understood (motors, gears, spring/mass/dashpot, etc.) The annoying part, I’ve found, is usually making sure all your units and directions are correctly aligned with the real robot code (the controller). In most industry applications, there is a period of “correlation” where you make sure the plant model reacts to inputs the same way the real mechanism does. Once you’ve proven this out, you can then proceed to do your controller development offline, and later come back to the physical mechanism for final validation.

TL;DR - Yes it’s possible. No, I don’t recommend it.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.