Abstract
Behavior Trees (BTs) have become a popular framework for designing controllers of autonomous agents in the computer game and robotics industries due to their modularity. However, the classical Parallel operator is rarely used because concurrent actions often lead to resource conflicts and synchronization issues similar to those in concurrent programming. This paper introduces Concurrent Behavior Trees (CBTs), a generalization of BTs that incorporates notions of progress and resource usage. We demonstrate how CBTs allow for safe concurrent execution and provide mathematical proofs for deadlock-free and starvation-free operations, illustrated through robotics use cases.
The Concurrency Challenge in Robotics
In robotics and game AI, Behavior Trees (BTs) build complex behaviors from simple, modular actions using operators like Sequence, Fallback, and Parallel. While the Parallel operator—which executes multiple tasks simultaneously—offers significant potential for sophisticated behavior, it is notoriously difficult to implement safely.
When a robot attempts multiple tasks at once, it faces two primary hurdles:
- Process Synchronization: For instance, if a robot navigates a hallway while scanning for objects, it might drive too fast for the scanner to process images effectively.
- Resource Conflicts: If an obstacle-avoidance routine and a low-battery routine both attempt to use the robot's single speaker simultaneously, the system clashes.
Because standard BTs treat parallel branches as entirely independent, developers often avoid the Parallel operator altogether to prevent these messy realities of concurrent execution.
Proposed Solution: Concurrent Behavior Trees (CBTs)
To address these issues, the authors propose extending standard BTs into Concurrent Behavior Trees (CBTs). This framework adds two user-defined functions to every node in the tree:
- Progress Function: A value between 0 and 1 indicating how close a task is to completion.
- Resource Function: A list of critical hardware or software resources required by the task (e.g., "camera," "speaker").
Using these properties, the authors introduce two novel Parallel operators:
- Synchronized Parallel (ParallelSync): Acts as a "barrier" by only ticking child nodes that are at the minimum progress level, ensuring tasks stay in sync.
- Mutually Exclusive Parallel (ParallelMutex): Manages resource conflicts by checking if required resources are busy. It employs an "aging" policy to prevent starvation, ensuring low-priority tasks eventually gain access to hardware.
Key Insights and Results
The CBT framework successfully bridges operating system concepts—such as mutexes, barriers, and aging—with robotics AI. By treating BT "Ticks" as a form of process scheduling, developers can implement safe concurrency directly within the tree structure.
The primary results of this work are mathematical guarantees. The authors prove that ParallelSync successfully synchronizes progress-independent BTs and that ParallelMutex is strictly deadlock-free and starvation-free.
In qualitative use cases, such as a robot navigating a dark room, the framework demonstrates its utility. The robot can monitor light levels and the presence of people simultaneously. If it needs to ask for better light or ask someone to move, ParallelMutex manages the robot's single speaker, prioritizing requests dynamically without dropping tasks or crashing.
Limitations and Future Work
While CBTs provide a robust mathematical foundation, practical implementation requires careful design. Defining continuous "Progress Functions" for binary tasks can be difficult, and tuning priority values for resource management currently requires manual developer effort. Furthermore, the framework assumes that robotic actions can be paused or halted cleanly. Future work will focus on empirical testing on physical multi-tasking robots to further validate these theoretical advancements.
Summary updated