mlpy.agents.fsm.StateMachine.add_transition¶
-
StateMachine.
add_transition
(event, source, dest, conditions=None, before=None, after=None)[source]¶ Add a transition from a source state to a destination state.
Parameters: event : str
The event driving the transition.
source : str
The source state.
dest : str
The destination state.
conditions : list[callable]
The conditions that must be met for transition to execute.
before : callable
Callback function to be called before exiting the source state.
after : callable
Callback function to be called after entering the source state.
Raises: ValueError
If the source or the destination is not a registered state.
Notes
By setting source to *, the callbacks will be called for all states.