Thread: Autonomous
View Single Post
  #3   Spotlight this post!  
Unread 18-02-2014, 22:37
NWChen's Avatar
NWChen NWChen is offline
Alum
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: New York City
Posts: 205
NWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to behold
Re: Autonomous

Quote:
Originally Posted by Dinnesy View Post
Your autonomous function should look like

Code:
 
public void autonomous() {

     while(isAutonomous()){  //Place everything in a loop.
        robotDrive.drive(0.5,0.0);//drive at 50% speed 0% turn
        Timer.delay(5.0);//wait 5 seconds
     }
You don't need to iterate in autonomous; assuming you have a sequence of statements (e.g. drive forwards, stop, shoot) they should only execute once each. Look at this example.

Try the following instead:
Code:
public void autonomous() {
        robotDrive.setSafetyEnabled(false);
        robotDrive.drive(0.5,0.0);//drive at 50% speed 0% turn
        Timer.delay(5.0);//wait 5 seconds
}
When setSafetyEnabled is true (by default it is), the robot won't drive if the code continues for too long. That's probably causing your robot to stop entirely after ~0.1 seconds.

Last edited by NWChen : 18-02-2014 at 22:40.
Reply With Quote