
BehaviorTree.CPP
Behavior Trees Library in C++. Batteries included.
Sign in to rate this tool.
Overview

BehaviorTree.CPP is a C++ library that lets you build robot behavior logic using behavior trees. The site positions it as the industry standard for reactive, modular, and debuggable robot behaviors and notes that it is used by robotic frameworks such as Nav2 and MoveIt. The project is free, MIT‑licensed, and called the most popular production‑ready framework for building robotic behavior.
The core idea is to separate the tree definition from the implementation. You write an XML file that describes the tree's nodes and the flow of execution. Each node is a C++ class that is compiled into a shared library. At runtime the tree is parsed from XML, the appropriate nodes are instantiated, and the tree executes in a loop. The loop keeps the whole system responsive because node callbacks return immediately, asynchronous actions do not block the tree. If a node needs to perform a long calculation or wait for a sensor reading, it can report its status as RUNNING until the action completes, while other parts of the tree keep working.
BehaviorTree.CPP's modular architecture allows you to load new node libraries at launch without recompiling the whole program. Custom nodes for specific hardware are often supplied by users as shared objects; the library simply loads them based on the names declared in XML. The default set of nodes covers things like moving a robot to a coordinate or checking a sensor, but you can write any logic you need in C++ and expose it as a node.
Built‑in logging records every state transition with timestamps. The output file can be replayed later; debugging tools reconstruct the state machine and show which node transitioned at which time. The Groot2 visual editor provides drag‑and‑drop node placement, real‑time monitoring on a robot, and the ability to pause execution, set breakpoints, and inject faults. These features are designed for rapid prototyping and diagnosis, which is useful for developers who need to iterate on behavior quickly.
The library is ROS‑agnostic, but the website highlights a dedicated ROS2 integration that makes it the most widely used behavior‑tree library in ROS2. The integration layer provides ROS2 action interface adapters so nodes can call ROS2 services or action servers.
Details
- Pricing
- Free
- Last checked
- 19h ago
- Indexing
- noindex, follow
Suggest an edit
Sign in to suggest an edit.
Pros and cons
Pros
- MIT open‑source license, free to use
- Widely adopted by Nav2, MoveIt, and other robotics stacks
- Supports asynchronous actions, keeping loops responsive
- Logging and replay simplify debugging
Cons
- No pricing information (completely free)
- ROS2 integration is highlighted; other middleware support is not documented
- Custom node development requires C++ knowledge
- XML tree editing may need manual changes if not using Groot2

