View Single Post
  #10   Spotlight this post!  
Unread 02-20-2015, 08:28 PM
curtis0gj curtis0gj is offline
Registered User
FRC #5033 (Beavertronics)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2015
Location: Canada
Posts: 121
curtis0gj will become famous soon enough
Re: functions for auto

Quote:
Originally Posted by Arhowk View Post
here's what I'd do

Code:
public static void turn(Robot r, double deg) {
   if(deg < gyro.getAngle()){ //this is not right, need to have a function to handle rollovers
   //example for such a function: if Math.abs(deg-gyro.getAngle()) < 90 || Math.abs(deg-gyro.getAngle()) > 270
   //i dont know, just thinking to myself. see here for further instructions -> http://stackoverflow.com/questions/1878907/the-smallest-difference-between-2-angles
         turnLeft(r,deg);
   }else{
         turnRight(r,deg);
   }
}
except without the broken formatting since I made that in this text editor and not a code editor

E/ misunderstood the point of the code, fixed.
So what will this whole function be used for calculating turns?
Reply With Quote