diff --git a/e_stop_manager/CMakeLists.txt b/e_stop_manager/CMakeLists.txt index c269b3d..e6f18f5 100644 --- a/e_stop_manager/CMakeLists.txt +++ b/e_stop_manager/CMakeLists.txt @@ -5,6 +5,7 @@ find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(e_stop_manager_msgs REQUIRED) find_package(std_msgs REQUIRED) +find_package(rclcpp_components REQUIRED) set(CMAKE_CXX_STANDARD 14) @@ -14,15 +15,19 @@ set(CMAKE_CXX_STANDARD 14) include_directories(include) +# library add_library(${PROJECT_NAME} SHARED src/e_stop_manager.cpp) ament_target_dependencies(${PROJECT_NAME} rclcpp e_stop_manager_msgs + rclcpp_components std_msgs ) +rclcpp_components_register_nodes(${PROJECT_NAME} "e_stop_manager::EStopManager") +# node add_executable(${PROJECT_NAME}_node src/e_stop_manager_node.cpp) target_link_libraries(${PROJECT_NAME}_node ${PROJECT_NAME} diff --git a/e_stop_manager/package.xml b/e_stop_manager/package.xml index 018fbef..5a25502 100644 --- a/e_stop_manager/package.xml +++ b/e_stop_manager/package.xml @@ -15,6 +15,7 @@ ament_cmake std_msgs e_stop_manager_msgs + rclcpp_components ros_testing diff --git a/e_stop_manager/src/e_stop_manager.cpp b/e_stop_manager/src/e_stop_manager.cpp index 05287ba..5e84d5a 100644 --- a/e_stop_manager/src/e_stop_manager.cpp +++ b/e_stop_manager/src/e_stop_manager.cpp @@ -170,4 +170,12 @@ namespace e_stop_manager } } -} +}// namespace e_stop_manager + +#include "rclcpp_components/register_node_macro.hpp" + + // Register the component with class_loader. + // This acts as a sort of entry point, allowing the component to be discoverable when its library + // is being loaded into a running process. + RCLCPP_COMPONENTS_REGISTER_NODE(e_stop_manager::EStopManager); +