GT RoboCup SSL
Soccer software, robot firmware
gameplay.fsm.StateMachine Class Reference

generic hierarchial state machine class. More...

Public Member Functions

def __init__ (self, start_state)
 
def start_state (self)
 
def restart (self)
 Resets the FSM back into the start state.
 
def add_state (self, state, parent_state=None)
 Registers a new state (which can optionally be a substate of an existing state)
 
def spin (self)
 Runs the FSM checks transition conditions for all edges leading away from the current state if one evaluates to true, we transition to it if more than one evaluates to true, we throw a RuntimeError.
 
def add_transition
 
def transition (self, new_state)
 
def is_in_state (self, state)
 
def state_is_substate (self, state, possible_parent)
 
def corresponding_ancestor_state (self, ancestors)
 
def ancestors_of_state (self, state)
 
def as_graphviz (self)
 
def write_diagram_png
 
def state (self)
 

Detailed Description

generic hierarchial state machine class.

states can have substates. If the machine is in a state, then it is also implicitly in that state's parent state this basically provides for polymorphism/subclassing of state machines

There are three methods corresponding to each state:

  • on_enter_STATE
  • execute_STATE
  • on_exit_STATE

Subclasses of StateMachine can optionally implement them and they will automatically be called at the appropriate times.

+ Inheritance diagram for gameplay.fsm.StateMachine:

The documentation for this class was generated from the following file: