Go to Post The Robot Alliance Project is perpetrating the government shutdown? I KNEW robots would take over the world! - BBray_T1296 [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
  #1   Spotlight this post!  
Unread 20-01-2014, 17:05
mmolo mmolo is offline
Registered User
FRC #4241
 
Join Date: Jan 2014
Location: Joliet
Posts: 2
mmolo is an unknown quantity at this point
Java Autonomous Periodic

Hey everyone, my team is just starting to code our robot in Java. We have some decent Java experience, but we have a question about how autonomousPeriodic is ran. Basically, since the Periodic methods are going to be called every ~20ms if we have code like this:
Code:
    
public void autonomousPeriodic() {
        drive.drive(0.5, 0.0);
        Timer.delay(3000);
        drive.drive(0.0, 0.0);
        piston.set(true);
        Timer.delay(2000);
        piston.set(false);
    }
Will this code be called every 20ms and attempt to drive forward and set the pistons 50 times per second?

If so I'm guessing we would just have to wrap it in an if statement that will set a boolean that it's checking to false as soon as it runs, so it only runs the first time.

Thanks in advance!
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 11:07.

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