forked from cra-ros-pkg/robot_localization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
228 lines (193 loc) · 7.46 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
cmake_minimum_required(VERSION 2.8.3)
project(robot_localization)
find_package(catkin REQUIRED COMPONENTS
diagnostic_msgs
diagnostic_updater
geographic_msgs
geometry_msgs
message_filters
message_generation
nav_msgs
roscpp
roslint
sensor_msgs
std_msgs
tf2
tf2_geometry_msgs
tf2_ros)
# Attempt to find Eigen using its own CMake module.
# If that fails, fall back to cmake_modules package.
find_package(Eigen3)
set(EIGEN_PACKAGE EIGEN3)
if(NOT EIGEN3_FOUND)
find_package(cmake_modules REQUIRED)
find_package(Eigen REQUIRED)
set(EIGEN3_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
set(EIGEN3_LIBRARIES ${EIGEN_LIBRARIES})
set(EIGEN_PACKAGE Eigen)
endif()
add_definitions(-DEIGEN_NO_DEBUG -DEIGEN_MPL2_ONLY)
roslint_cpp()
###################################
## catkin specific configuration ##
###################################
add_service_files(
FILES
SetPose.srv
SetDatum.srv
)
generate_messages(
DEPENDENCIES
geographic_msgs
geometry_msgs
std_msgs
)
catkin_package(
INCLUDE_DIRS
include
LIBRARIES
ekf
filter_base
filter_utilities
navsat_transform
ros_filter
ros_filter_utilities
ukf
CATKIN_DEPENDS
cmake_modules
diagnostic_msgs
diagnostic_updater
geographic_msgs
geometry_msgs
message_filters
message_runtime
nav_msgs
roscpp
sensor_msgs
std_msgs
tf2
tf2_geometry_msgs
tf2_ros
DEPENDS ${EIGEN_PACKAGE}
)
###########
## Build ##
###########
include_directories(include ${catkin_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS})
# Library definitions
add_library(filter_utilities src/filter_utilities.cpp)
add_library(filter_base src/filter_base.cpp)
add_library(ekf src/ekf.cpp)
add_library(ukf src/ukf.cpp)
add_library(ros_filter_utilities src/ros_filter_utilities.cpp)
add_library(ros_filter src/ros_filter.cpp)
add_library(navsat_transform src/navsat_transform.cpp)
# Dependencies
add_dependencies(filter_base robot_localization_gencpp)
add_dependencies(navsat_transform robot_localization_gencpp)
# Executables
add_executable(ekf_localization_node src/ekf_localization_node.cpp)
add_executable(ukf_localization_node src/ukf_localization_node.cpp)
add_executable(navsat_transform_node src/navsat_transform_node.cpp)
# Linking
target_link_libraries(ros_filter_utilities ${catkin_LIBRARIES} ${EIGEN3_LIBRARIES})
target_link_libraries(filter_utilities ${catkin_LIBRARIES} ${EIGEN3_LIBRARIES})
target_link_libraries(filter_base filter_utilities ${catkin_LIBRARIES} ${EIGEN3_LIBRARIES})
target_link_libraries(ekf filter_base ${catkin_LIBRARIES} ${EIGEN3_LIBRARIES})
target_link_libraries(ukf filter_base ${catkin_LIBRARIES} ${EIGEN3_LIBRARIES})
target_link_libraries(ros_filter ekf ukf ros_filter_utilities ${catkin_LIBRARIES} ${EIGEN3_LIBRARIES})
target_link_libraries(ekf_localization_node ros_filter ${catkin_LIBRARIES})
target_link_libraries(ukf_localization_node ros_filter ${catkin_LIBRARIES})
target_link_libraries(navsat_transform filter_utilities ros_filter_utilities ${catkin_LIBRARIES} ${EIGEN3_LIBRARIES})
target_link_libraries(navsat_transform_node navsat_transform ${catkin_LIBRARIES})
#############
## Install ##
#############
## Mark executables and/or libraries for installation
install(TARGETS
ekf
filter_base
filter_utilities
navsat_transform
ros_filter
ros_filter_utilities
ukf
ekf_localization_node
navsat_transform_node
ukf_localization_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
## Mark cpp header files for installation
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
PATTERN ".svn" EXCLUDE)
install(DIRECTORY launch/
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch
FILES_MATCHING PATTERN "*.launch"
PATTERN ".svn" EXCLUDE)
install(FILES
LICENSE
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
#############
## Testing ##
#############
if (CATKIN_ENABLE_TESTING)
# Not really necessary, but it will cause the build to fail if it's
# missing, rather than failing once the tests are being executed
find_package(rosbag REQUIRED)
find_package(rostest REQUIRED)
#### FILTER BASE TESTS ####
catkin_add_gtest(filter_base-test test/test_filter_base.cpp)
target_link_libraries(filter_base-test filter_base ${catkin_LIBRARIES})
# This test uses ekf_localization node for convenience.
add_rostest_gtest(test_filter_base_diagnostics_timestamps
test/test_filter_base_diagnostics_timestamps.test
test/test_filter_base_diagnostics_timestamps.cpp)
target_link_libraries(test_filter_base_diagnostics_timestamps ${catkin_LIBRARIES} ${rostest_LIBRARIES})
add_dependencies(test_filter_base_diagnostics_timestamps ekf_localization_node)
#### EKF TESTS #####
add_rostest_gtest(test_ekf
test/test_ekf.test
test/test_ekf.cpp)
target_link_libraries(test_ekf ros_filter ekf ${catkin_LIBRARIES} ${rostest_LIBRARIES})
add_rostest_gtest(test_ekf_localization_node_interfaces
test/test_ekf_localization_node_interfaces.test
test/test_ekf_localization_node_interfaces.cpp)
target_link_libraries(test_ekf_localization_node_interfaces ${catkin_LIBRARIES} ${rostest_LIBRARIES})
add_rostest_gtest(test_ekf_localization_node_bag1
test/test_ekf_localization_node_bag1.test
test/test_localization_node_bag_pose_tester.cpp)
target_link_libraries(test_ekf_localization_node_bag1 ${catkin_LIBRARIES} ${rostest_LIBRARIES})
add_rostest_gtest(test_ekf_localization_node_bag2
test/test_ekf_localization_node_bag2.test
test/test_localization_node_bag_pose_tester.cpp)
target_link_libraries(test_ekf_localization_node_bag2 ${catkin_LIBRARIES} ${rostest_LIBRARIES})
add_rostest_gtest(test_ekf_localization_node_bag3
test/test_ekf_localization_node_bag3.test
test/test_localization_node_bag_pose_tester.cpp)
target_link_libraries(test_ekf_localization_node_bag3 ${catkin_LIBRARIES} ${rostest_LIBRARIES})
#### UKF TESTS #####
add_rostest_gtest(test_ukf
test/test_ukf.test
test/test_ukf.cpp)
target_link_libraries(test_ukf ros_filter ukf ${catkin_LIBRARIES} ${rostest_LIBRARIES})
add_rostest_gtest(test_ukf_localization_node_interfaces
test/test_ukf_localization_node_interfaces.test
test/test_ukf_localization_node_interfaces.cpp)
target_link_libraries(test_ukf_localization_node_interfaces ${catkin_LIBRARIES} ${rostest_LIBRARIES})
add_rostest_gtest(test_ukf_localization_node_bag1
test/test_ukf_localization_node_bag1.test
test/test_localization_node_bag_pose_tester.cpp)
target_link_libraries(test_ukf_localization_node_bag1 ${catkin_LIBRARIES} ${rostest_LIBRARIES})
add_rostest_gtest(test_ukf_localization_node_bag2
test/test_ukf_localization_node_bag2.test
test/test_localization_node_bag_pose_tester.cpp)
target_link_libraries(test_ukf_localization_node_bag2 ${catkin_LIBRARIES} ${rostest_LIBRARIES})
add_rostest_gtest(test_ukf_localization_node_bag3
test/test_ukf_localization_node_bag3.test
test/test_localization_node_bag_pose_tester.cpp)
target_link_libraries(test_ukf_localization_node_bag3 ${catkin_LIBRARIES} ${rostest_LIBRARIES})
endif()