View Single Post
  #12   Spotlight this post!  
Unread 27-01-2016, 14:32
grainne grainne is offline
Lead Programmer
FRC #0811 (Team 811 Cardinals)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: New Hampshire, United States
Posts: 10
grainne is an unknown quantity at this point
Re: Drive train PID control

Quote:
Originally Posted by curtis0gj View Post
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
Attached Files
File Type: java Drive.java (5.7 KB, 22 views)
Reply With Quote