In autonomous, i try to run the following code:
try {
encLeft.start();
encRight.start();
encLeft.reset();
encRight.reset();
while (((encLeft.getRaw() > -14797) || (encRight.getRaw() > -14797)) && (this.isAutonomous())) {
//System.out.println("Left:" + encLeft.getRaw() + " Right:" + encRight.getRaw());
if (encLeft.getRaw() < 14797) {
motor_leftFront_J.setX(.5);
motor_leftRear_J.setX(.5);
} else {
motor_leftFront_J.setX(0);
motor_leftRear_J.setX(0);
}
if (encRight.getRaw() < 14797) {
motor_rightFront_J.setX(-.5);
motor_rightRear_J.setX(-.5);
} else {
motor_rightFront_J.setX(0);
motor_rightRear_J.setX(0);
}
}
Timer.delay(.5);
encLeft.reset();
encRight.reset();
}catch(Exception e){
}
The output this produces is a very jittery running of the code, as if it sends the commands, and then immediately after sends it a stop command, following which it repeats. The teleop code works fine, so i know that it is updating the output frequent enough, and it never catches any errors… Any thoughts? Thanks
~Matt Clark