Description
In the TreeExecutionServer, plugins are loaded in the following order: user plugins, then parameter based plugins. See the snippet below:
BehaviorTree.ROS2/behaviortree_ros2/src/tree_execution_server.cpp
Lines 116 to 119 in 6c6aa07
| // user defined method | |
| registerNodesIntoFactory(p_->factory); | |
| // load plugins from multiple directories | |
| RegisterPlugins(p_->params, p_->factory, node_); |
The docstring for registerNodesIntoFactory, on the other hand, claims that it is called only after the other plugins were registered:
BehaviorTree.ROS2/behaviortree_ros2/include/behaviortree_ros2/tree_execution_server.hpp
Lines 104 to 112 in 6c6aa07
| /** | |
| * @brief registerNodesIntoFactory is a callback invoked after the | |
| * plugins were registered into the BT::BehaviorTreeFactory. | |
| * It can be used to register additional custom nodes manually. | |
| * | |
| * @param factory The factory to use to register nodes | |
| */ | |
| virtual void registerNodesIntoFactory(BT::BehaviorTreeFactory& factory) | |
| {} |
So either the docstring or the implementation is wrong.
Personally, I would prefer if the order was switched in the implementation, so that registerNodesIntoFactory runs last. Then I could use it as a hook to do other things (e.g. export an XSD schema) right after all the plugins are loaded.
I don't mind contributing to fix the issue, I'd just need an indication as to which should be fixed, the implementation or the docstring,
Activity