Fixed some bugs when recentering the camera.

This commit is contained in:
2014-04-04 10:32:29 -04:30
parent 1481ebe349
commit 50278109eb
2 changed files with 9 additions and 8 deletions

View File

@@ -122,8 +122,9 @@ public class NxtAR_bot{
* Force quit.
*/
@Override
public void buttonPressed(Button b) {
quit();
public void buttonPressed(Button b){
System.exit(0);
//quit();
}
/**

View File

@@ -113,12 +113,12 @@ public class MotorControlThread extends Thread{
}
if(recenterMotorB){
// Return motor B to it's origin. Rotate in the direction
// that implies less movement.
System.out.println("RECENTER");
// Return motor B to it's origin.
Motor.B.setSpeed(50 * Battery.getVoltage());
tacho = Motor.B.getTachoCount() % 360;
rotation = tacho > 180 ? 360 - tacho : -(tacho);
Motor.B.rotate(rotation);
Motor.B.resetTachoCount();
rotation = -(tacho);
Motor.B.rotate(rotation, false);
}
}catch(IOException io){