PIDs for Autonomous

I was wondering if anyone could give me an example code for a PID in either VEXcode or Vex Coding Studio so I can understand how it works because I cannot seem to find any other websites that teach PIDs for autonomous for Vex Coding Studio or VEXcode. An explanation of how the PID works and a sample would be great. Thanks.

I would recommend you start with George Gillard’s intro to PID controllers.

Providing PID code isn’t going to help you understand how PIDs work. The code is pretty easy, but it’s best first you understand what they are and where you will want to use them. Also, a PID function is only as useful as your tuning. Depending on where you want to use the PID (or how you want to use the PID) it may be more involved (e.g. PID for arm vs PID for drive).


I was wondering the same thing. I understand PID but I don’t know how to put it in to VexCode and how to program it. Does anyone have a PID example code that I could look at to see how it works and how I would program a robot? I looked at the link above by George Gillard and it helped me understand more but idk how to implement it into code. Thanks!

1 Like

There was pseudocode in the George Gillard documentation so if you really read it thoroughly, implementation shouldn’t be an issue

but if you really cant figure out, here’s my github repository. it’s in robotC but rewriting it into vexcode shouldnt be an issue