PID Controller Class WPI

Hey All,

My team has reached the point where are camera can output an x and y coordinate and the distance from the rectangle we are tracking we are. I was talking with one of the Electrical Masters on our team, and he dosen’t understand the PID controller at all obivously, but he kept talking about the jaguar.

What does the PID Controller export to the Jaguar or whatever motor controllor? is it in a specific format? how does that work?

Any Help you guys can give me would be amazing

The following is an approximation of how PID works.

Say you have a motor you need running at 2000 rpm. You use an encoder to check the speed of the motor and if it’s too high you lower the voltage; if it is too low you raise the voltage. Say I do so by 1 V every time. This will most likely result in fluctuating above and below the target speed.
To avoid the above issue, proportion takes the ‘error,’ or difference from the target speed and ‘proportionally’ approaches it. For example, a ‘P’ value of .5 with an error of 1000rpm at 0V will ramp up in the next cycle to half the required power to make up the difference, and the cycle after, and so on.
The proportion will only make you approach the target speed. It’s like Zeno’s Paradox. Integral will solve this by adjusting the proportion up.
This is a response value. If the speed drops, or rises suddenly then this will rapidly make up the drop or lower V to counter a rise. This will not, however, assist in the initial approach to the target speed.

Not all of the control options are required in a PID loop.

Obviously you could code one yourself but it’d be slow.

To find good PID values I suggest you use the BDC Com provided by first. The class you need can be found in the WPI library. If after significant trial with this you need help, inform me and I’ll drop some hints. Finally, the CANJaguar class allows you to do PID without using the CIRO to do it. This is the primary benefit of jaguars. CANJags are hooked up differently than Jags are otherwise. Also, they are coded different and need to be imaged. The class is available in the WPI Library and you can ask someone else about imaging it.

Rather you use your own PID code, the PID Class, or PID with CANJags, best of luck. Again, the CANjags are probably the best option.