Quote:
Originally Posted by Arhowk
looks good, except for the fact that the "this" parameter is no longer necessary.
|
Alright I am going to transfer all the code onto the class mate and give it another check over to make sure I don't get any errors.
Okay I just copied it over into eclipse and I found a lot of little errors that I sorted out. But there are some bigger issues in the Auto and Robot class... I guess this is why I should use an IDE when making changes.
I fixed the first error still had one static void.
A second error is with !isAutonomous() and !isEnabled() and the IDE says "The method isEnabled(), isAutonomous() is undefined for the type Auto".
I think if I just add this to my constructor it will work or add robot.
A third error is with AUTOS in public void run(AUTOS autoMode) and the IDE says AUTOS cannot be resolved to a type.
^^ I think I had a little typo so I changed AUTOS to Autos I think this will fix it.
The fourth error in the Auto.java class is with every case that I have. The error is "AUTO_MOVE_TO_ZONE cannot be resolved to a variable" and this is an error for every case.
^^Changing AUTOS to Autos may also fix this.
The fifth error is with deg in double deltaAngle = angleError(deg, gyro.getAngle()); and Eclipse says "deg cannot be resolved to a variable".
The last error in Auto.java is the return err; and the error is "Void methods cannot return a value".
The only error in Robot.java is with auto.run(autoMethod); and the error is with run and the IDE says "The method run(AUTOS) from the type Auto refers to the missing type AUTOS".
^^I also believe this error will go aways when I change AUTOS to Autos.
Changing AUTOS to Autos fixed everything except the !isAutonomous and !isEnabled I don't know how to add them to the constructor.
^^ I just added robot. to both and it seems to work.
The only other error I am having is with:
Code:
private void angleError(double setpointDegressZeroToThreeSixty, double experimentalDegrees) {
double err = setpointDegressZeroToThreeSixty - experimentalDegrees; // 0 TO 360!
if(err < -180) {
err += 360;
} else if(err > 180) {
err -= 360;
}
return err;
}
double kp_rotate = 0.01;
double MAX_ERROR = 5;
private void turn(double deg) {
reset();
while(true) {
double deltaAngle = angleError(deg, gyro.getAngle());
if(Math.abs(deg - deltaAngle) < MAX_ERROR) {
break;
} else {
chassis.arcadeDrive(0, deltaAngle * kp_rotate);
}
Timer.delay(0.02);
}
}
The one error is with return err; and how void methods cannot return a value.
The other error is with double deltaAngle = angleError(deg, gyro.getAngle()); and how Type mismatch: cannot convert from void to double. And I can fix both of the errors by changing private void angleError to private double angleError.
https://github.com/curtis0gj/5033-2014-15