Skip to content

Commit

Permalink
Switch nav2_rotation_shim_controller to modern CMake idioms. (ros-nav…
Browse files Browse the repository at this point in the history
…igation#4599)

Signed-off-by: Chris Lalancette <[email protected]>
Signed-off-by: Joseph Duchesne <[email protected]>
  • Loading branch information
clalancette authored and josephduchesne committed Dec 10, 2024
1 parent db4ce09 commit edac1b5
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 40 deletions.
69 changes: 42 additions & 27 deletions nav2_rotation_shim_controller/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,66 +2,81 @@ cmake_minimum_required(VERSION 3.5)
project(nav2_rotation_shim_controller)

find_package(ament_cmake REQUIRED)
find_package(angles REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav2_common REQUIRED)
find_package(nav2_core REQUIRED)
find_package(nav2_costmap_2d REQUIRED)
find_package(nav2_util REQUIRED)
find_package(rclcpp REQUIRED)
find_package(geometry_msgs REQUIRED)
find_package(nav_msgs REQUIRED)
find_package(pluginlib REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_lifecycle REQUIRED)
find_package(rcl_interfaces REQUIRED)
find_package(tf2 REQUIRED)
find_package(angles REQUIRED)
find_package(tf2_ros REQUIRED)

nav2_package()
set(CMAKE_CXX_STANDARD 17)

include_directories(
include
)

set(dependencies
rclcpp
geometry_msgs
nav2_costmap_2d
pluginlib
nav_msgs
nav2_util
nav2_core
tf2
angles
)

set(library_name nav2_rotation_shim_controller)

add_library(${library_name} SHARED
src/nav2_rotation_shim_controller.cpp)

ament_target_dependencies(${library_name}
${dependencies}
src/nav2_rotation_shim_controller.cpp)
target_include_directories(${library_name}
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include/${PROJECT_NAME}>"
)
target_link_libraries(${library_name} PUBLIC
${geometry_msgs_TARGETS}
nav2_core::nav2_core
nav2_costmap_2d::nav2_costmap_2d_core
pluginlib::pluginlib
rclcpp::rclcpp
rclcpp_lifecycle::rclcpp_lifecycle
${rcl_interfaces_TARGETS}
tf2_ros::tf2_ros
)
target_link_libraries(${library_name} PRIVATE
angles::angles
nav2_util::nav2_util_core
tf2::tf2
)

install(TARGETS ${library_name}
EXPORT ${library_name}
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(DIRECTORY include/
DESTINATION include/
DESTINATION include/${PROJECT_NAME}
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
# the following line skips the linter which checks for copyrights
set(ament_cmake_copyright_FOUND TRUE)
ament_lint_auto_find_test_dependencies()

ament_find_gtest()
add_subdirectory(test)
endif()

ament_export_include_directories(include)
ament_export_include_directories(include/${PROJECT_NAME})
ament_export_libraries(${library_name})
ament_export_dependencies(${dependencies})
ament_export_dependencies(
geometry_msgs
nav2_core
nav2_costmap_2d
pluginlib
rclcpp
rclcpp_lifecycle
rcl_interfaces
tf2_ros
)
ament_export_targets(${library_name})

pluginlib_export_plugin_description_file(nav2_core nav2_rotation_shim_controller.xml)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,9 @@
#include "rclcpp/rclcpp.hpp"
#include "pluginlib/class_loader.hpp"
#include "pluginlib/class_list_macros.hpp"
#include "nav2_util/geometry_utils.hpp"
#include "nav2_util/robot_utils.hpp"
#include "nav2_core/controller.hpp"
#include "nav2_core/controller_exceptions.hpp"
#include "nav2_util/node_utils.hpp"
#include "nav2_costmap_2d/footprint_collision_checker.hpp"
#include "angles/angles.h"

namespace nav2_rotation_shim_controller
{
Expand Down
13 changes: 8 additions & 5 deletions nav2_rotation_shim_controller/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@
<license>Apache-2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
<build_depend>nav2_common</build_depend>

<depend>nav2_common</depend>
<depend>angles</depend>
<depend>geometry_msgs</depend>
<depend>nav2_core</depend>
<depend>nav2_util</depend>
<depend>nav2_costmap_2d</depend>
<depend>rclcpp</depend>
<depend>geometry_msgs</depend>
<depend>nav2_msgs</depend>
<depend>angles</depend>
<depend>nav2_util</depend>
<depend>pluginlib</depend>
<depend>rclcpp</depend>
<depend>rclcpp_lifecycle</depend>
<depend>rcl_interfaces</depend>
<depend>tf2</depend>
<depend>tf2_ros</depend>

<test_depend>ament_cmake_gtest</test_depend>
<test_depend>ament_lint_common</test_depend>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
#include <vector>
#include <utility>

#include "angles/angles.h"
#include "nav2_util/geometry_utils.hpp"
#include "nav2_util/node_utils.hpp"
#include "nav2_util/robot_utils.hpp"

#include "nav2_rotation_shim_controller/nav2_rotation_shim_controller.hpp"
#include "nav2_rotation_shim_controller/tools/utils.hpp"

Expand Down
9 changes: 5 additions & 4 deletions nav2_rotation_shim_controller/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ find_package(nav2_controller REQUIRED)
ament_add_gtest(test_shim_controller
test_shim_controller.cpp
)
ament_target_dependencies(test_shim_controller
${dependencies}
nav2_controller
)
target_link_libraries(test_shim_controller
${library_name}
rclcpp::rclcpp
nav2_costmap_2d::nav2_costmap_2d_core
nav2_controller::simple_goal_checker
nav2_util::nav2_util_core
tf2_ros::tf2_ros
)

0 comments on commit edac1b5

Please sign in to comment.