CMakeLists.txt 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. cmake_minimum_required(VERSION 3.0.2)
  2. project(my_planner)
  3. ## Compile as C++11, supported in ROS Kinetic and newer
  4. # add_compile_options(-std=c++11)
  5. ## Find catkin macros and libraries
  6. ## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
  7. ## is used, also find other catkin packages
  8. find_package(osqp REQUIRED)
  9. find_package(catkin REQUIRED COMPONENTS
  10. rospy
  11. roscpp
  12. std_msgs
  13. costmap_2d
  14. # osqp
  15. pcl_ros
  16. laser_geometry
  17. )
  18. find_package(PCL REQUIRED)
  19. include_directories(${PCL_INCLUDE_DIRS})
  20. link_directories(${PCL_LIBRARY_DIRS})
  21. add_definitions(${PCL_DEFINITIONS})
  22. message(STATUS "PCL_INCLUDE_DIRS:" ${PCL_INCLUDE_DIRS})
  23. message(STATUS "PCL_LIBRARY_DIRS:" ${PCL_LIBRARY_DIRS})
  24. message(STATUS "PCL_DEFINITIONS:" ${PCL_DEFINITIONS})
  25. ## System dependencies are found with CMake's conventions
  26. # find_package(Boost REQUIRED COMPONENTS system)
  27. ## Uncomment this if the package has a setup.py. This macro ensures
  28. ## modules and global scripts declared therein get installed
  29. ## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
  30. # catkin_python_setup()
  31. ################################################
  32. ## Declare ROS messages, services and actions ##
  33. ################################################
  34. ## To declare and build messages, services or actions from within this
  35. ## package, follow these steps:
  36. ## * Let MSG_DEP_SET be the set of packages whose message types you use in
  37. ## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
  38. ## * In the file package.xml:
  39. ## * add a build_depend tag for "message_generation"
  40. ## * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET
  41. ## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
  42. ## but can be declared for certainty nonetheless:
  43. ## * add a exec_depend tag for "message_runtime"
  44. ## * In this file (CMakeLists.txt):
  45. ## * add "message_generation" and every package in MSG_DEP_SET to
  46. ## find_package(catkin REQUIRED COMPONENTS ...)
  47. ## * add "message_runtime" and every package in MSG_DEP_SET to
  48. ## catkin_package(CATKIN_DEPENDS ...)
  49. ## * uncomment the add_*_files sections below as needed
  50. ## and list every .msg/.srv/.action file to be processed
  51. ## * uncomment the generate_messages entry below
  52. ## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)
  53. ## Generate messages in the 'msg' folder
  54. # add_message_files(
  55. # FILES
  56. # Message1.msg
  57. # Message2.msg
  58. # )
  59. ## Generate services in the 'srv' folder
  60. # add_service_files(
  61. # FILES
  62. # Service1.srv
  63. # Service2.srv
  64. # )
  65. ## Generate actions in the 'action' folder
  66. # add_action_files(
  67. # FILES
  68. # Action1.action
  69. # Action2.action
  70. # )
  71. ## Generate added messages and services with any dependencies listed here
  72. # generate_messages(
  73. # DEPENDENCIES
  74. # std_msgs # Or other packages containing msgs
  75. # )
  76. ################################################
  77. ## Declare ROS dynamic reconfigure parameters ##
  78. ################################################
  79. ## To declare and build dynamic reconfigure parameters within this
  80. ## package, follow these steps:
  81. ## * In the file package.xml:
  82. ## * add a build_depend and a exec_depend tag for "dynamic_reconfigure"
  83. ## * In this file (CMakeLists.txt):
  84. ## * add "dynamic_reconfigure" to
  85. ## find_package(catkin REQUIRED COMPONENTS ...)
  86. ## * uncomment the "generate_dynamic_reconfigure_options" section below
  87. ## and list every .cfg file to be processed
  88. ## Generate dynamic reconfigure parameters in the 'cfg' folder
  89. # generate_dynamic_reconfigure_options(
  90. # cfg/DynReconf1.cfg
  91. # cfg/DynReconf2.cfg
  92. # )
  93. ###################################
  94. ## catkin specific configuration ##
  95. ###################################
  96. ## The catkin_package macro generates cmake config files for your package
  97. ## Declare things to be passed to dependent projects
  98. ## INCLUDE_DIRS: uncomment this if your package contains header files
  99. ## LIBRARIES: libraries you create in this project that dependent projects also need
  100. ## CATKIN_DEPENDS: catkin_packages dependent projects also need
  101. ## DEPENDS: system dependencies of this project that dependent projects also need
  102. catkin_package(
  103. # INCLUDE_DIRS include
  104. # LIBRARIES my_planner
  105. # CATKIN_DEPENDS other_catkin_pkg
  106. # DEPENDS system_lib
  107. )
  108. ###########
  109. ## Build ##
  110. ###########
  111. ## Specify additional locations of header files
  112. ## Your package locations should be listed before other locations
  113. include_directories(
  114. # include
  115. ${catkin_INCLUDE_DIRS}
  116. ${PROJECT_SOURCE_DIR}/include
  117. costmap_2d
  118. my_planner
  119. ${PCL_INCLUDE_DIRS}
  120. )
  121. ## Declare a C++ library
  122. add_library(${PROJECT_NAME}
  123. src/algorithms/Hybrid_A_star.cpp
  124. src/algorithms/teb.cpp
  125. src/algorithms/mpc.cpp
  126. src/algorithms/time_space_hybrid_A_star.cpp
  127. )
  128. ## Add cmake target dependencies of the library
  129. ## as an example, code may need to be generated before libraries
  130. ## either from message generation or dynamic reconfigure
  131. # add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  132. ## Declare a C++ executable
  133. ## With catkin_make all packages are built within a single CMake context
  134. ## The recommended prefix ensures that target names across packages don't collide
  135. # add_executable(${PROJECT_NAME}_node src/my_planner_node.cpp)
  136. add_executable(global_planner # 这部分代码放的位置也有讲究,不能乱放...
  137. src/global_planner.cpp
  138. src/algorithms/Hybrid_A_star.cpp
  139. )
  140. add_dependencies(global_planner ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  141. target_link_libraries(global_planner
  142. ${catkin_LIBRARIES}
  143. )
  144. add_executable(local_planner # 这部分代码放的位置也有讲究,不能乱放...
  145. src/local_planner.cpp
  146. src/algorithms/teb.cpp
  147. )
  148. add_dependencies(local_planner ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  149. target_link_libraries(local_planner
  150. ${catkin_LIBRARIES}
  151. )
  152. add_executable(decision_making # 这部分代码放的位置也有讲究,不能乱放...
  153. src/decision_making.cpp
  154. src/algorithms/time_space_hybrid_A_star.cpp
  155. )
  156. add_dependencies(decision_making ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  157. target_link_libraries(decision_making
  158. ${catkin_LIBRARIES}
  159. )
  160. add_executable(trajectory_tracker # 这部分代码放的位置也有讲究,不能乱放...
  161. src/trajectory_tracker.cpp
  162. src/algorithms/mpc.cpp
  163. )
  164. add_dependencies(trajectory_tracker ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  165. target_link_libraries(trajectory_tracker
  166. ${catkin_LIBRARIES}
  167. osqp::osqp
  168. )
  169. add_executable(lidar_fusion
  170. src/lidar_fusion.cpp
  171. )
  172. # # add_dependencies(lidar_fusion ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  173. target_link_libraries(lidar_fusion
  174. ${catkin_LIBRARIES}
  175. )
  176. add_executable(lidar_pedestrian_check
  177. src/lidar_pedestrian_check.cpp
  178. )
  179. # # add_dependencies(lidar_fusion ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  180. target_link_libraries(lidar_pedestrian_check
  181. ${catkin_LIBRARIES}
  182. )
  183. add_executable(robot_visualize
  184. src/robot_visualize.cpp
  185. )
  186. # # add_dependencies(lidar_fusion ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  187. target_link_libraries(robot_visualize
  188. ${catkin_LIBRARIES}
  189. )
  190. # add_executable(pedestrain_trajectory_prediction # 这部分代码放的位置也有讲究,不能乱放...
  191. # src/pedestrian_simulater/pedestrain_trajectory_prediction.cpp
  192. # )
  193. # add_dependencies(pedestrain_trajectory_prediction ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  194. # target_link_libraries(pedestrain_trajectory_prediction
  195. # ${catkin_LIBRARIES}
  196. # ${PCL_LIBRARIES}
  197. # )
  198. # add_executable(robot_trajectory_sampling # 这部分代码放的位置也有讲究,不能乱放...
  199. # src/algorithms/robot_trajectory_sampling.cpp
  200. # )
  201. # add_dependencies(robot_trajectory_sampling ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  202. # target_link_libraries(robot_trajectory_sampling
  203. # ${catkin_LIBRARIES}
  204. # )
  205. # add_executable(Hybrid_A_star src/Hybrid_A_star.cpp) # add_executable 需要cpp文件里面有 main 函数
  206. # add_dependencies(Hybrid_A_star ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  207. # target_link_libraries(Hybrid_A_star
  208. # ${catkin_LIBRARIES}
  209. # )
  210. ## Rename C++ executable without prefix
  211. ## The above recommended prefix causes long target names, the following renames the
  212. ## target back to the shorter version for ease of user use
  213. ## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node"
  214. # set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "")
  215. ## Add cmake target dependencies of the executable
  216. ## same as for the library above
  217. # add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
  218. ## Specify libraries to link a library or executable target against
  219. # target_link_libraries(${PROJECT_NAME}_node
  220. # ${catkin_LIBRARIES}
  221. # )
  222. #############
  223. ## Install ##
  224. #############
  225. # all install targets should use catkin DESTINATION variables
  226. # See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
  227. ## Mark executable scripts (Python etc.) for installation
  228. ## in contrast to setup.py, you can choose the destination
  229. # catkin_install_python(PROGRAMS
  230. # scripts/my_python_script
  231. # DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  232. # )
  233. ## Mark executables for installation
  234. ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html
  235. # install(TARGETS ${PROJECT_NAME}_node
  236. # RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
  237. # )
  238. ## Mark libraries for installation
  239. ## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html
  240. # install(TARGETS ${PROJECT_NAME}
  241. # ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  242. # LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  243. # RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
  244. # )
  245. ## Mark cpp header files for installation
  246. # install(DIRECTORY include/${PROJECT_NAME}/
  247. # DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
  248. # FILES_MATCHING PATTERN "*.h"
  249. # PATTERN ".svn" EXCLUDE
  250. # )
  251. ## Mark other files for installation (e.g. launch and bag files, etc.)
  252. # install(FILES
  253. # # myfile1
  254. # # myfile2
  255. # DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
  256. # )
  257. #############
  258. ## Testing ##
  259. #############
  260. ## Add gtest based cpp test target and link libraries
  261. # catkin_add_gtest(${PROJECT_NAME}-test test/test_my_planner.cpp)
  262. # if(TARGET ${PROJECT_NAME}-test)
  263. # target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
  264. # endif()
  265. ## Add folders to be run by python nosetests
  266. # catkin_add_nosetests(test)