Go to Post Know what really grinds my gears? Metal Shavings. - Briansmithtown [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
  #4   Spotlight this post!  
Unread 18-02-2014, 22:49
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: Autonomous

Another option would be to use the system clock:

We used similar code on an alliance partner's robot at week 0 and it worked flawlessly.

Code:
public void autonomous() {
     long startTime = System.currentTimeMills();
     while(isAutonomous()){  //Place everything in a loop.
        long timePassed = System.currentTimeMills() - startTime;
        if(timePassed < 5000){
                //in the first 5 seconds of auto
                robotDrive.drive(0.1,0.0);
        }else {
                robotDrive.drive(0,0.0);
        }
        Timer.delay(.05);
     }
This code should not cause any drive not updated enough issues because the delay is only .05 second, and you should still be able to have the safety enabled.

Also you'll noticed I chanced the speed to .01, you only need to cross the line, so I would slowly increment the speed until it matches your needs. Driving at half speed for 5 seconds could have some unintended consequences.
__________________
"Never let your schooling interfere with your education" -Mark Twain

Last edited by mwtidd : 18-02-2014 at 22:54.
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 13:23.

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