|
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.
|