Skip to content

Add subtree registration system - #4

Merged
zeerekahmad merged 6 commits into
mainfrom
3-zeerekahmad-register-subtrees
Aug 4, 2026
Merged

Add subtree registration system#4
zeerekahmad merged 6 commits into
mainfrom
3-zeerekahmad-register-subtrees

Conversation

@zeerekahmad

@zeerekahmad zeerekahmad commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Adds file-based subtree (behavior tree XML) plugin support. Plugin packages can now ship reusable subtree .xml files that BT::PluginAwareFactory auto-discovers and registers on construction, so any tree loaded afterward can reference them "for free" via <SubTree ID="..."/> — mirroring how node plugins already work.

  • PluginAwareFactory gains a second load step (after node registration) that discovers subtree XML through a new behaviortree_cpp_subtrees ament resource-index category and registers each via registerBehaviorTreeFromFile. A malformed or unresolvable subtree is logged and skipped rather than aborting construction.
  • Ordering is intentional: all node types register before any subtree XML, because BT.CPP verifies XML at registration time and rejects subtrees referencing an unregistered node. <SubTree> references resolve lazily, so subtree-to-subtree order doesn't matter.
  • New CMake API: a SUBTREES <files...> keyword on register_behaviortree_cpp_plugin() for subtrees co-shipped with a node plugin, plus a standalone register_behaviortree_cpp_subtrees(NAME <suffix> FILES <files...>) for node-less packages. Both install the XML and register a per-call-unique ament marker.
  • Subtrees are treated as pure data — no change to BT::BehaviorTreePlugin — so no plugin-base vtable/ABI change and already-compiled plugin .sos stay compatible. ament_index_cpp is added as a PRIVATE dependency.

Migration Guide

None — the change is purely additive. Existing plugins and consumers build and behave unchanged; the new SUBTREES keyword and register_behaviortree_cpp_subtrees() function are optional.

Related issues

Closes #3

Completeness checklist

  • Is there test coverage? If it was a bugfix, is there a regression test?
  • Is user-facing API/behavior documented?
  • Is core documentation updated?
  • Are all checks green?
  • Assign reviewers to the PR and post in #code_reviews

@zeerekahmad zeerekahmad self-assigned this Aug 4, 2026

@emersonknapp emersonknapp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one request: an addition to README.md about this feature

@zeerekahmad
zeerekahmad merged commit f7fd4fd into main Aug 4, 2026
5 of 9 checks passed
@zeerekahmad
zeerekahmad deleted the 3-zeerekahmad-register-subtrees branch August 4, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Register Subtree Plugins

2 participants