Skip to content

Commit

Permalink
Export plugins to share directory & register CrossDoor plugin (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarqRazz committed Aug 28, 2024
1 parent 2a8a226 commit 89dbbb7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sample_nodes/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
8 changes: 8 additions & 0 deletions sample_nodes/crossdoor_nodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 89dbbb7

Please sign in to comment.