Quote:
Originally Posted by curtis0gj
Hello, my team this is looking at solutions for driving more accurately in autonomous. At this moment we are using this to drive a certain distance in autonomous.
Code:
if (encoderDistanceReading >= distance) {
tankDrive.drive(0, 0);
return;
} else if (distance > encoderDistanceReading) {
tankDrive.drive(-0.25, 0);
} else {
tankDrive.drive(0.25, 0);
}
I am curious about using PID control to drive in autonomous with an encoder for input. I have looked at the Potentiometre PID example and read a bit about PID control ( https://wpilib.screenstepslive.com/s...s-pid-control).
Our team is currently using the iterative robot template. The drive train is a four motored tank drive with 8 inch pneumatic tires. I have one encoder setup on the left small output shaft. We have a second encoder coming soon.
|
My team did this last year, and will probably do it again this year. I have attached the code for our drive train - we have a driveAuto method that would drive a number of inches passed as a parameter.
Our pid loop took a lot of time to tune, and we used mecanum drive, so please be aware of that.
Hope this helps