betfsm.Repeat

Bases: GeneratorWithState

Repeats underlying state for maxcount times or until an outcome other than SUCCEED is reached.

stateDiagram-v2 direction LR classDef successClass fill:darkgreen,color:white classDef tickingClass fill:yellow,color:black classDef otherClass fill:darkorange,color:white state Repeat { [*] --> my_state state "State" as my_state my_state --> my_state : succeed } [*] --> Repeat my_state --> SUCCEED : #succeed > maxcount my_state --> OTHER : other outcome my_state --> TICKING : ticking class SUCCEED successClass class OTHER otherClass class TICKING tickingClass
Note: There is no tick between the repetitions. If you have an underlying state that directly returns SUCCEED, the sequence will be executed without ticks.

__init__(name, maxcount, state)

Repeats underlying state for maxcount times or until an outcome other than SUCCEED is reached

Parameters:
  • name (str) –

    name of the instance

  • maxcount (int) –

    Maximum number of times that underlying state will be executed. -1 indicates that you want to loop forever.

  • state (TickingState) –

    underlying state