Code iconThere is much information on the VEX Forum and various websites concerning PID, and most of them do a better job of explaining how it works and how to implement it than I could hope to achieve. So I thought I’d write a post here with links to the resources I found useful.

PID Uses

An item to consider as you read these articles: PID can be used for a few major functionalities, and it helps to understand which of these functions the article is discussing before you get too far into trying to replicate their method. Major uses include:

  • Driving straight or making a double-flywheel to shoot straight, via adjusting left-side and right-side power
  • Holding an arm in place
  • Slowing down as you approach your sensor target so you don’t overshoot
  • Line following

EasyC Users

EasyC users: Most of this code and descriptions are in RobotC (thought there are some specifically for EasyC), but that doesn’t mean you’re out in the cold. The EasyC built-in PID functionality is for holding up an arm only; all other uses of PID require you to write the code yourself anyway, so you can follow along with what the RobotC code is doing and write your own EasyC.

My Recommendation for Newbies

If you’ve never programmed a PID control and you’re reading through these guides, please make yourself a P-only controller to start. Most guides walk you through the entire process of creating the P, I, and D components. That doesn’t mean you have to use them. In fact, it’s generally a good thing to get the “P” part as good as possible first, such that any change in Kp up or down does not produce a better outcome for your robot’s movement.

For some applications, a P-only controller is perfectly fine (or at least sufficient), in which case you’re done, and there’s no need to move on to the I and/or D portions. So while it’s helpful to understand what these guides are explaining for all 3 parts of the system, you are never required to use all of them in any given application.

RobotC: Use the Datalog Function

If you’re using RobotC and are determining your best values for Kp, Ki, and Kd, then you should 100% be using the datalog feature. This RobotC tool can get you from start to finish on setting your PID constants in under an hour. See my previous post about using the datalog. You won’t be disappointed; this is THE go-to feature when writing your own PID.


And, of course (the awesome) JPearman of the VEX Forum has several items to check out:

If you are aware of additional resources that are not on this list, please email me and I will be happy to add them; I would like for this post to serve as a reference library for those looking for PID help. There are of course many YouTube videos explaining what PID is, but I want this listing to include only those sources that would help VEX teams learn, code, and successfully use PID for their robots.

Share this post: