Go to Post FIRST games are complex and rely on design and intellectual capability much more than the average sport. - Chris is me [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

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 29-01-2016, 16:11
icar icar is offline
Registered User
None #3603
 
Join Date: Jan 2016
Location: Europe
Posts: 1
icar is an unknown quantity at this point
How to program autonomous

Hello
What is a good and efficient way to program a time based autonomous program in an iterative robot base class? More specifically, could anyone show me what an example code would look like if I for example wanted to make my tankdrive, four motor robot, drive forward for two seconds and then turn for one second and then stop?
Any help would be greatly appreciated.
Reply With Quote
  #2   Spotlight this post!  
Unread 29-01-2016, 16:31
rich2202 rich2202 is offline
Registered User
FRC #2202 (BEAST Robotics)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Wisconsin
Posts: 1,171
rich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond reputerich2202 has a reputation beyond repute
Re: How to program autonomous

Read about the Timer Class.

Set a timer when you start your motors.
Each loop (autonomous periodic), check the timer.
When you reach the desired time mark, do something.

FYI: You might also want to put encoders on your motors, and check the distance (revolutions) the encoders say you went.
Reply With Quote
Reply


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 10:52.

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