This has been the best explanation paper and instructions on how PID works, from what I’ve found. As far as videos go, a quick search for “PID Explanation” on YouTube will give good results. The paper that 2921 wrote in the link should be more than enough though.
PID is used for accuracy and steadiness in really any place where you want a control loop. This could be used on your lift or drive in autonomous, or even your lift in driver control. (Having it on the drive is possible, but IMO not too useful)
PID will add deceleration and correction to your robot. In a typical program, assuming there is no brake in it, the motor value will go from 127 (or any other speed it is set to) down to 0 when it reaches the target. This will make the robot drift forward and cause inaccuracy and inconsistency. The PID will slow down the motor value as it approaches the target and the motor will also correct itself if it goes beyond the target.
I don’t know the specifics on what each the P, I, and D do, but I do know some general knowledge on it.
In certain systems you won’t need each the P, I, and D. On my lift I just used the P, however, on my drive I used the P,I, and D. It worked great and I would highly suggest it if you plan on running accurate and consistent autonomous’ and programming skills, especially with the limit on two repositions in programming skills this year.
This is an article on how to write good PID code, which is what I based my PID code on this year.
This is my favorite tuning article. Don’t actually try to read all of it, just read the simple stuff until it starts to make sense.
My general tuning method (which probably sucks) goes like this…
EDIT: I guess it’s worth noting that we developed a pretty comprehensive robot configuration library and wrapper functions for most things in PROS so we don’t care about exact sensor types or things like that in the PID library. For example, regardless of motor configuration, internal gearing, or encoder type, we can get the number of degrees an output shaft has traveled with a simple function call. Another similar call which has knowledge of the wheel configuration and gearing can give us distance traveled in inches, etc. In this way our PID code was vastly simplified. It involved two structs, one to hold configuration data like gains, and another to hold working data, like the integral. We could share the config without issue between loops, and all that was really necessary to create a loop was to run and init function then begin regularly running an update function. The update function was tolerant of a variable delta time, so while we tried to call it at regular intervals, it wouldn’t have been an issue if we didn’t.