View Single Post
  #13   Spotlight this post!  
Unread 04-03-2015, 09:17
Joe Derrick's Avatar
Joe Derrick Joe Derrick is offline
Mentor - Programming
FRC #0319
 
Join Date: Feb 2012
Rookie Year: 2011
Location: Prospect Mountain High School
Posts: 48
Joe Derrick is a glorious beacon of lightJoe Derrick is a glorious beacon of lightJoe Derrick is a glorious beacon of lightJoe Derrick is a glorious beacon of lightJoe Derrick is a glorious beacon of lightJoe Derrick is a glorious beacon of light
Re: JAVA code to drive straight using H-drive

sure

Quote:
public double getDegreesFromEncoderValues(){

double leftDistance = Robot.drivetrain.leftEncoder.getDistance();
double rightDistance = Robot.drivetrain.rightEncoder.getDistance();
double robotArcLength = (leftDistance-rightDistance)/2;
double robotDegrees = 360*(robotArcLength/(Math.PI*wheelbase);

return robotDegrees;
}
__________________
2010-2017 Mentor Team 319
2012 - Rockwell Automation Award Winner
2014 - Xerox Creativity in Engineering Winner, Archimedes Division
2015 - Rockwell Automation and Gracious Proffesionalism Winner, Tesla Division
2016 - North Shore and UNH District Event Winner, Carson Division
http://www.frc319.com
Reply With Quote