betfsm.Generator

Bases: TickingState

Uses a python generator to define a TickingState. It implements methods entry, doo, and exit of TickingState using the given callback function (which is a python generator that can return intermediate results usig yield). This makes it easy to specify a TickingState.

Subclasses need to implement/override the abstract method co_execute(self, blackboard:Blackboard)

__init__(name, outcomes)

Parameters:
  • name (str) –

    name of the node

  • outcomes (List[str]) –

    a list of strings indicating the expected outcomes, TICKING and ABORT will be automatically added.

betfsm.GeneratorWithState

Bases: Generator

A Generator with one underlying states

__init__(name, outcomes, state)

Parameters:
  • name (str) –

    name of the node

  • outcomes (List[str]) –

    a list of strings indicating the expected outcomes, the outcomes of the underlying state are automatically added.

  • state (TickingState) –

    underlying state

betfsm.GeneratorWithList

Bases: Generator

A generator with some facilities to maintain an ordered list of children

__init__(name, outcomes, children=[])

Parameters:
  • name (str) –

    name

  • outcomes (List[str]) –

    list of possible outcomes (in addition to the outcomes of the underlying states)

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

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

add_state(state)

adds a state to the sequence parameters: state: state intance returns: self (to allow method chaining)

reset()

resets the sequence and ensures tht the underlying states are also reset.