Go to Post You can be extra safe or you can be competative - its your choice. - Raul [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 11-02-2011, 09:07
Robby Unruh's Avatar
Robby Unruh Robby Unruh is offline
*insert random dial-up tone here*
FRC #3266 (Robots R Us)
Team Role: Coach
 
Join Date: Feb 2010
Rookie Year: 2010
Location: Eaton, OH
Posts: 338
Robby Unruh will become famous soon enough
Re: Issue with autonomous mode and some newbie questions

Your problem lies here:
Code:
for(int i =0; i < 10; i=+1){
    getWatchdog().feed();
    robotdrive.drive(1,0);
    Timer.delay(3);
    getWatchdog().feed();
}
You're using a timer delay in a loop. That means that everytime the loop is called (which is two, for whatever reason) you will have a 3 second delay. Plus, since you're wanting to drive for a set amount of time in autonomous, why not use the nifty Timer class?

Code:
Timer timer = new Timer(); // you should put this in your constructor.

public void autonomous() {
    while(isAutonomous()) {
        timer.start();
        while(timer.get() < 3) { // while the timer is < 3, drive forward.
            robotDrive.drive(1,0);
            timer.stop(); // stop the timer after 3 seconds
        }
        robotDrive.drive(0,0); // stop the robot from driving any further.
    }
}
__________________
[Robots R Us #3266]
2015: Georgia Southern Classic (Winners / Thanks 1319 & 1648!), Queen City
2014: Crossroads, Queen City
2013: Buckeye, Queen City, Crossroads
2012: Buckeye, Queen City

2011: Buckeye
2010: Buckeye
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 17:58.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi