diff --git a/sample_nodes/CMakeLists.txt b/sample_nodes/CMakeLists.txt index e8aaafffe..217fec77d 100644 --- a/sample_nodes/CMakeLists.txt +++ b/sample_nodes/CMakeLists.txt @@ -33,3 +33,15 @@ target_link_libraries(movebase_node_dyn PRIVATE ${BTCPP_LIBRARY}) target_compile_definitions(movebase_node_dyn PRIVATE BT_PLUGIN_EXPORT ) set_target_properties(movebase_node_dyn PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${BTCPP_BIN_DESTINATION} ) + +###################################################### +# INSTALL plugins for other packages to load + +INSTALL(TARGETS + crossdoor_nodes_dyn + dummy_nodes_dyn + movebase_node_dyn + LIBRARY DESTINATION share/${PROJECT_NAME}/bt_plugins + ARCHIVE DESTINATION share/${PROJECT_NAME}/bt_plugins + RUNTIME DESTINATION share/${PROJECT_NAME}/bt_plugins +) diff --git a/sample_nodes/crossdoor_nodes.cpp b/sample_nodes/crossdoor_nodes.cpp index c9b0f0b82..29463c451 100644 --- a/sample_nodes/crossdoor_nodes.cpp +++ b/sample_nodes/crossdoor_nodes.cpp @@ -74,3 +74,11 @@ void CrossDoor::reset() _door_locked = true; _pick_attempts = 0; } + +// This function must be implemented in the .cpp file to create +// a plugin that can be loaded at run-time +BT_REGISTER_NODES(factory) +{ + static CrossDoor cross_door; + cross_door.registerNodes(factory); +}