Skip to content

Commit 6247e2e

Browse files
authored
Register multiple nodes with single plugin (#68)
1 parent 69cb36a commit 6247e2e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

behaviortree_ros2/include/behaviortree_ros2/plugins.hpp

+19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ namespace BT
2525
constexpr const char* ROS_PLUGIN_SYMBOL = "BT_RegisterRosNodeFromPlugin";
2626
}
2727

28+
/* Use this macro to automatically register one or more custom Nodes
29+
* into a factory that require access to the BT::RosNodeParams.
30+
* For instance:
31+
*
32+
* BT_REGISTER_ROS_NODES(factory, params)
33+
* {
34+
* factory.registerNodeType<SpecialNode>("SpecialNode", params);
35+
* }
36+
*
37+
* IMPORTANT: this function MUST be declared in a cpp file, NOT a header file.
38+
* You must add the definition [BT_PLUGIN_EXPORT] in CMakeLists.txt using:
39+
*
40+
* target_compile_definitions(my_plugin_target PRIVATE BT_PLUGIN_EXPORT )
41+
*/
42+
43+
#define BT_REGISTER_ROS_NODES(factory, params) \
44+
BTCPP_EXPORT void BT_RegisterRosNodeFromPlugin(BT::BehaviorTreeFactory& factory, \
45+
const BT::RosNodeParams& params)
46+
2847
// Use this macro to generate a plugin for:
2948
//
3049
// - BT::RosActionNode

0 commit comments

Comments
 (0)