Thread: Multiple Autons
View Single Post
  #2   Spotlight this post!  
Unread 03-03-2010, 02:01
davidalln's Avatar
davidalln davidalln is offline
World's Worst Coder
AKA: David Allen
FRC #2415 (The Westminster Wiredcats)
Team Role: Programmer
 
Join Date: Mar 2009
Rookie Year: 2008
Location: Atlanta, GA
Posts: 108
davidalln is on a distinguished road
Send a message via AIM to davidalln
Re: Multiple Autons

The simplest way to do this is to have a switch/case taking in a variable that you predetermine before a match and having the separate autonomous modes there. For example...

Code:
int position = 1;
switch(position) {
  case 1:
    // autonomous mode for close
    break;
  case 2:
    // autonomous mode for mid
    break;
  case 3:
    // autonomous mode for far
    break;
}
It is also legal to have a "switch" of some sorts on your robot plugged into your sidecar that you flip before the match as you set up your bot to determine position (in which case your code would still look similar to the code above).
__________________
SANTOSH ANDREW DECKER RICK WYNNIE SEAN DEREK MATT
(alamo (semis), p'tree (CHAMPS!), nc (CHAMPS!), newton (quarters))


Best four years of my life. Thanks to everyone who made it happen.
Reply With Quote