btlib.bt_to_fsm.bt_to_fsm

Module Contents

Classes

Bt2FSM

Converts a Behavior Tree to a Finite State Machine.

Data

CONTROL_TYPE

DECORATOR_TYPE

API

btlib.bt_to_fsm.bt_to_fsm.CONTROL_TYPE = 'Enum(...)'
btlib.bt_to_fsm.bt_to_fsm.DECORATOR_TYPE = 'Enum(...)'
class btlib.bt_to_fsm.bt_to_fsm.Bt2FSM(bt: networkx.Graph)

Converts a Behavior Tree to a Finite State Machine.

Initialization

convert() networkx.DiGraph

Convert the Behavior Tree to a Finite State Machine.

_add_ports(fsm: networkx.DiGraph, node_id: int) Tuple[str, ...]

Add ports to the Finite State Machine.

These can then be used used to connect to the outside world during the conversion.

_wire_children_together(fsm: networkx.DiGraph, children: list, port_names: Tuple[str, ...], control_type: btlib.bt_to_fsm.bt_to_fsm.CONTROL_TYPE)

Wire the children of a control node to its ports.

This implements the logic of the control node.

_wire_child(fsm: networkx.DiGraph, child: networkx.DiGraph, port_names: Tuple[str, ...], decorator_type: btlib.bt_to_fsm.bt_to_fsm.DECORATOR_TYPE)

Wire the child of a decorator node to its ports.

This implements the logic of the decorator node.

_convert_subtree(node_id: int) networkx.DiGraph

Convert any subtree to a FSM by recursively calling this.

plot_fsm(fsm: networkx.DiGraph)

Plot the Finite State Machine.