View Single Post
  #4   Spotlight this post!  
Unread 08-12-2008, 17:37
slavik262's Avatar
slavik262 slavik262 is offline
We do what we must because we can.
AKA: Matt Kline
FRC #0537 (Charger Robotics)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Sussex, WI
Posts: 310
slavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to beholdslavik262 is a splendid one to behold
Send a message via AIM to slavik262
Re: Simple C++ State Machine

When you talk about iterative being similar to how you've programmed in the past, are you referring to the default code of previous years? WPILib was available for the past two years and previous versions resemble the "Simple Robot" class much more than interative.

At any rate,

It's possible I'm not understanding this properly but why would you create a specialized class to handle this? Can't information that you need to be maintained between iterations be kept as members of your robot class itself without having to be dynamically allocated? While the stacks for the functions may be popped off as you go through iterations, isn't the original instance of the entire class used throughought the running of the program? Wouldn't it be much simpler to use a simple switch statement in your periodic functions with an enumerator to determine which function to call at the appropriate time?
__________________

Last edited by slavik262 : 08-12-2008 at 17:40.