-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCMakeLists.txt
301 lines (242 loc) · 7.5 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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# cmake_minimum_required(VERSION 3.5)
# project(hello)
# # # Default to C99
# # if(NOT CMAKE_C_STANDARD)
# # set(CMAKE_C_STANDARD 99)
# # endif()
# # # Default to C++14
# # if(NOT CMAKE_CXX_STANDARD)
# # set(CMAKE_CXX_STANDARD 14)
# # endif()
# # if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# # add_compile_options(-Wall -Wextra -Wpedantic)
# # endif()
# # find dependencies
# find_package(ament_cmake REQUIRED)
# find_package(rclcpp REQUIRED)
# find_package(geometry_msgs REQUIRED)
# find_package(nav_msgs REQUIRED)
# find_package(tf2 REQUIRED)
# find_package(std_msgs REQUIRED)
# find_package(eigen3_cmake_module REQUIRED)
# find_package(Eigen3 REQUIRED)
# find_package(Ceres REQUIRED )
# # add_executable(my_node src/my_node.cpp)
# # target_include_directories(my_node PUBLIC
# # $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
# # $<INSTALL_INTERFACE:include>)
# include_directories(
# include
# )
# include_directories(${CERES_INCLUDE_DIRS})
# # set(library_name hello)
# set(dependencies
# rclcpp
# tf2
# geometry_msgs
# nav_msgs
# Ceres
# )
# # add_library(${library_name}
# # )
# # target_include_directories(${library_name} PUBLIC ${Eigen3_INCLUDE_DIRS})
# # ament_target_dependencies(${library_name}
# # ${dependencies}
# # Eigen3
# # )
# # target_link_libraries(${library_name}
# # ${CERES_LIBRARIES}
# # )
# #node test
# # add_executable(turtlebot_controller src/pid_one_turtle.cpp)
# add_executable(mpc_controller src/mpc_controller.cpp)
# target_link_libraries(mpc_controller
# ${CERES_LIBRARIES}
# )
# target_include_directories(mpc_controller PUBLIC
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
# $<INSTALL_INTERFACE:include>)
# # Link dependencies
# ament_target_dependencies(mpc_controller ${dependencies})
# # Install executable
# install(TARGETS mpc_controller
# DESTINATION lib/${PROJECT_NAME}
# )
# # add_executable(mpc_turtle_p2p_velo src/mpc_ceres_ros.cpp)
# # # target_link_libraries(mpc_turtle_p2p_velo
# # # ${library_name}
# # # )
# # target_include_directories(mpc_turtle_p2p_velo PUBLIC
# # $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
# # $<INSTALL_INTERFACE:include>)
# # target_link_libraries(mpc_turtle_p2p_velo
# # ${CERES_LIBRARIES}
# # )
# # # Link dependencies
# # ament_target_dependencies(mpc_turtle_p2p_velo ${dependencies})
# # # Install executable
# # install(TARGETS mpc_turtle_p2p_velo
# # DESTINATION lib/${PROJECT_NAME}
# # )
# #end node test
# # Install launch files
# install(DIRECTORY launch
# DESTINATION share/${PROJECT_NAME}
# )
# # install(TARGETS ${library_name}
# # ARCHIVE DESTINATION lib
# # LIBRARY DESTINATION lib
# # RUNTIME DESTINATION bin
# # )
# install(DIRECTORY include/
# DESTINATION include/${PROJECT_NAME}
# )
# # Export package information
# # ament_export_dependencies(
# # rclcpp
# # geometry_msgs
# # nav_msgs) # Add this line
# # install(TARGETS my_node
# # DESTINATION lib/${PROJECT_NAME})
# # if(BUILD_TESTING)
# # find_package(ament_lint_auto REQUIRED)
# # # the following line skips the linter which checks for copyrights
# # # uncomment the line when a copyright and license is not present in all source files
# # #set(ament_cmake_copyright_FOUND TRUE)
# # # the following line skips cpplint (only works in a git repo)
# # # uncomment the line when this package is not in a git repo
# # #set(ament_cmake_cpplint_FOUND TRUE)
# # ament_lint_auto_find_test_dependencies()
# # endif()
# ament_export_include_directories(include)
# ament_export_dependencies(${dependencies})
# ament_package()
#---------------------------------------------------------------------------------------
# cmake_minimum_required(VERSION 3.5)
# project(hello)
# find_package(ament_cmake REQUIRED)
# find_package(nav_msgs REQUIRED)
# find_package(geometry_msgs REQUIRED)
# find_package(rclcpp REQUIRED)
# find_package(std_msgs REQUIRED)
# find_package(Eigen3 REQUIRED)
# find_package(Ceres REQUIRED COMPONENTS SuiteSparse)
# find_package(tf2 REQUIRED)
# # nav2_package()
# include_directories(
# include
# )
# # set(library_name rostek_followline)
# set(dependencies
# rclcpp
# geometry_msgs
# nav_msgs
# Ceres
# tf2
# )
# # add_library(${library_name} SHARED
# # src/mpc_ceres.cpp
# # src/mpc_ceres_ros.cpp
# # src/utils/ostacle_detect.cpp
# # src/utils/polygon_func.cpp
# # src/utils/rotate_control.cpp
# # src/utils/calculate_function.cpp
# # )
# target_include_directories( PUBLIC ${Eigen3_INCLUDE_DIRS})
# ament_target_dependencies(
# ${dependencies}
# Eigen3
# )
# target_link_libraries(
# ${CERES_LIBRARIES}
# )
# #node test
# add_executable(mpc_controller src/mpc_controller.cpp)
# # target_link_libraries(mpc_controller
# # ${CERES_LIBRARIES}
# # )
# ament_target_dependencies(mpc_controller ${dependencies} Ceres)
# install(TARGETS
# mpc_controller
# DESTINATION lib/${PROJECT_NAME})
# #end node test
# #callback param
# # add_executable(param_clbk gtest/param_clbk.cpp)
# # target_link_libraries(param_clbk
# # ${library_name}
# # )
# # ament_target_dependencies(param_clbk ${dependencies})
# # install(TARGETS
# # param_clbk
# # DESTINATION lib/${PROJECT_NAME})
# # #end
# # install(TARGETS ${library_name}
# # ARCHIVE DESTINATION lib
# # LIBRARY DESTINATION lib
# # RUNTIME DESTINATION bin
# # )
# install(DIRECTORY include/
# DESTINATION include/
# )
# # install(FILES plugin.xml
# # DESTINATION share/${PROJECT_NAME}
# # )
# # target_compile_definitions(${library_name} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")
# # pluginlib_export_plugin_description_file(nav2_core plugin.xml)
# if(BUILD_TESTING)
# # find_package(ament_cmake_gtest REQUIRED)
# # set(fitting_test fitting_fnc_test)
# # ament_add_gtest(${fitting_test} gtest/utils/polygon_func_test.cc)
# # target_include_directories(${fitting_test} PUBLIC
# # $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
# # $<INSTALL_INTERFACE:include>
# # )
# # ament_target_dependencies(${fitting_test}
# # nav_msgs geometry_msgs std_msgs rclcpp
# # )
# # target_link_libraries(${fitting_test} name_of_local_library)
# endif()
# ament_export_include_directories(include)
# # ament_export_libraries(${library_name})
# ament_export_dependencies(${dependencies})
# ament_package()
#--------------------------------------------------------------
cmake_minimum_required(VERSION 3.5)
project(hello)
find_package(ament_cmake REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(sensor_msgs REQUIRED)
find_package(rclcpp REQUIRED)
find_package(std_msgs REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Ceres REQUIRED COMPONENTS SuiteSparse)
find_package(tf2 REQUIRED)
include_directories(
include
)
set(dependencies
rclcpp
geometry_msgs
nav_msgs
std_msgs
sensor_msgs
Ceres
tf2
)
# add_executable(mpc_controller src/mpc_controller.cpp)
# target_include_directories(mpc_controller PUBLIC ${Eigen3_INCLUDE_DIRS})
# ament_target_dependencies(mpc_controller ${dependencies})
# target_link_libraries(mpc_controller ${CERES_LIBRARIES})
add_executable(mpc_obstacle_avoid src/mpc_obstacle_avoid.cpp)
target_include_directories(mpc_obstacle_avoid PUBLIC ${Eigen3_INCLUDE_DIRS})
ament_target_dependencies(mpc_obstacle_avoid ${dependencies})
target_link_libraries(mpc_obstacle_avoid ${CERES_LIBRARIES})
install(TARGETS mpc_obstacle_avoid
DESTINATION lib/${PROJECT_NAME})
install(DIRECTORY include/
DESTINATION include/
)
ament_export_include_directories(include)
ament_export_dependencies(${dependencies})
ament_package()