
Nodes
Condition node:
- Contains a Boolean-valued variable.
- Value of True indicates success.
- Value of False indicates failure.
Action node:
-
Contains an action to be performed by the agent (e.g. robot).
-
Action execution status: running, success, failure.
Selector
- Child nodes are executed one by one from left to right.
- The next child node is executed if and only if all the previous child nodes failed.
Status of a selector node:
-
If one of the child nodes is successful, then success.
-
If one of the child nodes is running, then running.
-
If all child nodes failed, then failure.
-
Similar to logical OR operation.
Sequence
- Child nodes are executed one by one from left to right.
- The next child node is executed if and only if all the previous child nodes were successful.
Status of a sequence node:
-
If one of the child nodes fails, then failure.
-
If one of the child nodes is running, then running.
-
If all child nodes are successful, then success.
-
Similar to logical AND operation.
Reactivity
- The status of a behaviour tree is checked at a specific frequency known as the tick frequency.
- Ticking begins at the root node and flows through the tree according to the logic of the control nodes.
- If the status of any condition nodes or action nodes has changed, then it can be detected in the next ‘tick’.
- Any change will automatically cause the ongoing actions to be aborted or other actions to be started, depending on the control logic encoded in the tree.
Additonal Infos
-
Introduced by the gaming industry to model the behaviour of non-player characters. (NPC)
-
The following libraries have been used in robotics:
- BehaviorTree.CPP (written in C++)
- Source code: https://github.com/BehaviorTree/BehaviorTree.CPPDocumentation
- Documentation: https://www.behaviortree.dev/
- Used in the ROS 2 Navigation Stack (See here)
- py_trees (wirtten in Python 3)
- Source code: https://github.com/splintered-reality/py_trees
- Documentation: https://py-trees.readthedocs.io/en/devel/
- BehaviorTree.CPP (written in C++)