|
AutoAPMS
Streamlining behaviors in ROS 2
|
A node registration interface that is able to load and registers behavior tree nodes from a shared library using BT::BehaviorTreeFactory::registerFromPlugin.
More...
#include <auto_apms_behavior_tree_core/node/node_registration_from_library_adapter.hpp>

Private Member Functions | |
| virtual std::string | getPluginLibraryPath () const =0 |
| Get the library path that exports the node registration function associated with this class. | |
A node registration interface that is able to load and registers behavior tree nodes from a shared library using BT::BehaviorTreeFactory::registerFromPlugin.
The libraries must export the BT_RegisterNodesFromPlugin(factory) symbol which is the ROS-agnostic approach for distributing behavior tree nodes through plugins in BehaviorTree.CPP.
You can find an example of how to implement the required plugin export macro in the official BehaviorTree.CPP repository: https://github.com/BehaviorTree/BehaviorTree.CPP/blob/3ff6a32ba0497a08519c77a1436e3b81eff1bcd6/examples/plugin_example/plugin_action.cpp
Usage:
Apply the pluginlib practices to register adapter subclasses as a node registration plugin using the PLUGINLIB_EXPORT_CLASS macro.
You also need to create a plugin manifest XML file and list the adapter subclasses as plugins in the manifest. Follow ROS 2's documentation for details on how to do this: https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Pluginlib.html
Use the NODE_REGISTRATION_TYPE keyword in the auto_apms_behavior_tree_register_nodes macro in your CMakeLists.txt to specify the adapter subclass as the registration type for the nodes you want to register from the plugin library.
In this case, you need to specify my_package::MyNodeRegistrationType both under ARGN and NODE_REGISTRATION_TYPE. Supplying multiple args under ARGN would create ambiguity, because there would be multiple names for the same collection of nodes. The convention is to call this macro once for each node registration type (if it's not a template).
In your node manifest YAML, specify the fully qualified name of the adapter subclass as the class name for the nodes you want to register from the plugin library. You can specify the same adapter subclass multiple times with different registration names to register multiple nodes from the same library.
As you see, it is also possible to register multiple nodes from the same plugin library using the same adapter subclass.
Definition at line 85 of file node_registration_from_library_adapter.hpp.
|
privatepure virtual |
Get the library path that exports the node registration function associated with this class.