forked from ros-perception/laser_filters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
112 lines (95 loc) · 4.13 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
cmake_minimum_required(VERSION 3.5)
project(laser_filters)
##############################################################################
# Find dependencies
##############################################################################
find_package(ament_cmake_auto REQUIRED)
ament_auto_find_build_dependencies()
##############################################################################
# Build
##############################################################################
if(${rclcpp_VERSION_MAJOR} GREATER_EQUAL 20)
add_compile_definitions(RCLCPP_SUPPORTS_MATCHED_CALLBACKS)
endif()
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)
# The rclcpp_components_register_node macro registers an rclcpp component for the node with
# the ament resource index AND creates a templated executable that spins the given node.
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"
)
ament_auto_add_executable(generic_laser_filter_node src/generic_laser_filter_node.cpp)
##############################################################################
# Install
##############################################################################
pluginlib_export_plugin_description_file(filters laser_filters_plugins.xml)
ament_auto_package(INSTALL_TO_SHARE examples test)
##############################################################################
# Test
##############################################################################
if(BUILD_TESTING)
find_package(ament_cmake_gtest REQUIRED)
set(TEST_NAME test_scan_filter_chain)
set(RESULT_FILENAME ${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${TEST_NAME}.gtest.xml)
ament_add_gtest_executable(${TEST_NAME} test/${TEST_NAME}.cpp)
ament_target_dependencies(${TEST_NAME} filters pluginlib rclcpp sensor_msgs)
ament_add_test(
${TEST_NAME}
COMMAND
$<TARGET_FILE:${TEST_NAME}>
--ros-args --params-file ${PROJECT_SOURCE_DIR}/test/${TEST_NAME}.yaml
--gtest_output=xml:${RESULT_FILENAME}
RESULT_FILE ${RESULT_FILENAME}
)
set(TEST_NAME test_shadow_detector)
set(RESULT_FILENAME ${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${TEST_NAME}.gtest.xml)
ament_add_gtest_executable(${TEST_NAME} test/${TEST_NAME}.cpp)
ament_target_dependencies(${TEST_NAME} angles)
target_link_libraries(${TEST_NAME} laser_scan_filters)
ament_add_test(
${TEST_NAME}
COMMAND
$<TARGET_FILE:${TEST_NAME}>
--ros-args
--gtest_output=xml:${RESULT_FILENAME}
RESULT_FILE ${RESULT_FILENAME}
)
set(TEST_NAME test_speckle_filter)
set(RESULT_FILENAME ${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${TEST_NAME}.gtest.xml)
ament_add_gtest_executable(${TEST_NAME} test/${TEST_NAME}.cpp)
ament_target_dependencies(${TEST_NAME} angles)
target_link_libraries(${TEST_NAME} laser_scan_filters)
ament_add_test(
${TEST_NAME}
COMMAND
$<TARGET_FILE:${TEST_NAME}>
--ros-args
--gtest_output=xml:${RESULT_FILENAME}
RESULT_FILE ${RESULT_FILENAME}
)
set(TEST_NAME test_scan_shadows_filter)
set(RESULT_FILENAME ${AMENT_TEST_RESULTS_DIR}/${PROJECT_NAME}/${TEST_NAME}.gtest.xml)
ament_add_gtest_executable(${TEST_NAME} test/${TEST_NAME}.cpp)
ament_target_dependencies(${TEST_NAME} filters rclcpp sensor_msgs)
target_link_libraries(${TEST_NAME} laser_scan_filters)
ament_add_test(
${TEST_NAME}
COMMAND
$<TARGET_FILE:${TEST_NAME}>
--ros-args
--gtest_output=xml:${RESULT_FILENAME}
RESULT_FILE ${RESULT_FILENAME}
)
find_package(launch_testing_ament_cmake)
add_launch_test(test/test_polygon_filter.test.py)
add_launch_test(test/test_speckle_filter.test.py)
endif()