From 673e36d5c028eb74d8ca76b1ccdb4b0be6d7c146 Mon Sep 17 00:00:00 2001 From: a-maumau Date: Mon, 27 May 2024 15:17:46 +0900 Subject: [PATCH 1/4] remove unusing main func file Signed-off-by: a-maumau --- .../src/ndt_scan_matcher_node.cpp | 35 ------------------- 1 file changed, 35 deletions(-) delete mode 100644 localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp diff --git a/localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp b/localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp deleted file mode 100644 index 785055eef3700..0000000000000 --- a/localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015-2019 Autoware Foundation -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -#include "ndt_scan_matcher/ndt_scan_matcher_core.hpp" - -#include - -#include - -int main(int argc, char ** argv) -{ - if (!google::IsGoogleLoggingInitialized()) { - google::InitGoogleLogging(argv[0]); // NOLINT - google::InstallFailureSignalHandler(); - } - - rclcpp::init(argc, argv); - auto ndt_scan_matcher = std::make_shared(); - rclcpp::executors::MultiThreadedExecutor exec; - exec.add_node(ndt_scan_matcher); - exec.spin(); - rclcpp::shutdown(); - return 0; -} From bdcbdb00fba44a6265fd22832ea7f20fdc45af47 Mon Sep 17 00:00:00 2001 From: a-maumau Date: Mon, 27 May 2024 15:18:26 +0900 Subject: [PATCH 2/4] mod to componentize and use glog Signed-off-by: a-maumau --- localization/ndt_scan_matcher/CMakeLists.txt | 14 ++++++++------ localization/ndt_scan_matcher/package.xml | 1 + .../ndt_scan_matcher/src/ndt_scan_matcher_core.cpp | 3 +++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/localization/ndt_scan_matcher/CMakeLists.txt b/localization/ndt_scan_matcher/CMakeLists.txt index 7ac78514c49fe..490b653f09df8 100644 --- a/localization/ndt_scan_matcher/CMakeLists.txt +++ b/localization/ndt_scan_matcher/CMakeLists.txt @@ -22,20 +22,24 @@ else() endif() endif() -find_package(glog REQUIRED) find_package(PCL REQUIRED COMPONENTS common io registration) include_directories(${PCL_INCLUDE_DIRS}) -ament_auto_add_executable(ndt_scan_matcher +ament_auto_add_library(${PROJECT_NAME} SHARED src/diagnostics_module.cpp src/map_update_module.cpp src/ndt_scan_matcher_core.cpp - src/ndt_scan_matcher_node.cpp src/particle.cpp ) link_directories(${PCL_LIBRARY_DIRS}) -target_link_libraries(ndt_scan_matcher ${PCL_LIBRARIES} glog::glog) +target_link_libraries(ndt_scan_matcher ${PCL_LIBRARIES}) + +rclcpp_components_register_node(${PROJECT_NAME} + PLUGIN "NDTScanMatcher" + EXECUTABLE ${PROJECT_NAME}_node + EXECUTOR MultiThreadedExecutor +) if(BUILD_TESTING) add_launch_test( @@ -49,7 +53,6 @@ if(BUILD_TESTING) src/diagnostics_module.cpp src/map_update_module.cpp src/ndt_scan_matcher_core.cpp -# src/ndt_scan_matcher_node.cpp src/particle.cpp ) ament_auto_add_gtest(once_initialize_at_out_of_map_then_initialize_correctly @@ -57,7 +60,6 @@ if(BUILD_TESTING) src/diagnostics_module.cpp src/map_update_module.cpp src/ndt_scan_matcher_core.cpp -# src/ndt_scan_matcher_node.cpp src/particle.cpp ) endif() diff --git a/localization/ndt_scan_matcher/package.xml b/localization/ndt_scan_matcher/package.xml index b9a1f7dbad1bd..a37e7c370adf5 100644 --- a/localization/ndt_scan_matcher/package.xml +++ b/localization/ndt_scan_matcher/package.xml @@ -29,6 +29,7 @@ ndt_omp pcl_conversions rclcpp + rclcpp_components sensor_msgs std_msgs std_srvs diff --git a/localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp b/localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp index 8692027e9634a..de8a6571f29b8 100644 --- a/localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp +++ b/localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp @@ -1069,3 +1069,6 @@ geometry_msgs::msg::PoseWithCovarianceStamped NDTScanMatcher::align_pose( return result_pose_with_cov_msg; } + +#include +RCLCPP_COMPONENTS_REGISTER_NODE(NDTScanMatcher) From 15869fb04f1c59f410e016fd52cb7acb9e782fed Mon Sep 17 00:00:00 2001 From: a-maumau Date: Mon, 27 May 2024 15:18:57 +0900 Subject: [PATCH 3/4] change log output from log to both Signed-off-by: a-maumau --- .../ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/localization/ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml b/localization/ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml index cbcb0a9f74bc4..671e2ace56cad 100644 --- a/localization/ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml +++ b/localization/ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml @@ -14,7 +14,7 @@ - + From 4b5805fc392b5d6b555039386890e8a8f9a91613 Mon Sep 17 00:00:00 2001 From: a-maumau Date: Mon, 27 May 2024 16:12:36 +0900 Subject: [PATCH 4/4] remove unnecessary Signed-off-by: a-maumau --- localization/ndt_scan_matcher/CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/localization/ndt_scan_matcher/CMakeLists.txt b/localization/ndt_scan_matcher/CMakeLists.txt index 490b653f09df8..5e4db9571c404 100644 --- a/localization/ndt_scan_matcher/CMakeLists.txt +++ b/localization/ndt_scan_matcher/CMakeLists.txt @@ -50,17 +50,9 @@ if(BUILD_TESTING) find_package(ament_cmake_gtest REQUIRED) ament_auto_add_gtest(standard_sequence_for_initial_pose_estimation test/test_cases/standard_sequence_for_initial_pose_estimation.cpp - src/diagnostics_module.cpp - src/map_update_module.cpp - src/ndt_scan_matcher_core.cpp - src/particle.cpp ) ament_auto_add_gtest(once_initialize_at_out_of_map_then_initialize_correctly test/test_cases/once_initialize_at_out_of_map_then_initialize_correctly.cpp - src/diagnostics_module.cpp - src/map_update_module.cpp - src/ndt_scan_matcher_core.cpp - src/particle.cpp ) endif()