bt-subtree-composition

Modularize ROS 2 behavior trees into reusable SubTree blocks.

18|2|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/wimblerobotics/ros2-copilot-skills --skill bt-subtree-composition
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bt-subtree-composition
Source: https://github.com/wimblerobotics/ros2-copilot-skills/tree/main/bt-subtree-composition
Command: npx skills add https://github.com/wimblerobotics/ros2-copilot-skills --skill bt-subtree-composition

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Large behavior trees become unwieldy as monolithic XML files. Sub-tree composition enables:

  • Reuse: A "navigate with recovery" sub-tree used by patrol, docking, and exploration trees
  • Testing: Individual sub-trees can be tested in isolation
  • Team collaboration: Different engineers work on different sub-trees
  • Readability: Top-level tree reads like pseudocode when sub-trees have descriptive names

Core Features & Use Cases

  • Reuse: Store common sequences or recoveries as SubTree blocks that can be included in multiple BTs.
  • Testability: Validate each SubTree in isolation before integrating.
  • Library organization: Build a reusable library of BT components with clear remapping interfaces.

Quick Start

Wrap common behaviors into SubTree blocks and include them in your main behavior tree, then validate the integrated flow.

Frequently Asked Questions about bt-subtree-composition

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I split large ROS 2 behavior trees into manageable subtrees?

You can modularize large ROS 2 behavior trees by wrapping common sequences into reusable SubTree blocks and including them in your main XML tree. This breaks monolithic files into maintainable, readable components.

How do I test ROS 2 behavior tree subtrees in isolation?

Testing ROS 2 behavior tree subtrees in isolation involves validating each SubTree block independently before integrating it into the main tree. This ensures individual components like patrol or docking sequences function correctly.

Why use subtree composition in ROS 2 behavior trees?

Subtree composition in ROS 2 behavior trees enables code reuse across patrol, docking, and exploration tasks, improves team collaboration by allowing parallel development, and makes top-level trees read like readable pseudocode.

Can I reuse the same behavior tree subtree for navigation and docking in ROS 2?

Yes, you can reuse a single behavior tree subtree for navigation and docking in ROS 2 by storing common sequences or recoveries as SubTree blocks and including them across multiple main trees with port remapping.

How do I organize a reusable library of ROS 2 behavior tree components?

You organize a reusable library of ROS 2 behavior tree components by creating clear remapping interfaces for SubTree blocks, allowing different engineers to work on different sub-trees that integrate cleanly into main trees.

What are the limitations of splitting ROS 2 behavior trees into subtrees?

Splitting ROS 2 behavior trees into subtrees requires careful port remapping to ensure data flows correctly between the main tree and SubTree blocks. Integration testing is necessary to validate the combined flow after isolation testing.