|
| 1 | +cmake_minimum_required(VERSION 3.5) |
| 2 | +project(behavior_velocity_planner) |
| 3 | + |
| 4 | +### Compile options |
| 5 | +if(NOT CMAKE_CXX_STANDARD) |
| 6 | + set(CMAKE_CXX_STANDARD 14) |
| 7 | + set(CMAKE_CXX_STANDARD_REQUIRED ON) |
| 8 | + set(CMAKE_CXX_EXTENSIONS OFF) |
| 9 | +endif() |
| 10 | +if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
| 11 | + add_compile_options(-Wall -Wextra -Wpedantic -Werror) |
| 12 | +endif() |
| 13 | + |
| 14 | +# Find the non-obvious packages manually |
| 15 | +find_package(ament_cmake REQUIRED) |
| 16 | +find_package(Boost REQUIRED) |
| 17 | +find_package(eigen3_cmake_module REQUIRED) |
| 18 | +find_package(Eigen3 REQUIRED) |
| 19 | +find_package(PCL REQUIRED COMPONENTS common) |
| 20 | +find_package(OpenCV REQUIRED) |
| 21 | + |
| 22 | +find_package(ament_cmake_auto REQUIRED) |
| 23 | +ament_auto_find_build_dependencies() |
| 24 | + |
| 25 | +set(BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES |
| 26 | + autoware_api_msgs |
| 27 | + autoware_auto_perception_msgs |
| 28 | + autoware_auto_planning_msgs |
| 29 | + autoware_planning_msgs |
| 30 | + autoware_utils |
| 31 | + Boost |
| 32 | + Eigen3 |
| 33 | + diagnostic_msgs |
| 34 | + geometry_msgs |
| 35 | + lanelet2_extension |
| 36 | + PCL |
| 37 | + pcl_conversions |
| 38 | + rclcpp |
| 39 | + sensor_msgs |
| 40 | + interpolation |
| 41 | + tf2 |
| 42 | + tf2_eigen |
| 43 | + tf2_geometry_msgs |
| 44 | + tf2_ros |
| 45 | + vehicle_info_util |
| 46 | + visualization_msgs |
| 47 | + nav_msgs |
| 48 | + grid_map_ros |
| 49 | +) |
| 50 | + |
| 51 | + |
| 52 | +# Common |
| 53 | +ament_auto_add_library(scene_module_lib SHARED |
| 54 | + src/utilization/path_utilization.cpp |
| 55 | + src/utilization/util.cpp |
| 56 | + src/utilization/interpolate.cpp |
| 57 | +) |
| 58 | + |
| 59 | +target_include_directories(scene_module_lib |
| 60 | + PUBLIC |
| 61 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 62 | + $<INSTALL_INTERFACE:include> |
| 63 | +) |
| 64 | + |
| 65 | +ament_target_dependencies(scene_module_lib ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 66 | + |
| 67 | + |
| 68 | +# Scene Module: Stop Line |
| 69 | +ament_auto_add_library(scene_module_stop_line SHARED |
| 70 | + src/scene_module/stop_line/manager.cpp |
| 71 | + src/scene_module/stop_line/scene.cpp |
| 72 | + src/scene_module/stop_line/debug.cpp |
| 73 | +) |
| 74 | + |
| 75 | +target_include_directories(scene_module_stop_line |
| 76 | + PUBLIC |
| 77 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 78 | + $<INSTALL_INTERFACE:include> |
| 79 | +) |
| 80 | + |
| 81 | +ament_target_dependencies(scene_module_stop_line ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 82 | + |
| 83 | +target_link_libraries(scene_module_stop_line scene_module_lib) |
| 84 | + |
| 85 | + |
| 86 | +# Scene Module: Crosswalk |
| 87 | +ament_auto_add_library(scene_module_crosswalk SHARED |
| 88 | + src/scene_module/crosswalk/manager.cpp |
| 89 | + src/scene_module/crosswalk/scene_crosswalk.cpp |
| 90 | + src/scene_module/crosswalk/scene_walkway.cpp |
| 91 | + src/scene_module/crosswalk/debug.cpp |
| 92 | + src/scene_module/crosswalk/util.cpp |
| 93 | +) |
| 94 | + |
| 95 | +target_include_directories(scene_module_crosswalk |
| 96 | + PUBLIC |
| 97 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 98 | + $<INSTALL_INTERFACE:include> |
| 99 | +) |
| 100 | + |
| 101 | +ament_target_dependencies(scene_module_crosswalk ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 102 | + |
| 103 | +target_link_libraries(scene_module_crosswalk scene_module_lib) |
| 104 | + |
| 105 | + |
| 106 | +# Scene Module: Intersection |
| 107 | +ament_auto_add_library(scene_module_intersection SHARED |
| 108 | + src/scene_module/intersection/manager.cpp |
| 109 | + src/scene_module/intersection/scene_intersection.cpp |
| 110 | + src/scene_module/intersection/scene_merge_from_private_road.cpp |
| 111 | + src/scene_module/intersection/debug.cpp |
| 112 | + src/scene_module/intersection/util.cpp |
| 113 | +) |
| 114 | + |
| 115 | +target_include_directories(scene_module_intersection |
| 116 | + PUBLIC |
| 117 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 118 | + $<INSTALL_INTERFACE:include> |
| 119 | +) |
| 120 | + |
| 121 | +ament_target_dependencies(scene_module_intersection ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 122 | + |
| 123 | +target_link_libraries(scene_module_intersection scene_module_lib) |
| 124 | + |
| 125 | + |
| 126 | +# Scene Module: Traffic Light |
| 127 | +ament_auto_add_library(scene_module_traffic_light SHARED |
| 128 | + src/scene_module/traffic_light/manager.cpp |
| 129 | + src/scene_module/traffic_light/scene.cpp |
| 130 | + src/scene_module/traffic_light/debug.cpp |
| 131 | +) |
| 132 | + |
| 133 | +target_include_directories(scene_module_traffic_light |
| 134 | + PUBLIC |
| 135 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 136 | + $<INSTALL_INTERFACE:include> |
| 137 | +) |
| 138 | + |
| 139 | +ament_target_dependencies(scene_module_traffic_light ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 140 | + |
| 141 | +target_link_libraries(scene_module_traffic_light scene_module_lib) |
| 142 | + |
| 143 | + |
| 144 | +# Scene Module: Blind Spot |
| 145 | +ament_auto_add_library(scene_module_blind_spot SHARED |
| 146 | + src/scene_module/blind_spot/manager.cpp |
| 147 | + src/scene_module/blind_spot/scene.cpp |
| 148 | + src/scene_module/blind_spot/debug.cpp |
| 149 | +) |
| 150 | + |
| 151 | +target_include_directories(scene_module_blind_spot |
| 152 | + PUBLIC |
| 153 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 154 | + $<INSTALL_INTERFACE:include> |
| 155 | +) |
| 156 | + |
| 157 | +ament_target_dependencies(scene_module_blind_spot ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 158 | + |
| 159 | +target_link_libraries(scene_module_blind_spot scene_module_lib) |
| 160 | + |
| 161 | + |
| 162 | +# Scene Module: Detection Area |
| 163 | +ament_auto_add_library(scene_module_detection_area SHARED |
| 164 | + src/scene_module/detection_area/manager.cpp |
| 165 | + src/scene_module/detection_area/scene.cpp |
| 166 | + src/scene_module/detection_area/debug.cpp |
| 167 | +) |
| 168 | + |
| 169 | +target_include_directories(scene_module_detection_area |
| 170 | + PUBLIC |
| 171 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 172 | + $<INSTALL_INTERFACE:include> |
| 173 | +) |
| 174 | + |
| 175 | +ament_target_dependencies(scene_module_detection_area ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 176 | + |
| 177 | +target_link_libraries(scene_module_detection_area scene_module_lib) |
| 178 | + |
| 179 | +# Scene Module: No Stopping Area |
| 180 | +ament_auto_add_library(scene_module_no_stopping_area SHARED |
| 181 | + src/scene_module/no_stopping_area/manager.cpp |
| 182 | + src/scene_module/no_stopping_area/scene_no_stopping_area.cpp |
| 183 | + src/scene_module/no_stopping_area/debug.cpp |
| 184 | +) |
| 185 | + |
| 186 | +target_include_directories(scene_module_no_stopping_area |
| 187 | + PUBLIC |
| 188 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 189 | + $<INSTALL_INTERFACE:include> |
| 190 | +) |
| 191 | + |
| 192 | +ament_target_dependencies(scene_module_no_stopping_area ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 193 | + |
| 194 | +target_link_libraries(scene_module_no_stopping_area scene_module_lib) |
| 195 | + |
| 196 | + |
| 197 | +# Scene Module: Virtual Traffic Light |
| 198 | +ament_auto_add_library(scene_module_virtual_traffic_light SHARED |
| 199 | + src/scene_module/virtual_traffic_light/manager.cpp |
| 200 | + src/scene_module/virtual_traffic_light/scene.cpp |
| 201 | + src/scene_module/virtual_traffic_light/debug.cpp |
| 202 | +) |
| 203 | + |
| 204 | +target_include_directories(scene_module_virtual_traffic_light |
| 205 | + PUBLIC |
| 206 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 207 | + $<INSTALL_INTERFACE:include> |
| 208 | +) |
| 209 | + |
| 210 | +ament_target_dependencies(scene_module_virtual_traffic_light ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 211 | + |
| 212 | +target_link_libraries(scene_module_virtual_traffic_light scene_module_lib) |
| 213 | + |
| 214 | + |
| 215 | +# SceneModule OcclusionSpot |
| 216 | +ament_auto_add_library(scene_module_occlusion_spot SHARED |
| 217 | + src/scene_module/occlusion_spot/grid_utils.cpp |
| 218 | + src/scene_module/occlusion_spot/geometry.cpp |
| 219 | + src/scene_module/occlusion_spot/manager.cpp |
| 220 | + src/scene_module/occlusion_spot/debug.cpp |
| 221 | + src/scene_module/occlusion_spot/scene_occlusion_spot_in_public_road.cpp |
| 222 | + src/scene_module/occlusion_spot/scene_occlusion_spot_in_private_road.cpp |
| 223 | + src/scene_module/occlusion_spot/occlusion_spot_utils.cpp |
| 224 | + src/scene_module/occlusion_spot/risk_predictive_braking.cpp |
| 225 | +) |
| 226 | + |
| 227 | +target_include_directories(scene_module_occlusion_spot |
| 228 | + PUBLIC |
| 229 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 230 | + $<INSTALL_INTERFACE:include> |
| 231 | +) |
| 232 | + |
| 233 | +ament_target_dependencies(scene_module_occlusion_spot ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 234 | + |
| 235 | +target_link_libraries(scene_module_occlusion_spot scene_module_lib) |
| 236 | + |
| 237 | +# Scene Module Manager |
| 238 | +ament_auto_add_library(scene_module_manager SHARED |
| 239 | + src/planner_manager.cpp |
| 240 | +) |
| 241 | + |
| 242 | +target_include_directories(scene_module_manager |
| 243 | + PUBLIC |
| 244 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 245 | + $<INSTALL_INTERFACE:include> |
| 246 | +) |
| 247 | + |
| 248 | +ament_target_dependencies(scene_module_manager ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 249 | + |
| 250 | +target_link_libraries(scene_module_manager scene_module_lib) |
| 251 | + |
| 252 | + |
| 253 | +# Node |
| 254 | +ament_auto_add_library(behavior_velocity_planner SHARED |
| 255 | + src/node.cpp |
| 256 | +) |
| 257 | + |
| 258 | +target_include_directories(behavior_velocity_planner |
| 259 | + PUBLIC |
| 260 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 261 | + $<INSTALL_INTERFACE:include> |
| 262 | +) |
| 263 | + |
| 264 | +ament_target_dependencies(behavior_velocity_planner ${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 265 | + |
| 266 | +target_link_libraries(behavior_velocity_planner |
| 267 | + scene_module_lib |
| 268 | + scene_module_stop_line |
| 269 | + scene_module_crosswalk |
| 270 | + scene_module_intersection |
| 271 | + scene_module_traffic_light |
| 272 | + scene_module_blind_spot |
| 273 | + scene_module_occlusion_spot |
| 274 | + scene_module_detection_area |
| 275 | + scene_module_no_stopping_area |
| 276 | + scene_module_virtual_traffic_light |
| 277 | + scene_module_manager |
| 278 | +) |
| 279 | + |
| 280 | +ament_export_dependencies(${BEHAVIOR_VELOCITY_PLANNER_DEPENDENCIES}) |
| 281 | + |
| 282 | +rclcpp_components_register_node(behavior_velocity_planner |
| 283 | + PLUGIN "behavior_velocity_planner::BehaviorVelocityPlannerNode" |
| 284 | + EXECUTABLE behavior_velocity_planner_node |
| 285 | +) |
| 286 | + |
| 287 | + |
| 288 | +if(BUILD_TESTING) |
| 289 | + find_package(ament_lint_auto REQUIRED) |
| 290 | + ament_lint_auto_find_test_dependencies() |
| 291 | + |
| 292 | + # utils for test |
| 293 | + ament_auto_add_library(utilization SHARED |
| 294 | + src/utilization/util.cpp |
| 295 | + ) |
| 296 | + # Gtest for utilization |
| 297 | + ament_add_gtest(utilization-test |
| 298 | + test/src/test_state_machine.cpp |
| 299 | + test/src/test_arc_lane_util.cpp |
| 300 | + test/src/test_utilization.cpp |
| 301 | + ) |
| 302 | + target_link_libraries(utilization-test |
| 303 | + gtest_main |
| 304 | + utilization |
| 305 | + ) |
| 306 | + |
| 307 | + # Gtest for occlusion spot |
| 308 | + ament_add_gtest(occlusion_spot-test |
| 309 | + test/src/test_occlusion_spot_utils.cpp |
| 310 | + test/src/test_risk_predictive_braking.cpp |
| 311 | + test/src/test_geometry.cpp |
| 312 | + test/src/test_grid_utils.cpp |
| 313 | + test/src/test_performances.cpp |
| 314 | + ) |
| 315 | + target_link_libraries(occlusion_spot-test |
| 316 | + gtest_main |
| 317 | + scene_module_occlusion_spot |
| 318 | + ) |
| 319 | + |
| 320 | +endif() |
| 321 | + |
| 322 | +ament_auto_package(INSTALL_TO_SHARE |
| 323 | + launch |
| 324 | + config |
| 325 | +) |
0 commit comments