add file costmap_2d_robot

This commit is contained in:
2025-11-18 11:44:01 +07:00
parent 0c61984d3e
commit 59ec58a018
18 changed files with 203 additions and 101 deletions

View File

@@ -12,12 +12,12 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/costmap_2d")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# --- Dependencies ---
# find_package(tf2 REQUIRED)
# find_package(tf3 REQUIRED)
find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED COMPONENTS system thread filesystem)
find_package(GTest REQUIRED)
find_package(PCL REQUIRED COMPONENTS common io)
# set(TF2_LIBRARY /usr/lib/libtf2.so)
# set(tf3_LIBRARY /usr/lib/libtf3.so)
# --- Include other message packages if needed ---
# if (NOT TARGET sensor_msgs)
@@ -39,6 +39,8 @@ find_package(PCL REQUIRED COMPONENTS common io)
# add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../voxel_grid ${CMAKE_BINARY_DIR}/voxel_grid_build)
# endif()
add_definitions(-DCOSTMAP_2D_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
include_directories(
include
${EIGEN3_INCLUDE_DIRS}
@@ -51,7 +53,8 @@ link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${EIGEN3_DEFINITIONS} ${PCL_DEFINITIONS})
# --- Core library ---
add_library(costmap_2d_new
add_library(costmap_2d
src/costmap_2d_robot.cpp
src/array_parser.cpp
src/costmap_2d.cpp
src/observation_buffer.cpp
@@ -62,7 +65,7 @@ add_library(costmap_2d_new
src/costmap_layer.cpp
)
target_link_libraries(costmap_2d_new
target_link_libraries(costmap_2d
${Boost_LIBRARIES}
std_msgs
sensor_msgs
@@ -71,17 +74,22 @@ target_link_libraries(costmap_2d_new
map_msgs
laser_geometry
voxel_grid
# ${TF2_LIBRARY}
# ${tf3_LIBRARY}
tf3
)
target_include_directories(costmap_2d_new PRIVATE ${Boost_INCLUDE_DIRS})
target_include_directories(costmap_2d
PUBLIC ${Boost_INCLUDE_DIRS}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include/${PROJECT_NAME}>
)
# --- Plugin libraries ---
add_library(static_layer SHARED
plugins/static_layer.cpp
)
target_link_libraries(static_layer
costmap_2d_new
costmap_2d
${Boost_LIBRARIES}
yaml-cpp
)
@@ -90,7 +98,7 @@ add_library(obstacle_layer SHARED
plugins/obstacle_layer.cpp
)
target_link_libraries(obstacle_layer
costmap_2d_new
costmap_2d
${Boost_LIBRARIES}
yaml-cpp
)
@@ -99,7 +107,7 @@ add_library(inflation_layer SHARED
plugins/inflation_layer.cpp
)
target_link_libraries(inflation_layer
costmap_2d_new
costmap_2d
${Boost_LIBRARIES}
yaml-cpp
)
@@ -108,7 +116,7 @@ add_library(voxel_layer SHARED
plugins/voxel_layer.cpp
)
target_link_libraries(voxel_layer
costmap_2d_new
costmap_2d
${Boost_LIBRARIES}
yaml-cpp
)
@@ -117,7 +125,7 @@ add_library(critical_layer SHARED
plugins/critical_layer.cpp
)
target_link_libraries(critical_layer
costmap_2d_new
costmap_2d
static_layer
${Boost_LIBRARIES}
yaml-cpp
@@ -127,7 +135,7 @@ add_library(directional_layer SHARED
plugins/directional_layer.cpp
)
target_link_libraries(directional_layer
costmap_2d_new
costmap_2d
static_layer
${Boost_LIBRARIES}
yaml-cpp
@@ -137,7 +145,7 @@ add_library(preferred_layer SHARED
plugins/preferred_layer.cpp
)
target_link_libraries(preferred_layer
costmap_2d_new
costmap_2d
static_layer
${Boost_LIBRARIES}
yaml-cpp
@@ -147,20 +155,20 @@ add_library(unpreferred_layer SHARED
plugins/unpreferred_layer.cpp
)
target_link_libraries(unpreferred_layer
costmap_2d_new
costmap_2d
static_layer
${Boost_LIBRARIES}
yaml-cpp
)
add_library(costmap_2d_robot SHARED
src/costmap_2d_robot.cpp
)
target_link_libraries(costmap_2d_robot
costmap_2d_new
${Boost_LIBRARIES}
yaml-cpp
)
# add_library(costmap_2d_robot SHARED
# src/costmap_2d_robot.cpp
# )
# target_link_libraries(costmap_2d_robot
# costmap_2d
# ${Boost_LIBRARIES}
# yaml-cpp
# )
# --- Test executables ---
add_executable(test_array_parser test/array_parser_test.cpp)
@@ -168,22 +176,22 @@ add_executable(test_costmap test/coordinates_test.cpp)
add_executable(test_plugin test/static_layer_test.cpp)
target_link_libraries(test_array_parser PRIVATE
costmap_2d_new
costmap_2d
GTest::GTest
GTest::Main
pthread
)
target_link_libraries(test_costmap PRIVATE
costmap_2d_new
costmap_2d
GTest::GTest
GTest::Main
pthread
)
target_link_libraries(test_plugin PRIVATE
${TF2_LIBRARY}
costmap_2d_new
${tf3_LIBRARY}
costmap_2d
static_layer
obstacle_layer
inflation_layer