Thread: Autonomous Mode
View Single Post
  #9   Spotlight this post!  
Unread 08-02-2007, 13:15
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: Autonomous Mode

Quote:
Originally Posted by Zero_Cool View Post
don't forget the switch statement, which can be more useful or better for use in autonomous.
Indeed, it's very useful for programmers doing autonomous work to understand the concept of the finite state machine (http://en.wikipedia.org/wiki/Finite_state_machine), since that is one of the easiest ways to come up with a clearly written and debug-able autonomous routine.

Most of our routines end up looking something like:

Code:
switch (auto_state) {
	case INITIALIZE:
	  Auto_Initialize(); // Set up auto mode
          auto_state=FASTASPPROACH
	  break;
       case APPROACH: 
          // Code that drives towards goals quickly, and at some point
          // resets auto_state to SCORE
          break;
       case SCORE: 
          // Score many points!
	  break;  
	case DONE:
	default:
        // do nothing!
        
      break;
  }