  We propose a hybrid combination of active inference and behavior trees (BTs)
for reactive action planning and execution in dynamic environments, showing how
robotic tasks can be formulated as a free-energy minimization problem. The
proposed approach allows handling partially observable initial states and
improves the robustness of classical BTs against unexpected contingencies while
at the same time reducing the number of nodes in a tree. In this work, we
specify the nominal behavior offline, through BTs. However, in contrast to
previous approaches, we introduce a new type of leaf node to specify the
desired state to be achieved rather than an action to execute. The decision of
which action to execute to reach the desired state is performed online through
active inference. This results in continual online planning and hierarchical
deliberation. By doing so, an agent can follow a predefined offline plan while
still keeping the ability to locally adapt and take autonomous decisions at
runtime, respecting safety constraints. We provide proof of convergence and
robustness analysis, and we validate our method in two different mobile
manipulators performing similar tasks, both in a simulated and real retail
environment. The results showed improved runtime adaptability with a fraction
of the hand-coded nodes compared to classical BTs.
