From 6fdfd76af482c6c83db1d796070ba32f70b6fdc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Sowa?= Date: Wed, 17 Jul 2024 11:00:22 +0000 Subject: [PATCH] Create node executables using rclcpp_component macros --- CMakeLists.txt | 19 ++++---- src/scan_to_cloud_filter_chain_node.cpp | 59 ------------------------- src/scan_to_scan_filter_chain_node.cpp | 59 ------------------------- 3 files changed, 10 insertions(+), 127 deletions(-) delete mode 100644 src/scan_to_cloud_filter_chain_node.cpp delete mode 100644 src/scan_to_scan_filter_chain_node.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b84cd3..1b35dc1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,17 +16,18 @@ ament_auto_add_library(laser_scan_filters SHARED src/laser_scan_filters.cpp) ament_auto_add_library(laser_filter_chains SHARED src/scan_to_cloud_filter_chain.cpp src/scan_to_scan_filter_chain.cpp) -rclcpp_components_register_nodes(laser_filter_chains - "ScanToCloudFilterChain" - "ScanToScanFilterChain") -set(FILTER_CHAINS - scan_to_cloud_filter_chain - scan_to_scan_filter_chain +rclcpp_components_register_node( + laser_filter_chains + PLUGIN "ScanToCloudFilterChain" + EXECUTABLE "scan_to_cloud_filter_chain" +) + +rclcpp_components_register_node( + laser_filter_chains + PLUGIN "ScanToScanFilterChain" + EXECUTABLE "scan_to_scan_filter_chain" ) -foreach(FILTER_CHAIN ${FILTER_CHAINS}) - ament_auto_add_executable(${FILTER_CHAIN} src/${FILTER_CHAIN}_node.cpp) -endforeach() ament_auto_add_executable(generic_laser_filter_node src/generic_laser_filter_node.cpp) diff --git a/src/scan_to_cloud_filter_chain_node.cpp b/src/scan_to_cloud_filter_chain_node.cpp deleted file mode 100644 index b8851c0..0000000 --- a/src/scan_to_cloud_filter_chain_node.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2008 Radu Bogdan Rusu - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $Id: scan_shadows_filter.cpp,v 1.0 2008/12/04 12:00:00 rusu Exp $ - * - */ - -/* -\author Radu Bogdan Rusu - - - */ - - -#include - -#include "rclcpp/rclcpp.hpp" - -#include "scan_to_cloud_filter_chain.hpp" - -int -main(int argc, char ** argv) -{ - rclcpp::init(argc, argv); - auto filter_chain = std::make_shared(); - - rclcpp::WallRate loop_rate(200); - while (rclcpp::ok()) { - - rclcpp::spin_some(filter_chain->get_node_base_interface()); - loop_rate.sleep(); - - } - - return 0; -} diff --git a/src/scan_to_scan_filter_chain_node.cpp b/src/scan_to_scan_filter_chain_node.cpp deleted file mode 100644 index 483a9ac..0000000 --- a/src/scan_to_scan_filter_chain_node.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2008 Radu Bogdan Rusu - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - * $Id: scan_shadows_filter.cpp,v 1.0 2008/12/04 12:00:00 rusu Exp $ - * - */ - -/* -\author Radu Bogdan Rusu - - - */ - - -#include - -#include "rclcpp/rclcpp.hpp" - -#include "scan_to_scan_filter_chain.hpp" - -int -main(int argc, char ** argv) -{ - rclcpp::init(argc, argv); - auto filter_chain = std::make_shared(); - - rclcpp::WallRate loop_rate(200); - while (rclcpp::ok()) { - - rclcpp::spin_some(filter_chain->get_node_base_interface()); - loop_rate.sleep(); - - } - - return 0; -}