betfsm.Sequence

Bases: GeneratorWithList

Implements a behaviortree-like Sequence node
  • success is SUCCEED outcome,
  • failure is any other outcome

There is a method add_state to add underlying nodes to the Sequence, these are executed in order.

If any node fails, this outcome is directly returned; if a node returns TICKING, the sequence returns TICKING; and if the node returns SUCCEED, the execution of the next node in the list is started (without any intermediate tick!).

stateDiagram-v2 classDef successClass fill:darkgreen,color:white classDef tickingClass fill:yellow,color:black classDef otherClass fill:darkorange,color:white classDef abortClass fill:darkred,color:white [*] --> Loop Loop --> state_1 : current_state==1 Loop --> state_2 : current_state==2 Loop --> SUCCEED : last state succeeded state_1 --> Loop : SUCCEED state_2 --> Loop : SUCCEED state_1 --> TICKING : TICKING state_2 --> TICKING : TICKING state_1 --> OTHER : OTHER outcome state_2 --> OTHER : OTHER outcome class SUCCEED successClass class OTHER otherClass class TICKING tickingClass class TIMEOUT abortClass

__init__(name, children=[])

Parameters:
  • name (str) –

    name of the sequence

  • children (List[TickingState], default: [] ) –

    a list of states you can use add_state(...) to add children.