View Single Post
  #4   Spotlight this post!  
Unread 04-03-2014, 16:48
mwtidd's Avatar
mwtidd mwtidd is offline
Registered User
AKA: mike
FRC #0319 (Big Bad Bob)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 2003
Location: Boston, MA
Posts: 714
mwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond reputemwtidd has a reputation beyond repute
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