|
Re: No Robot Left Behind 2014
Iterative Robot:
Code:
public class RobotTemplate extends IterativeRobot {
/**
* This function is called at the beginning of autonomous
*/
private static final long DRIVE_FORWARD_TIME_IN_MILLS = 0;
private static final double DRIVE_FORWARD_SPEED = .2;
private long startTime = 0;
public void autonomousInit() {
startTime = System.currentTimeMillis();
}
/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic() {
//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();
}
}
}
__________________
"Never let your schooling interfere with your education" -Mark Twain
|