Fixed some bugs when recentering the camera.
This commit is contained in:
@@ -123,7 +123,8 @@ public class NxtAR_bot{
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void buttonPressed(Button b){
|
public void buttonPressed(Button b){
|
||||||
quit();
|
System.exit(0);
|
||||||
|
//quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -113,12 +113,12 @@ public class MotorControlThread extends Thread{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(recenterMotorB){
|
if(recenterMotorB){
|
||||||
// Return motor B to it's origin. Rotate in the direction
|
System.out.println("RECENTER");
|
||||||
// that implies less movement.
|
// Return motor B to it's origin.
|
||||||
|
Motor.B.setSpeed(50 * Battery.getVoltage());
|
||||||
tacho = Motor.B.getTachoCount() % 360;
|
tacho = Motor.B.getTachoCount() % 360;
|
||||||
rotation = tacho > 180 ? 360 - tacho : -(tacho);
|
rotation = -(tacho);
|
||||||
Motor.B.rotate(rotation);
|
Motor.B.rotate(rotation, false);
|
||||||
Motor.B.resetTachoCount();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch(IOException io){
|
}catch(IOException io){
|
||||||
|
|||||||
Reference in New Issue
Block a user