|
Re: No Robot Left Behind 2014
Simple Robot:
Code:
public class RobotTemplate extends SimpleRobot {
/**
* This function is called once each time the robot enters autonomous mode.
*/
private static final long DRIVE_FORWARD_TIME_IN_MILLS = 0;
private static final double DRIVE_FORWARD_SPEED = .2;
private long startTime = 0;
public void autonomous() {
startTime = System.currentTimeMillis();
while(isOperatorControl() && isEnabled()){
//drive forward for the first n milliseconds of autonomous
if(System.currentTimeMillis() - startTime < DRIVE_FORWARD_TIME_IN_MILLS){
drive.driveForward(DRIVE_FORWARD_SPEED);
}else{
drive.stop();
}
Timer.delay(0.01);
}
}
}
__________________
"Never let your schooling interfere with your education" -Mark Twain
|