build: doi dependency robot_angles -> robot_angles_prv, don CMake
Package that la robot_angles_prv (package.xml), robot_angles chi la ten thu muc cu - sua build_depend/run_depend va #include cho khop. Gom lai nhanh standalone/catkin trong CMakeLists.txt: dua tf3 find_library ra dung ca 2 nhanh, them install plugins.xml (neu co), FILES_MATCHING "*.h" khi install header, RUNTIME DESTINATION bin cho nhanh standalone.
This commit is contained in:
161
CMakeLists.txt
161
CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.0.2)
|
||||
project(robot_base_local_planner VERSION 1.0.0 LANGUAGES CXX)
|
||||
|
||||
# ========================================================
|
||||
# Detect Catkin or Standalone
|
||||
# Detect build mode
|
||||
# ========================================================
|
||||
if(DEFINED CATKIN_DEVEL_PREFIX OR DEFINED CATKIN_TOPLEVEL)
|
||||
set(BUILDING_WITH_CATKIN TRUE)
|
||||
@@ -24,53 +24,15 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
||||
|
||||
# ========================================================
|
||||
# Dependencies
|
||||
# Common dependencies
|
||||
# ========================================================
|
||||
find_package(Boost REQUIRED COMPONENTS thread)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
|
||||
# ========================================================
|
||||
# Catkin configuration
|
||||
# ========================================================
|
||||
if(BUILDING_WITH_CATKIN)
|
||||
|
||||
find_package(catkin REQUIRED COMPONENTS
|
||||
robot_angles
|
||||
robot_costmap_2d
|
||||
robot_std_msgs
|
||||
robot_geometry_msgs
|
||||
robot_sensor_msgs
|
||||
robot_nav_msgs
|
||||
robot_cpp
|
||||
tf3
|
||||
robot_tf3_geometry_msgs
|
||||
robot_voxel_grid
|
||||
data_convert
|
||||
)
|
||||
|
||||
catkin_package(
|
||||
INCLUDE_DIRS include
|
||||
LIBRARIES ${PROJECT_NAME}
|
||||
CATKIN_DEPENDS
|
||||
robot_angles
|
||||
robot_costmap_2d
|
||||
robot_std_msgs
|
||||
robot_geometry_msgs
|
||||
robot_sensor_msgs
|
||||
robot_nav_msgs
|
||||
robot_cpp
|
||||
tf3
|
||||
robot_tf3_geometry_msgs
|
||||
robot_voxel_grid
|
||||
data_convert
|
||||
DEPENDS Boost Eigen3
|
||||
)
|
||||
|
||||
else()
|
||||
|
||||
# ========================================================
|
||||
# Standalone configuration
|
||||
# Standalone mode
|
||||
# ========================================================
|
||||
if(NOT BUILDING_WITH_CATKIN)
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
@@ -78,20 +40,79 @@ else()
|
||||
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||
set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}")
|
||||
|
||||
# ⚠️ placeholder libraries
|
||||
set(PACKAGES_DIR
|
||||
robot_angles
|
||||
robot_angles_prv
|
||||
robot_costmap_2d
|
||||
robot_std_msgs
|
||||
robot_geometry_msgs
|
||||
robot_sensor_msgs
|
||||
robot_nav_msgs
|
||||
robot_cpp
|
||||
tf3
|
||||
robot_tf3_geometry_msgs
|
||||
robot_voxel_grid
|
||||
data_convert
|
||||
)
|
||||
|
||||
find_library(TF3_LIBRARY
|
||||
NAMES tf3
|
||||
PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu
|
||||
)
|
||||
|
||||
if(NOT TF3_LIBRARY)
|
||||
message(FATAL_ERROR "❌ tf3 library not found")
|
||||
endif()
|
||||
|
||||
# ========================================================
|
||||
# Catkin mode
|
||||
# ========================================================
|
||||
else()
|
||||
|
||||
find_package(catkin REQUIRED COMPONENTS
|
||||
robot_angles_prv
|
||||
robot_costmap_2d
|
||||
robot_std_msgs
|
||||
robot_geometry_msgs
|
||||
robot_sensor_msgs
|
||||
robot_nav_msgs
|
||||
robot_cpp
|
||||
robot_tf3_geometry_msgs
|
||||
robot_voxel_grid
|
||||
data_convert
|
||||
)
|
||||
|
||||
find_library(TF3_LIBRARY
|
||||
NAMES tf3
|
||||
PATHS /usr/lib /usr/local/lib /usr/lib/x86_64-linux-gnu
|
||||
)
|
||||
|
||||
if(NOT TF3_LIBRARY)
|
||||
message(FATAL_ERROR "❌ tf3 library not found")
|
||||
endif()
|
||||
|
||||
catkin_package(
|
||||
INCLUDE_DIRS include
|
||||
LIBRARIES ${PROJECT_NAME}
|
||||
CATKIN_DEPENDS
|
||||
robot_angles_prv
|
||||
robot_costmap_2d
|
||||
robot_std_msgs
|
||||
robot_geometry_msgs
|
||||
robot_sensor_msgs
|
||||
robot_nav_msgs
|
||||
robot_cpp
|
||||
robot_tf3_geometry_msgs
|
||||
robot_voxel_grid
|
||||
data_convert
|
||||
DEPENDS Boost Eigen3
|
||||
)
|
||||
|
||||
include_directories(
|
||||
include
|
||||
${catkin_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
# ========================================================
|
||||
@@ -129,18 +150,7 @@ add_library(${PROJECT_NAME} SHARED
|
||||
)
|
||||
|
||||
# ========================================================
|
||||
# Include directories
|
||||
# ========================================================
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
|
||||
)
|
||||
|
||||
# ========================================================
|
||||
# Dependencies
|
||||
# Catkin linking
|
||||
# ========================================================
|
||||
if(BUILDING_WITH_CATKIN)
|
||||
|
||||
@@ -148,6 +158,12 @@ if(BUILDING_WITH_CATKIN)
|
||||
${catkin_EXPORTED_TARGETS}
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
|
||||
PUBLIC
|
||||
@@ -156,10 +172,20 @@ if(BUILDING_WITH_CATKIN)
|
||||
PRIVATE
|
||||
Boost::thread
|
||||
Eigen3::Eigen
|
||||
${TF3_LIBRARY}
|
||||
)
|
||||
|
||||
# ========================================================
|
||||
# Standalone linking
|
||||
# ========================================================
|
||||
else()
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
|
||||
PUBLIC
|
||||
@@ -168,6 +194,7 @@ else()
|
||||
PRIVATE
|
||||
Boost::thread
|
||||
Eigen3::Eigen
|
||||
${TF3_LIBRARY}
|
||||
)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
@@ -192,14 +219,22 @@ if(BUILDING_WITH_CATKIN)
|
||||
|
||||
install(DIRECTORY include/${PROJECT_NAME}/
|
||||
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugins.xml)
|
||||
install(FILES plugins.xml
|
||||
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
|
||||
)
|
||||
endif()
|
||||
|
||||
else()
|
||||
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
EXPORT ${PROJECT_NAME}-targets
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
|
||||
install(EXPORT ${PROJECT_NAME}-targets
|
||||
@@ -210,13 +245,13 @@ else()
|
||||
|
||||
install(DIRECTORY include/${PROJECT_NAME}/
|
||||
DESTINATION include
|
||||
FILES_MATCHING PATTERN "*.h"
|
||||
)
|
||||
|
||||
message(STATUS "=================================")
|
||||
message(STATUS "Project: ${PROJECT_NAME}")
|
||||
message(STATUS "Version: ${PROJECT_VERSION}")
|
||||
message(STATUS "C++ Standard: ${CMAKE_CXX_STANDARD}")
|
||||
message(STATUS "Libraries: ${PROJECT_NAME}")
|
||||
message(STATUS "=================================")
|
||||
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plugins.xml)
|
||||
install(FILES plugins.xml
|
||||
DESTINATION share/${PROJECT_NAME}
|
||||
)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
|
||||
#include <robot_angles/angles.h>
|
||||
#include <robot_angles_prv/angles.h>
|
||||
#include <robot_costmap_2d/costmap_2d.h>
|
||||
#include <data_convert/data_convert.h>
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<run_depend>libconsole-bridge-dev</run_depend>
|
||||
|
||||
<build_depend>robot_tf3_geometry_msgs</build_depend>
|
||||
<build_depend>robot_angles</build_depend>
|
||||
<build_depend>robot_angles_prv</build_depend>
|
||||
<build_depend>robot_costmap_2d</build_depend>
|
||||
<build_depend>eigen</build_depend>
|
||||
<build_depend>robot_geometry_msgs</build_depend>
|
||||
@@ -37,7 +37,7 @@
|
||||
<build_depend>data_convert</build_depend>
|
||||
|
||||
<run_depend>robot_tf3_geometry_msgs</run_depend>
|
||||
<run_depend>robot_angles</run_depend>
|
||||
<run_depend>robot_angles_prv</run_depend>
|
||||
<run_depend>robot_costmap_2d</run_depend>
|
||||
<run_depend>eigen</run_depend>
|
||||
<run_depend>robot_geometry_msgs</run_depend>
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace robot_base_local_planner {
|
||||
|
||||
double getGoalOrientationAngleDifference(const robot_geometry_msgs::PoseStamped& global_pose, double goal_th) {
|
||||
double yaw = data_convert::getYaw(global_pose.pose.orientation);
|
||||
return robot_angles::shortest_angular_distance(yaw, goal_th);
|
||||
return robot_angles_prv::shortest_angular_distance(yaw, goal_th);
|
||||
}
|
||||
|
||||
// void publishPlan(const std::vector<robot_geometry_msgs::PoseStamped>& path, const ros::Publisher& pub) {
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <math.h>
|
||||
#include <robot_angles/angles.h>
|
||||
#include <robot_angles_prv/angles.h>
|
||||
|
||||
|
||||
|
||||
@@ -378,7 +378,7 @@ namespace robot_base_local_planner{
|
||||
if (lineCost(cell_x, goal_cell_x, cell_y, goal_cell_y) >= 0) {
|
||||
double gx, gy;
|
||||
costmap_.mapToWorld(goal_cell_x, goal_cell_y, gx, gy);
|
||||
return fabs(angles::shortest_angular_distance(heading, atan2(gy - y, gx - x)));
|
||||
return fabs(robot_angles_prv::shortest_angular_distance(heading, atan2(gy - y, gx - x)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -742,7 +742,7 @@ namespace robot_base_local_planner{
|
||||
|
||||
dist = hypot(x - escape_x_, y - escape_y_);
|
||||
if(dist > escape_reset_dist_ ||
|
||||
fabs(angles::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_){
|
||||
fabs(robot_angles_prv::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_){
|
||||
escaping_ = false;
|
||||
}
|
||||
|
||||
@@ -839,7 +839,7 @@ namespace robot_base_local_planner{
|
||||
}
|
||||
|
||||
dist = hypot(x - escape_x_, y - escape_y_);
|
||||
if(dist > escape_reset_dist_ || fabs(angles::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_) {
|
||||
if(dist > escape_reset_dist_ || fabs(robot_angles_prv::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_) {
|
||||
escaping_ = false;
|
||||
}
|
||||
|
||||
@@ -890,7 +890,7 @@ namespace robot_base_local_planner{
|
||||
dist = hypot(x - escape_x_, y - escape_y_);
|
||||
|
||||
if (dist > escape_reset_dist_ ||
|
||||
fabs(angles::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_) {
|
||||
fabs(robot_angles_prv::shortest_angular_distance(escape_theta_, theta)) > escape_reset_theta_) {
|
||||
escaping_ = false;
|
||||
}
|
||||
|
||||
@@ -998,4 +998,3 @@ namespace robot_base_local_planner{
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user