-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
195 lines (177 loc) · 5.22 KB
/
CMakeLists.txt
File metadata and controls
195 lines (177 loc) · 5.22 KB
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
cmake_minimum_required(VERSION 3.8)
project(nav2_mppi_controller)
find_package(ament_cmake REQUIRED)
find_package(angles REQUIRED)
find_package(backward_ros REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav2_common REQUIRED)
find_package(nav2_core REQUIRED)
find_package(nav2_costmap_2d REQUIRED)
find_package(nav2_msgs REQUIRED)
find_package(nav2_util REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(std_msgs REQUIRED)
find_package(tf2 REQUIRED)
find_package(tf2_geometry_msgs REQUIRED)
find_package(tf2_ros REQUIRED)
find_package(visualization_msgs REQUIRED)
find_package(nav2_ros_common REQUIRED)
find_package(Eigen3 REQUIRED)
include_directories(
include
${EIGEN3_INCLUDE_DIR}
)
nav2_package()
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-mfma" COMPILER_SUPPORTS_FMA)
if(COMPILER_SUPPORTS_FMA)
add_compile_options(-mfma)
endif()
# If building one the same hardware to be deployed on, try `-march=native`!
add_library(mppi_controller SHARED
src/controller.cpp
src/critic_manager.cpp
src/noise_generator.cpp
src/optimizer.cpp
src/parameters_handler.cpp
src/trajectory_visualizer.cpp
)
target_compile_options(mppi_controller PUBLIC -O3)
target_include_directories(mppi_controller
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
target_link_libraries(mppi_controller PUBLIC
angles::angles
${geometry_msgs_TARGETS}
nav2_core::nav2_core
nav2_ros_common::nav2_ros_common
nav2_costmap_2d::layers
nav2_costmap_2d::nav2_costmap_2d_core
${nav2_msgs_TARGETS}
${nav_msgs_TARGETS}
pluginlib::pluginlib
rclcpp::rclcpp
rclcpp_lifecycle::rclcpp_lifecycle
${std_msgs_TARGETS}
tf2::tf2
tf2_geometry_msgs::tf2_geometry_msgs
tf2_ros::tf2_ros
${visualization_msgs_TARGETS}
)
add_library(mppi_critics SHARED
src/critics/constraint_critic.cpp
src/critics/cost_critic.cpp
src/critics/goal_critic.cpp
src/critics/goal_angle_critic.cpp
src/critics/obstacles_critic.cpp
src/critics/path_align_critic.cpp
src/critics/path_angle_critic.cpp
src/critics/path_follow_critic.cpp
src/critics/path_hug_critic.cpp
src/critics/prefer_forward_critic.cpp
src/critics/twirling_critic.cpp
src/critics/velocity_deadband_critic.cpp
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND APPLE)
# Apple Clang: use C++20 and optimization, omit -fconcepts
target_compile_features(mppi_critics PUBLIC cxx_std_20)
target_compile_options(mppi_critics PUBLIC -O3)
else()
target_compile_options(mppi_critics PUBLIC -fconcepts -O3)
endif()
target_include_directories(mppi_critics
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")
target_link_libraries(mppi_critics PUBLIC
angles::angles
${geometry_msgs_TARGETS}
nav2_core::nav2_core
nav2_ros_common::nav2_ros_common
nav2_costmap_2d::layers
nav2_costmap_2d::nav2_costmap_2d_core
${nav_msgs_TARGETS}
rclcpp::rclcpp
rclcpp_lifecycle::rclcpp_lifecycle
${std_msgs_TARGETS}
tf2::tf2
tf2_geometry_msgs::tf2_geometry_msgs
tf2_ros::tf2_ros
${visualization_msgs_TARGETS}
)
target_link_libraries(mppi_critics PRIVATE
pluginlib::pluginlib
)
add_library(mppi_trajectory_validators SHARED
src/trajectory_validators/optimal_trajectory_validator.cpp
)
target_compile_options(mppi_trajectory_validators PUBLIC -O3)
target_include_directories(mppi_trajectory_validators
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
"$<BUILD_INTERFACE:${nav2_ros_common_INCLUDE_DIRS}>")
target_link_libraries(mppi_trajectory_validators PUBLIC
angles::angles
${geometry_msgs_TARGETS}
nav2_core::nav2_core
nav2_costmap_2d::layers
nav2_costmap_2d::nav2_costmap_2d_core
${nav_msgs_TARGETS}
rclcpp::rclcpp
rclcpp_lifecycle::rclcpp_lifecycle
${std_msgs_TARGETS}
tf2::tf2
tf2_geometry_msgs::tf2_geometry_msgs
tf2_ros::tf2_ros
${visualization_msgs_TARGETS}
)
target_link_libraries(mppi_trajectory_validators PRIVATE
pluginlib::pluginlib
)
install(TARGETS mppi_controller mppi_critics mppi_trajectory_validators
EXPORT nav2_mppi_controller
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
install(DIRECTORY include/
DESTINATION include/${PROJECT_NAME}
)
if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
find_package(ament_cmake_gtest REQUIRED)
set(ament_cmake_copyright_FOUND TRUE)
ament_lint_auto_find_test_dependencies()
ament_find_gtest()
add_subdirectory(test)
add_subdirectory(benchmark)
endif()
ament_export_libraries(${libraries})
ament_export_dependencies(
angles
geometry_msgs
nav2_core
nav2_costmap_2d
nav_msgs
pluginlib
rclcpp
rclcpp_lifecycle
std_msgs
tf2
tf2_geometry_msgs
tf2_ros
visualization_msgs
nav2_ros_common
Eigen3
)
ament_export_include_directories(include/${PROJECT_NAME})
ament_export_targets(nav2_mppi_controller)
pluginlib_export_plugin_description_file(nav2_core mppic.xml)
pluginlib_export_plugin_description_file(nav2_mppi_controller critics.xml)
pluginlib_export_plugin_description_file(nav2_mppi_controller trajectory_validators.xml)
ament_package()