Skip to main content

Behavior Trees & Task-Level Safety

Duration: 45 min · Level: Intermediate · Module: 8. Safety & Human-Robot Interaction · Focus: behavior-trees, task-planning, safety, ROS2

Learning objectives

By the end of this lesson you will be able to explain and apply:

  • Behavior Trees
  • Safety conditions as BT nodes
  • BTlib and BehaviorTree.CPP
  • Formal verification
  • SMACH and FlexBE

Why this matters

Safety is not just a hardware concern — robot behavior must be safe at the task planning level.

Overview

Safety is not just a hardware concern — robot behavior must be safe at the task planning level. Behavior Trees (BTs) provide a modular, verifiable framework for robot task execution with explicit failure handling and safety checks at every node.

Key concepts

Key idea

Behavior Trees: directed acyclic graph of control nodes (Sequence, Fallback, Parallel) and leaf nodes (Actions, Conditions); composable and verifiable

  • Safety conditions as BT nodes: "CheckHumanInWorkspace" as a condition node that returns Failure if human too close; inserted as precondition for all motion sequences
  • BTlib and BehaviorTree.CPP: popular open-source BT implementations with ROS 2 integration; Nav2 (navigation) uses BTs for all decision-making
  • Formal verification: BTs can be model-checked against safety properties using formal methods; verify "robot never exceeds 65N contact force" across all possible execution paths
  • SMACH and FlexBE: alternative state machine frameworks; less modular than BTs but widely used; BTs preferred for safety-critical applications due to clear failure propagation
  • Healthcare task example: "Deliver medication" BT: verify patient identity → check medication → navigate to patient → confirm patient alert → hand medication → log action

Check your understanding

Try to recall each answer before expanding it.

Q1. What do you know about Behavior Trees?

directed acyclic graph of control nodes (Sequence, Fallback, Parallel) and leaf nodes (Actions, Conditions); composable and verifiable

Q2. What do you know about Safety conditions as BT nodes?

"CheckHumanInWorkspace" as a condition node that returns Failure if human too close; inserted as precondition for all motion sequences

Q3. What do you know about BTlib and BehaviorTree.CPP?

popular open-source BT implementations with ROS 2 integration; Nav2 (navigation) uses BTs for all decision-making

Q4. What do you know about Formal verification?

BTs can be model-checked against safety properties using formal methods; verify "robot never exceeds 65N contact force" across all possible execution paths

Q5. What do you know about SMACH and FlexBE?

alternative state machine frameworks; less modular than BTs but widely used; BTs preferred for safety-critical applications due to clear failure propagation


← Previous: 8.2 Compliant Control & Force-Limiting Architecture · Next: 8.4 Ethical AI & Trust in Humanoid Systems

Part of Module 8: Safety & Human-Robot Interaction.