Quote:
Originally Posted by team-4480
Oh I guess I just under the assumption we needed encoders to do PID. Cool that we don't!
So the online description is not the full code? If not, do you have a Github page or something because we use Python and don't have the necessary software to install nax-mxp example.
|
You would need encoders if you wanted to have PID control of each individual wheel's speed. Note that this can be a useful thing to have (kind of like traction control on a car).
But for rotate-to-angle, your feedback that drives the PID controller is the Yaw angle from the navX-MXP.
Anyways, the RotateToAngle Java example code is available on GitHub at:
https://github.com/kauailabs/navxmxp...team2465/robot
My understanding is that the java and python are very similar, so this should be a good starting point for you. There are some comments in the example code that discuss tuning the PID a bit.
PID is a _very_ useful thing to learn and get used to for programming control systems like those used in FIRST and in the real world, so I encourage you to spend the time to learn it. Focus first on understanding how the P (proportional) coefficient works. Then, once you understand that and the concept of undershoot and overshoot well, begin working on the I (integral) coefficient. Finally, if you find this is not good enough for your needs, begin looking at the D (derivative) coefficient.
A final bit of advice when tuning PID coefficients is to only change one coefficient at a time. The different coefficients "mix" together in ways that aren't always intuitive, so go slowly and take careful notes as you tune them.