Skip to content

What are Behavior Trees?

Within AutoAPMS, the behavior tree paradigm is used for modeling robotic behaviors and task planning. We adopt the C++ implementation offered by BehaviorTree.CPP.

Generally speaking, behavior trees are composed of nodes (not ROS 2 nodes, but behavior tree specific nodes) that are assembled with respect to each other's position within the tree. They are considered the building blocks of a behavior tree. Various different types of nodes have been defined by different research results. We stick to the following definition:

Node TypeNumber of ChildrenDescription
ControlAt least 1Passes the tick to its children based on certain rules and takes each child's result status into account.
DecoratorExactly 1Executes a certain function before or after passing the tick to its child.
ConditionExactly 0Used for determining if a certain condition is met or not.
ActionExactly 0Performs work in an synchronous or asynchronous manner.

As you can see, Control and Decorator nodes are allowed to have nodes as children, so there is a parent-child relation. This property makes behavior trees hierarchically structured. When we speak of "ticking" a behavior tree node, it means that we invoke the tick callback function that is implemented by each node. This function always returns a status that must be one of the following:

StatusMeaning
SUCCESS or FAILUREThe node finished executing and the respective job either succeeded or failed.
RUNNINGThe node needs more time to determine the final result. This enables asynchronous execution.
SKIPPEDSpecial status for indicating that the parent node should not tick this node and proceed to the next one.

With these definitions you are able to create complex task plans. For example the behavior tree from the installation example looks like this:

Example behavior tree

For more information about behavior trees and their C++ implementation, refer to the documentation of the BehaviorTree.CPP project.

Released under the Apache-2.0 License.