Goulib.statemachine module¶
state machines with graph representation
-
class
Goulib.statemachine.
StateDiagram
(name=None, comment=None, filename=None, directory=None, format=None, engine=None, encoding=None, graph_attr=None, node_attr=None, edge_attr=None, body=None, strict=False)[source]¶ Bases:
graphviz.dot.Digraph
helper to write State Diagrams graph in iPython notebook This library uses Graphviz that has to be installed separately (http://www.graphviz.org/)
-
class
Goulib.statemachine.
Simulation
[source]¶ Bases:
object
all simulation should derive from this class that has some helper
-
setOutput
(h1=<function noPrint>, h2=<function noPrint>, h3=<function noPrint>, h=<function noPrint>, hinfo=<function noPrint>, hsuccess=<function noPrint>, hwarning=<function noPrint>, herror=<function noPrint>, displayState=<function noPrint>, displayObj=<function noPrint>, displayPlot=<function noPrint>)[source]¶
-
-
class
Goulib.statemachine.
StateChangeLog
(newState)[source]¶ Bases:
Goulib.statemachine.EventLog
-
class
Goulib.statemachine.
WaitLog
(untilTime, waitForWhat)[source]¶ Bases:
Goulib.statemachine.EventLog
-
class
Goulib.statemachine.
TooLateLog
(pastTime, missedWhat)[source]¶ Bases:
Goulib.statemachine.EventLog
-
class
Goulib.statemachine.
StateMachine
(simulation=None, name=None, background_color='#F5ECCE')[source]¶ Bases:
object
-
checkOnTimeAndWait
(time, what)[source]¶ checks that the self.time < time if this is not the case an error will be logged with the message
-
run
(start=0, stops=[], startTime=None, maxSteps=100000, maxTime=<Quantity(1000, 'second')>)[source]¶ runs the behavioral simulation :params start: is the starting state of the simulation :params stops: a list of states that will stop the simulation (after having simulated this last state) :params startTime: a time to start this run if None takes self.time :params maxState: is the number of states being evaluated before the end of simulation :params maxTime: is the virtual time at which the simulation ends_in_comment_or_string :params displayStates: at every new state, display the state in Notebook as well as the time when entered :params displayMove: if True, every actuator.move displays the graph of the move
returns the time when run finishes
-