intrinsic.solutions.behavior_tree.Branch
![]() View source on GitHub |
BT node of type Branch for behavior_tree_pb2.BehaviorTree.BranchNode.
Inherits From: Node
intrinsic.solutions.behavior_tree.Branch(
if_condition: Optional['Condition'] = None,
then_child: Optional[Union['Node', actions.ActionBase]] = None,
else_child: Optional[Union['Node', actions.ActionBase]] = None,
name: Optional[str] = None
)
A branch node has a condition and two designated children. On selection, it
evaluates the condition. If the condition is satisfied, the then child is
selected, otherwise the else child is selected.
Attributes | |
|---|---|
condition which indicates which child should be executed. | |
Child to execute if the condition succeeds. | |
Child to execute if the condition fails. | |
The proto representation of the node. | |
A string label of the node type. | |
Methods
create_from_proto
View source
@classmethodcreate_from_proto( proto_object: behavior_tree_pb2.BehaviorTree.Node ) -> 'Node'
Instantiates a Node instance from a proto.
disable_execution
View source
disable_execution(
result_state: Optional[intrinsic.solutions.behavior_tree.DisabledResultState] = None
) -> 'Node'
Disables a node, so that it is not executed and appears to be skipped.
| Args | |
|---|---|
| Optionally force the result of the execution to this state. If not set, the resulting state is automatically determined, so that the node is skipped. |
| Returns | |
|---|---|
Builder pattern, returns self. |
dot_graph
View source
dot_graph(
node_id_suffix: str = ''
) -> Tuple[graphviz.Digraph, str]
Generates a graphviz subgraph with a single node for self.
| Args | |
|---|---|
| A little string of form |
| The label is typically just the type of the node. To use a different value, this argument can be used. |
| name of the node as set by the user. |
| Returns | |
|---|---|
A tuple of the generated graphviz dot graph and the name of the graph's root node. |
enable_execution
View source
enable_execution() -> 'Node'
Enables a node, so that it will be executed.
| Returns | |
|---|---|
Builder pattern, returns self. |
generate_and_set_unique_id
View source
generate_and_set_unique_id() -> int
Generates a new random id and sets it for this node.
set_breakpoint
View source
set_breakpoint(
breakpoint_type: Optional['BreakpointType']
) -> 'Node'
Sets the breakpoint type on the decorator.
| Args | |
|---|---|
| desired breakpoint type, None to remove type. |
| Returns | |
|---|---|
Builder pattern, returns self. |
set_decorators
View source
set_decorators(
decorators: Optional['Decorators']
) -> 'Node'
set_else_child
View source
set_else_child(
else_child: Union['Node', actions.ActionBase]
) -> 'Branch'
set_if_condition
View source
set_if_condition(
if_condition: 'Condition'
) -> 'Branch'
set_then_child
View source
set_then_child(
then_child: Union['Node', actions.ActionBase]
) -> 'Branch'
show
View source
show() -> None
visit
View source
visit(
containing_tree: 'BehaviorTree',
callback: Callable[['BehaviorTree', Union['BehaviorTree', 'Node', 'Condition']], None]
) -> None