Multi-Robot Systems, HRI & Robot Software

behavior tree

A behavior tree is a tidy, branching diagram that a robot reads from the top down to decide what to do next, moment by moment. Picture a flowchart shaped like an upside-down tree: at the very bottom are the small concrete actions and checks — "walk to the door," "is the door open?", "pick up the box" — and above them are simple junction nodes that decide which of those to try and in what order. Each tick of the clock, the robot starts at the top and works its way down, and every node reports back one of a few simple answers: it succeeded, it failed, or it is still running. Those answers ripple back up and steer the next choice.

The clever part is just two kinds of junction. A sequence node says "do these in order, and stop if any one fails" — good for steps that must all happen, like open-the-gripper, then move-down, then close-the-gripper. A fallback (or selector) node says "try these one at a time until one works" — good for plans with backups, like try-the-front-door, else try-the-side-door, else ask-a-human. By nesting sequences and fallbacks, you can build rich, layered behavior out of these few simple pieces, and a designer can read the whole tree almost like a sentence.

Robot builders like behavior trees because they are modular and easy to change. Because each branch is self-contained, you can add a new skill, reorder priorities, or graft in an emergency "if battery low, go charge" branch near the top without untangling everything else — the tree naturally checks high-priority branches first. This is why behavior trees have largely replaced the older finite-state-machine style in game characters and many robots: a state machine wires every situation directly to every other, which grows into a tangle, whereas a behavior tree keeps the logic organized and reusable as the robot's repertoire grows.

A patrol robot's tree first checks a top "battery low → return to dock" fallback; only if the battery is fine does it run the sequence "go to next waypoint, scan the room, log anything new."

High-priority safety branches sit near the top, so they are checked first on every tick.

The signals a node can pass back are usually success, failure, and running; sequence and fallback (selector) nodes are the two basic ways to combine children.

Also called
BT行为树结构行為樹結構