Go to Post A few years of stress is worth a lifetime of opportunity. - omegasis25 [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
  #8   Spotlight this post!  
Unread 02-09-2012, 10:21 PM
NS_Radication's Avatar
NS_Radication NS_Radication is offline
Student
AKA: Marco Schoener
FRC #1369 (Minotaur)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Tampa
Posts: 88
NS_Radication is an unknown quantity at this point
Re: Set command to run for a certain amount of time

You could try this. This worked for me when I had your EXACT problem.

Code:
public void autonomous()
{
    Timer.start() //starts a timer at 0 seconds
    while(isAutonomous() && isEnabled()) //run when autonomous is Clive and you are enabled
    {
        if(Timer.get() < time) //time is a double in terms of seconds
        {
            driveVariable.drive(speed, curve); //move robot at this speed with/without curve
        }
        Timer.delay(0.005); //does nothing for 5 seconds but helps refresh motors in loop
    }
    Timer.stop() //stops timer
}
Good luck and happy competition!
__________________
Team 1369
Senior
Head Programmer (Java)
Head Electrician
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 07:43 AM.

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