Skip to content

Commit 6cb807d

Browse files
authored
feat(ndt_scan_matcher): componentize NDTScanMatcher (#7130)
* remove unusing main func file Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com> * mod to componentize and use glog Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com> * change log output from log to both Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com> * remove unnecessary Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com> --------- Signed-off-by: a-maumau <maumaumaumaumaumaumaumaumaumau@gmail.com>
1 parent 54dfc05 commit 6cb807d

File tree

5 files changed

+13
-50
lines changed

5 files changed

+13
-50
lines changed

localization/ndt_scan_matcher/CMakeLists.txt

+8-14
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,24 @@ else()
2222
endif()
2323
endif()
2424

25-
find_package(glog REQUIRED)
2625
find_package(PCL REQUIRED COMPONENTS common io registration)
2726
include_directories(${PCL_INCLUDE_DIRS})
2827

29-
ament_auto_add_executable(ndt_scan_matcher
28+
ament_auto_add_library(${PROJECT_NAME} SHARED
3029
src/diagnostics_module.cpp
3130
src/map_update_module.cpp
3231
src/ndt_scan_matcher_core.cpp
33-
src/ndt_scan_matcher_node.cpp
3432
src/particle.cpp
3533
)
3634

3735
link_directories(${PCL_LIBRARY_DIRS})
38-
target_link_libraries(ndt_scan_matcher ${PCL_LIBRARIES} glog::glog)
36+
target_link_libraries(ndt_scan_matcher ${PCL_LIBRARIES})
37+
38+
rclcpp_components_register_node(${PROJECT_NAME}
39+
PLUGIN "NDTScanMatcher"
40+
EXECUTABLE ${PROJECT_NAME}_node
41+
EXECUTOR MultiThreadedExecutor
42+
)
3943

4044
if(BUILD_TESTING)
4145
add_launch_test(
@@ -46,19 +50,9 @@ if(BUILD_TESTING)
4650
find_package(ament_cmake_gtest REQUIRED)
4751
ament_auto_add_gtest(standard_sequence_for_initial_pose_estimation
4852
test/test_cases/standard_sequence_for_initial_pose_estimation.cpp
49-
src/diagnostics_module.cpp
50-
src/map_update_module.cpp
51-
src/ndt_scan_matcher_core.cpp
52-
# src/ndt_scan_matcher_node.cpp
53-
src/particle.cpp
5453
)
5554
ament_auto_add_gtest(once_initialize_at_out_of_map_then_initialize_correctly
5655
test/test_cases/once_initialize_at_out_of_map_then_initialize_correctly.cpp
57-
src/diagnostics_module.cpp
58-
src/map_update_module.cpp
59-
src/ndt_scan_matcher_core.cpp
60-
# src/ndt_scan_matcher_node.cpp
61-
src/particle.cpp
6256
)
6357
endif()
6458

localization/ndt_scan_matcher/launch/ndt_scan_matcher.launch.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
<arg name="node_name" default="ndt_scan_matcher" description="Use a different name for this node"/>
1616

17-
<node pkg="ndt_scan_matcher" exec="ndt_scan_matcher" name="$(var node_name)" output="log">
17+
<node pkg="ndt_scan_matcher" exec="ndt_scan_matcher_node" name="$(var node_name)" output="both">
1818
<remap from="points_raw" to="$(var input_pointcloud)"/>
1919
<remap from="ekf_pose_with_covariance" to="$(var input_initial_pose_topic)"/>
2020
<remap from="regularization_pose_with_covariance" to="$(var input_regularization_pose_topic)"/>

localization/ndt_scan_matcher/package.xml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
<depend>ndt_omp</depend>
3030
<depend>pcl_conversions</depend>
3131
<depend>rclcpp</depend>
32+
<depend>rclcpp_components</depend>
3233
<depend>sensor_msgs</depend>
3334
<depend>std_msgs</depend>
3435
<depend>std_srvs</depend>

localization/ndt_scan_matcher/src/ndt_scan_matcher_core.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -1070,3 +1070,6 @@ geometry_msgs::msg::PoseWithCovarianceStamped NDTScanMatcher::align_pose(
10701070

10711071
return result_pose_with_cov_msg;
10721072
}
1073+
1074+
#include <rclcpp_components/register_node_macro.hpp>
1075+
RCLCPP_COMPONENTS_REGISTER_NODE(NDTScanMatcher)

localization/ndt_scan_matcher/src/ndt_scan_matcher_node.cpp

-35
This file was deleted.

0 commit comments

Comments
 (0)