View Single Post
  #1   Spotlight this post!  
Unread 25-02-2014, 22:44
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: ASAP HELP FOR AUTONOMOUS PROGRAMMING

I assume you're trying to score the 5 points for driving forward. We helped one of our alliance partners at week zero do this. Now it may vary a bit if your using simplerobot or iterative robot, but the approach is the same regardless. When your autonomous starts, store the current time. Then on each loop of autonomous check to see if the time is > 5 seconds. If it is stop the drive, otherwise drive forward slow.

Code:
private long startTime = 0;

//the first time autonomous executes (i.e. autonomous init)
startTime = System.currentTimeMills();

//on each loop/iteration
if(System.currentTimeMills() - startTime < 5000){
      //drive forward slow (.1 or .2 for a start)
}else{
      //stop the drive
}
__________________
"Never let your schooling interfere with your education" -Mark Twain
Reply With Quote