Refactor: Tree executor modularity#18
Merged
robin-mueller merged 15 commits intomasterfrom Mar 6, 2026
Merged
Conversation
…eature/event-based-executor
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the behavior tree executor architecture to improve modularity by introducing a reusable action-triggered executor template and moving shared executor logic into a generic base, while updating the existing TreeExecutorNode to use the new abstractions.
Changes:
- Added
ActionBasedTreeExecutorNode<ActionT>to generalize “action goal → tree execution” behavior. - Introduced
GenericTreeExecutorNode+TreeExecutorNodeOptionsas shared infrastructure (parameters, build handler loading, command action, blackboard sync). - Extended
TreeBuilderwith aninstantiate(TreeElement, ...)overload and updated build configuration to compile the new sources.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| auto_apms_behavior_tree_core/src/builder.cpp | Adds TreeBuilder::instantiate(TreeElement, ...) implementation. |
| auto_apms_behavior_tree_core/include/auto_apms_behavior_tree_core/builder.hpp | Declares the new instantiate(TreeElement, ...) API and updates docs. |
| auto_apms_behavior_tree/src/executor/options.cpp | Implements extracted executor options class. |
| auto_apms_behavior_tree/src/executor/generic_executor_node.cpp | Adds the new generic executor implementation (params, build handler, command action, sync). |
| auto_apms_behavior_tree/src/executor/executor_node.cpp | Refactors TreeExecutorNode to use the new action-based executor template and generic base. |
| auto_apms_behavior_tree/include/auto_apms_behavior_tree/util/node.hpp | Adds #pragma once. |
| auto_apms_behavior_tree/include/auto_apms_behavior_tree/executor/options.hpp | Introduces TreeExecutorNodeOptions header. |
| auto_apms_behavior_tree/include/auto_apms_behavior_tree/executor/generic_executor_node.hpp | Introduces GenericTreeExecutorNode interface and allowed-parameter lists. |
| auto_apms_behavior_tree/include/auto_apms_behavior_tree/executor/executor_node.hpp | Refactors public TreeExecutorNode API to inherit from ActionBasedTreeExecutorNode. |
| auto_apms_behavior_tree/include/auto_apms_behavior_tree/executor/action_based_executor_node.hpp | Introduces the reusable action-triggered executor template. |
| auto_apms_behavior_tree/CMakeLists.txt | Adds new executor sources to the library build. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
auto_apms_behavior_tree/include/auto_apms_behavior_tree/executor/action_based_executor_node.hpp
Show resolved
Hide resolved
auto_apms_behavior_tree/include/auto_apms_behavior_tree/executor/options.hpp
Show resolved
Hide resolved
auto_apms_behavior_tree/include/auto_apms_behavior_tree/executor/generic_executor_node.hpp
Show resolved
Hide resolved
auto_apms_behavior_tree/include/auto_apms_behavior_tree/executor/action_based_executor_node.hpp
Show resolved
Hide resolved
auto_apms_behavior_tree/include/auto_apms_behavior_tree/executor/generic_executor_node.hpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…oAPMS/auto-apms into feature/event-based-executor
Contributor
|
@robin-mueller I've opened a new pull request, #19, to work on those changes. Once the pull request is ready, I'll request review from you. |
…dition Co-authored-by: robin-mueller <83639955+robin-mueller@users.noreply.github.com>
Fix race condition in ActionBasedTreeExecutorNode: per-goal TreeConstructor storage via UUID map
…oAPMS/auto-apms into feature/event-based-executor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new template class to support action-based triggering of behavior tree execution, and refactors the codebase to use this new abstraction. The most significant change is the addition of the
ActionBasedTreeExecutorNodetemplate, which generalizes the logic for executing behavior trees in response to custom ROS 2 action goals. This allows for more flexible and reusable executor nodes. Theexecutor_node.hppnow uses this new template, simplifying its implementation and removing the previous custom options class.Key changes:
New Action-based Executor Abstraction:
ActionBasedTreeExecutorNodetemplate class inexecutor/action_based_executor_node.hpp, providing a generic mechanism for executing behavior trees triggered by arbitrary ROS 2 action goals. This class manages goal acceptance, execution lifecycle, and result handling, and is intended to be subclassed for specific action types.Refactoring and Simplification:
executor_node.hppto use the newActionBasedTreeExecutorNodetemplate with the built-inStartTreeExecutoraction type, removing the previousTreeExecutorNodeOptionsclass and related configuration logic. This greatly simplifies the executor node interface and implementation.Build System Updates:
src/executor/options.cppandsrc/executor/generic_executor_node.cppto the library build list inCMakeLists.txt, supporting the new executor node architecture.