Quote:
Originally Posted by Arhowk
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?