diff --git a/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt b/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt index 9d45a06ab8..fd801fef66 100644 --- a/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt +++ b/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt @@ -2,67 +2,78 @@ cmake_minimum_required(VERSION 3.5) project(nav_2d_utils) find_package(ament_cmake REQUIRED) -find_package(nav2_common REQUIRED) find_package(geometry_msgs REQUIRED) -find_package(std_msgs REQUIRED) find_package(nav_2d_msgs REQUIRED) find_package(nav_msgs REQUIRED) +find_package(nav2_common REQUIRED) +find_package(nav2_msgs REQUIRED) +find_package(nav2_util REQUIRED) find_package(rclcpp REQUIRED) find_package(tf2 REQUIRED) find_package(tf2_geometry_msgs REQUIRED) -find_package(nav2_msgs REQUIRED) -find_package(nav2_util REQUIRED) +find_package(tf2_ros REQUIRED) nav2_package() -set(dependencies - geometry_msgs - nav_2d_msgs - nav_msgs - std_msgs - rclcpp - tf2 - tf2_geometry_msgs - nav2_msgs - nav2_util - nav_2d_msgs -) - -include_directories( - include -) - add_library(conversions SHARED src/conversions.cpp) - -ament_target_dependencies(conversions - ${dependencies} +target_include_directories(conversions + PUBLIC + "$" + "$" +) +target_link_libraries(conversions PUBLIC + ${geometry_msgs_TARGETS} + ${nav_2d_msgs_TARGETS} + ${nav_msgs_TARGETS} + rclcpp::rclcpp + tf2::tf2 +) +target_link_libraries(conversions PRIVATE + nav2_util::nav2_util_core + tf2_geometry_msgs::tf2_geometry_msgs ) add_library(path_ops SHARED src/path_ops.cpp) - -ament_target_dependencies(path_ops - ${dependencies} +target_include_directories(path_ops + PUBLIC + "$" + "$" +) +target_link_libraries(path_ops PUBLIC + ${nav_2d_msgs_TARGETS} +) +target_link_libraries(path_ops PRIVATE + ${geometry_msgs_TARGETS} ) add_library(tf_help SHARED src/tf_help.cpp ) - -ament_target_dependencies(tf_help - ${dependencies} +target_include_directories(tf_help + PUBLIC + "$" + "$" +) +target_link_libraries(tf_help PUBLIC + conversions + ${geometry_msgs_TARGETS} + ${nav_2d_msgs_TARGETS} + rclcpp::rclcpp + tf2::tf2 + tf2_geometry_msgs::tf2_geometry_msgs + tf2_ros::tf2_ros ) - -target_link_libraries(tf_help conversions) install(TARGETS conversions path_ops tf_help - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin + EXPORT ${PROJECT_NAME} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -72,11 +83,15 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) + + ament_find_gtest() + add_subdirectory(test) endif() -ament_export_include_directories(include) +ament_export_include_directories(include/${PROJECT_NAME}) ament_export_libraries(conversions path_ops tf_help) -ament_export_dependencies(${dependencies}) +ament_export_dependencies(geometry_msgs nav_2d_msgs nav_msgs rclcpp tf2 tf2_geometry_msgs tf2_ros) +ament_export_targets(${PROJECT_NAME}) ament_package() diff --git a/nav2_dwb_controller/nav_2d_utils/package.xml b/nav2_dwb_controller/nav_2d_utils/package.xml index 34d665b468..f3dae14813 100644 --- a/nav2_dwb_controller/nav_2d_utils/package.xml +++ b/nav2_dwb_controller/nav_2d_utils/package.xml @@ -13,11 +13,12 @@ geometry_msgs nav_2d_msgs nav_msgs - std_msgs - tf2 - tf2_geometry_msgs nav2_msgs nav2_util + rclcpp + tf2 + tf2_geometry_msgs + tf2_ros ament_lint_common ament_lint_auto diff --git a/nav2_dwb_controller/nav_2d_utils/src/conversions.cpp b/nav2_dwb_controller/nav_2d_utils/src/conversions.cpp index 077707b394..42fdff6bb3 100644 --- a/nav2_dwb_controller/nav_2d_utils/src/conversions.cpp +++ b/nav2_dwb_controller/nav_2d_utils/src/conversions.cpp @@ -41,6 +41,10 @@ #include "geometry_msgs/msg/pose2_d.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" #include "geometry_msgs/msg/twist.hpp" +#include "nav_msgs/msg/path.hpp" +#include "nav_2d_msgs/msg/twist2_d.hpp" +#include "nav_2d_msgs/msg/pose2_d_stamped.hpp" +#include "nav_2d_msgs/msg/path2_d.hpp" #include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" diff --git a/nav2_dwb_controller/nav_2d_utils/test/CMakeLists.txt b/nav2_dwb_controller/nav_2d_utils/test/CMakeLists.txt index ba9740520f..3d9bd18417 100644 --- a/nav2_dwb_controller/nav_2d_utils/test/CMakeLists.txt +++ b/nav2_dwb_controller/nav_2d_utils/test/CMakeLists.txt @@ -6,4 +6,3 @@ target_link_libraries(path_ops_tests path_ops) ament_add_gtest(tf_help_tests tf_help_test.cpp) target_link_libraries(tf_help_tests tf_help conversions) -