# Can someone explain what the point of PID tuning is?

I’ve read a lot about PID tuning but I still don’t understand why you would use it

1 Like

In simple terms, PID tuning is important because you want a mechanism to go to a specified position (or velocity) a fast as physically possible but with as much precision as possible and without self-destructing.

8 Likes

Team 8614: Ellipse, created some really nice videos explaining what a PID loop is and what it’s used for:

More generically, about Controls Engineering (of which PID is a sub-topic), some shameless self promotion:

1 Like

More specifically, without overshooting the desired speed/position unacceptably.

1 Like

I meant self-destruction tbh. An untuned F + I gain will cause any system will do nothing but overshoot / diverge. This leads to bad things, specifically RUD events.

1 Like

There are a few different ways to get a robot to travel a specified distance. One way is to simply power the motors until you reach the distance and then shut the motors off. The issue here is that the inertia of the robot will cause it to continue moving afterwards so you end up going too far. You can compensate for this by shutting the motors off sooner but any variations in battery voltage or friction will result in the robot going different speeds and the resultant distance will still not be very accurate. PID loops are systems that take into account how quickly you’re approaching a target and how far away you are from the target in order to get to it accurately. You could be running a robot with the battery at 6v or 12v and it would still end up in the same place. They’re also likely to be used on shooters this year. The idea being that the speed of the shooter wheels will fluctuate if you just apply a single power to the motors since small changes in battery voltage or unexpected sources of friction can slow the wheels. With a PID loop, you can measure any error in the wheel speed and correct for it.

1 Like

You use a PID so your software can control some aspect of your robot automatically.
This year it might be the rotational speed of the wheel of your shooter.
So, you could say that if you run your motor at 80% the speed of your wheel is 1600 RPM
But as battery drains and other things happen 80% might end up being 1400 by the end of the match.
But you want to keep a constant 1600 because that is what give you a consistant shot.
So setting your motor controller to a specific power aint going to cut it.
You would like your software for figure out what power to supply to achieve 1600.
This is where you use a software PID controller.

A PID has to know your target (1600 RPM in this case) and it has to know how fast the wheel is rotating in real time, so you would need an encoder on your wheel so you get feedback on the wheels rotational speed.

A PID controller then sees what the difference is between target and real, the “error”, and applies power to the motor to reduce the error. You “tune” the PID with values that help the controller determine how much power to apply in response to the error.

I thought these youtube videos were useful as a beginning introduction to PID:

OP, lots of ideas and summaries expressed here. Have any helped you in your understanding?

I am not a programmer or fancy math guy, I am a simple man with simple needs. Show me what things do so that I might do thing. This video is short and shows exactly what effect things have on your system.

1 Like

https://docs.wpilib.org/en/latest/docs/software/advanced-control/introduction/control-system-basics.html#why-feedback-control also talks about why anyone would use feedback control (PID controller is a feedback controller).

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