diff --git a/nav2_docking/opennav_docking/CMakeLists.txt b/nav2_docking/opennav_docking/CMakeLists.txt index e50590d3e4..d991a25ba9 100644 --- a/nav2_docking/opennav_docking/CMakeLists.txt +++ b/nav2_docking/opennav_docking/CMakeLists.txt @@ -3,65 +3,45 @@ project(opennav_docking) find_package(ament_cmake REQUIRED) find_package(angles REQUIRED) -find_package(rclcpp REQUIRED) -find_package(rclcpp_action REQUIRED) -find_package(rclcpp_lifecycle REQUIRED) -find_package(rclcpp_components REQUIRED) -find_package(std_msgs REQUIRED) -find_package(sensor_msgs REQUIRED) -find_package(visualization_msgs REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(nav2_common REQUIRED) find_package(nav2_graceful_controller REQUIRED) find_package(nav2_msgs REQUIRED) find_package(nav2_util REQUIRED) find_package(nav_msgs REQUIRED) -find_package(geometry_msgs REQUIRED) -find_package(builtin_interfaces REQUIRED) +find_package(opennav_docking_core REQUIRED) +find_package(pluginlib REQUIRED) +find_package(rclcpp REQUIRED) +find_package(rclcpp_action REQUIRED) +find_package(rclcpp_components REQUIRED) +find_package(rclcpp_lifecycle REQUIRED) +find_package(rcl_interfaces REQUIRED) +find_package(sensor_msgs REQUIRED) +find_package(tf2 REQUIRED) find_package(tf2_geometry_msgs REQUIRED) find_package(tf2_ros REQUIRED) -find_package(pluginlib REQUIRED) find_package(yaml_cpp_vendor REQUIRED) find_package(yaml-cpp REQUIRED) -find_package(opennav_docking_core REQUIRED) -# potentially replace with nav2_common, nav2_package() -set(CMAKE_CXX_STANDARD 17) -add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference) - -include_directories( - include -) +nav2_package() set(executable_name opennav_docking) set(library_name ${executable_name}_core) -set(dependencies - angles - rclcpp - rclcpp_action - rclcpp_lifecycle - rclcpp_components - std_msgs - sensor_msgs - visualization_msgs - nav2_graceful_controller - nav2_util - nav2_msgs - nav_msgs - geometry_msgs - builtin_interfaces - tf2_ros - tf2_geometry_msgs - pluginlib - yaml_cpp_vendor - opennav_docking_core -) - add_library(controller SHARED src/controller.cpp ) - -ament_target_dependencies(controller - ${dependencies} +target_include_directories(controller + PUBLIC + "$" + "$" +) +target_link_libraries(controller PUBLIC + ${geometry_msgs_TARGETS} + nav2_graceful_controller::nav2_graceful_controller + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${rcl_interfaces_TARGETS} ) add_library(${library_name} SHARED @@ -69,47 +49,87 @@ add_library(${library_name} SHARED src/dock_database.cpp src/navigator.cpp ) - -ament_target_dependencies(${library_name} - ${dependencies} +target_include_directories(${library_name} + PUBLIC + "$" + "$" ) - -target_link_libraries(${library_name} - yaml-cpp::yaml-cpp +target_link_libraries(${library_name} PUBLIC + angles::angles controller + ${geometry_msgs_TARGETS} + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + opennav_docking_core::opennav_docking_core + pluginlib::pluginlib + rclcpp::rclcpp + rclcpp_action::rclcpp_action + rclcpp_lifecycle::rclcpp_lifecycle + ${rcl_interfaces_TARGETS} + tf2_ros::tf2_ros + yaml-cpp::yaml-cpp +) +target_link_libraries(${library_name} PRIVATE + rclcpp_components::component + tf2_geometry_msgs::tf2_geometry_msgs ) add_library(pose_filter SHARED src/pose_filter.cpp ) - -ament_target_dependencies(pose_filter - ${dependencies} +target_include_directories(pose_filter + PUBLIC + "$" + "$" +) +target_link_libraries(pose_filter PUBLIC + ${geometry_msgs_TARGETS} +) +target_link_libraries(pose_filter PRIVATE + rclcpp::rclcpp + tf2_geometry_msgs::tf2_geometry_msgs ) add_executable(${executable_name} src/main.cpp ) - -target_link_libraries(${executable_name} ${library_name}) - -ament_target_dependencies(${executable_name} - ${dependencies} +target_include_directories(${executable_name} + PUBLIC + "$" + "$" ) +target_link_libraries(${executable_name} PRIVATE ${library_name} rclcpp::rclcpp) rclcpp_components_register_nodes(${library_name} "opennav_docking::DockingServer") add_library(simple_charging_dock SHARED src/simple_charging_dock.cpp ) -ament_target_dependencies(simple_charging_dock - ${dependencies} +target_include_directories(simple_charging_dock + PUBLIC + "$" + "$" +) +target_link_libraries(simple_charging_dock PUBLIC + ${geometry_msgs_TARGETS} + opennav_docking_core::opennav_docking_core + pose_filter + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${sensor_msgs_TARGETS} + tf2_geometry_msgs::tf2_geometry_msgs + tf2_ros::tf2_ros +) +target_link_libraries(simple_charging_dock PRIVATE + nav2_util::nav2_util_core + pluginlib::pluginlib + tf2::tf2 ) -target_link_libraries(simple_charging_dock pose_filter) pluginlib_export_plugin_description_file(opennav_docking_core plugins.xml) install(TARGETS ${library_name} controller pose_filter simple_charging_dock + EXPORT ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin @@ -120,7 +140,7 @@ install(TARGETS ${executable_name} ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) install(FILES test/test_dock_file.yaml @@ -131,11 +151,28 @@ if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_gtest REQUIRED) find_package(ament_cmake_pytest REQUIRED) + find_package(ament_index_cpp REQUIRED) + 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} controller pose_filter) -ament_export_dependencies(${dependencies} yaml-cpp) +ament_export_dependencies( + geometry_msgs + nav2_graceful_controller + nav2_msgs + nav2_util + opennav_docking_core + pluginlib + rclcpp + rclcpp_action + rclcpp_lifecycle + rcl_interfaces + tf2_ros + yaml-cpp +) +ament_export_targets(${PROJECT_NAME}) ament_package() diff --git a/nav2_docking/opennav_docking/include/opennav_docking/pose_filter.hpp b/nav2_docking/opennav_docking/include/opennav_docking/pose_filter.hpp index 50b538bfd7..99f8359b5e 100644 --- a/nav2_docking/opennav_docking/include/opennav_docking/pose_filter.hpp +++ b/nav2_docking/opennav_docking/include/opennav_docking/pose_filter.hpp @@ -16,7 +16,6 @@ #define OPENNAV_DOCKING__POSE_FILTER_HPP_ #include "geometry_msgs/msg/pose_stamped.hpp" -#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" namespace opennav_docking { diff --git a/nav2_docking/opennav_docking/package.xml b/nav2_docking/opennav_docking/package.xml index 4c5ac1789b..bb80298041 100644 --- a/nav2_docking/opennav_docking/package.xml +++ b/nav2_docking/opennav_docking/package.xml @@ -8,25 +8,30 @@ Apache-2.0 ament_cmake + nav2_common angles - rclcpp - rclcpp_action - rclcpp_lifecycle + geometry_msgs nav2_graceful_controller nav2_msgs nav2_util nav_msgs - geometry_msgs - builtin_interfaces - sensor_msgs - pluginlib - yaml_cpp_vendor opennav_docking_core + pluginlib + rclcpp + rclcpp_action + rclcpp_components + rclcpp_lifecycle + rcl_interfaces + sensor_msgs + tf2 + tf2_geometry_msgs tf2_ros + yaml_cpp_vendor ament_cmake_gtest ament_cmake_pytest + ament_index_cpp ament_lint_common ament_lint_auto diff --git a/nav2_docking/opennav_docking/src/pose_filter.cpp b/nav2_docking/opennav_docking/src/pose_filter.cpp index 53f91a734c..e010087f63 100644 --- a/nav2_docking/opennav_docking/src/pose_filter.cpp +++ b/nav2_docking/opennav_docking/src/pose_filter.cpp @@ -14,6 +14,7 @@ #include "opennav_docking/pose_filter.hpp" #include "rclcpp/rclcpp.hpp" +#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" namespace opennav_docking { diff --git a/nav2_docking/opennav_docking/test/CMakeLists.txt b/nav2_docking/opennav_docking/test/CMakeLists.txt index a49f245c92..8ffbe18740 100644 --- a/nav2_docking/opennav_docking/test/CMakeLists.txt +++ b/nav2_docking/opennav_docking/test/CMakeLists.txt @@ -2,77 +2,90 @@ ament_add_gtest(test_utils test_utils.cpp ) -ament_target_dependencies(test_utils - ${dependencies} -) target_link_libraries(test_utils + ament_index_cpp::ament_index_cpp + ${geometry_msgs_TARGETS} ${library_name} + nav2_util::nav2_util_core + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle ) # Test dock database ament_add_gtest(test_dock_database test_dock_database.cpp ) -ament_target_dependencies(test_dock_database - ${dependencies} -) target_link_libraries(test_dock_database + ament_index_cpp::ament_index_cpp ${library_name} + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle ) # Test navigator ament_add_gtest(test_navigator test_navigator.cpp ) -ament_target_dependencies(test_navigator - ${dependencies} -) target_link_libraries(test_navigator + ament_index_cpp::ament_index_cpp + ${geometry_msgs_TARGETS} ${library_name} + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle ) # Test Controller ament_add_gtest(test_controller test_controller.cpp ) -ament_target_dependencies(test_controller - ${dependencies} -) target_link_libraries(test_controller + ${geometry_msgs_TARGETS} ${library_name} + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle ) # Test Simple Dock ament_add_gtest(test_simple_charging_dock test_simple_charging_dock.cpp ) -ament_target_dependencies(test_simple_charging_dock - ${dependencies} -) target_link_libraries(test_simple_charging_dock - ${library_name} simple_charging_dock + ament_index_cpp::ament_index_cpp + ${geometry_msgs_TARGETS} + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${sensor_msgs_TARGETS} + simple_charging_dock + tf2_geometry_msgs::tf2_geometry_msgs ) # Test Pose Filter (unit) ament_add_gtest(test_pose_filter test_pose_filter.cpp ) -ament_target_dependencies(test_pose_filter - ${dependencies} -) target_link_libraries(test_pose_filter - ${library_name} + ${geometry_msgs_TARGETS} pose_filter + rclcpp::rclcpp + tf2::tf2 + tf2_geometry_msgs::tf2_geometry_msgs ) # Test dock pluing for server tests add_library(test_dock SHARED testing_dock.cpp) -ament_target_dependencies(test_dock ${dependencies}) -target_compile_definitions(test_dock PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") +target_link_libraries(test_dock PUBLIC + ${geometry_msgs_TARGETS} + opennav_docking_core::opennav_docking_core + pluginlib::pluginlib + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros +) install(TARGETS test_dock - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION lib/${PROJECT_NAME} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION lib/${PROJECT_NAME} ) ament_export_libraries(test_dock) @@ -80,11 +93,12 @@ ament_export_libraries(test_dock) ament_add_gtest(test_docking_server_unit test_docking_server_unit.cpp ) -ament_target_dependencies(test_docking_server_unit - ${dependencies} -) target_link_libraries(test_docking_server_unit + ${geometry_msgs_TARGETS} ${library_name} + nav2_util::nav2_util_core + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle ) # Test docking server (smoke) diff --git a/nav2_docking/opennav_docking_bt/CMakeLists.txt b/nav2_docking/opennav_docking_bt/CMakeLists.txt index c89330ee38..a852c4124b 100644 --- a/nav2_docking/opennav_docking_bt/CMakeLists.txt +++ b/nav2_docking/opennav_docking_bt/CMakeLists.txt @@ -2,56 +2,56 @@ cmake_minimum_required(VERSION 3.5) project(opennav_docking_bt) find_package(ament_cmake REQUIRED) -find_package(rclcpp REQUIRED) -find_package(rclcpp_action REQUIRED) -find_package(std_msgs REQUIRED) -find_package(nav2_util REQUIRED) -find_package(nav2_msgs REQUIRED) -find_package(nav2_core REQUIRED) +find_package(behaviortree_cpp REQUIRED) +find_package(geometry_msgs REQUIRED) find_package(nav2_behavior_tree REQUIRED) +find_package(nav2_common REQUIRED) +find_package(nav2_core REQUIRED) +find_package(nav2_msgs REQUIRED) +find_package(nav2_util REQUIRED) find_package(nav_msgs REQUIRED) -find_package(geometry_msgs REQUIRED) -find_package(behaviortree_cpp REQUIRED) +find_package(rclcpp REQUIRED) +find_package(rclcpp_action REQUIRED) -# potentially replace with nav2_common, nav2_package() -set(CMAKE_CXX_STANDARD 17) -add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wdeprecated -fPIC -Wshadow -Wnull-dereference) +nav2_package() -include_directories( - include +add_library(opennav_dock_action_bt_node SHARED src/dock_robot.cpp) +target_include_directories(opennav_dock_action_bt_node + PUBLIC + "$" + "$" ) - -set(dependencies - rclcpp - rclcpp_action - std_msgs - nav2_util - nav2_msgs - nav2_core - nav2_behavior_tree - nav_msgs - geometry_msgs - behaviortree_cpp +target_compile_definitions(opennav_dock_action_bt_node PRIVATE BT_PLUGIN_EXPORT) +target_link_libraries(opennav_dock_action_bt_node PUBLIC + behaviortree_cpp::behaviortree_cpp + ${geometry_msgs_TARGETS} + nav2_behavior_tree::nav2_behavior_tree + ${nav2_msgs_TARGETS} ) -add_library(opennav_dock_action_bt_node SHARED src/dock_robot.cpp) -list(APPEND plugin_libs opennav_dock_action_bt_node) add_library(opennav_undock_action_bt_node SHARED src/undock_robot.cpp) -list(APPEND plugin_libs opennav_undock_action_bt_node) - -foreach(bt_plugin ${plugin_libs}) - ament_target_dependencies(${bt_plugin} ${dependencies}) - target_compile_definitions(${bt_plugin} PRIVATE BT_PLUGIN_EXPORT) -endforeach() +target_include_directories(opennav_undock_action_bt_node + PUBLIC + "$" + "$" +) +target_compile_definitions(opennav_undock_action_bt_node PRIVATE BT_PLUGIN_EXPORT) +target_link_libraries(opennav_undock_action_bt_node PUBLIC + behaviortree_cpp::behaviortree_cpp + ${geometry_msgs_TARGETS} + nav2_behavior_tree::nav2_behavior_tree + ${nav2_msgs_TARGETS} +) -install(TARGETS ${plugin_libs} +install(TARGETS opennav_dock_action_bt_node opennav_undock_action_bt_node + EXPORT ${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) install(DIRECTORY behavior_trees DESTINATION share/${PROJECT_NAME}) @@ -63,7 +63,13 @@ if(BUILD_TESTING) add_subdirectory(test) endif() -ament_export_include_directories(include) -ament_export_libraries(${plugin_libs}) -ament_export_dependencies(${dependencies}) +ament_export_include_directories(include/${PROJECT_NAME}) +ament_export_libraries(opennav_dock_action_bt_node opennav_undock_action_bt_node) +ament_export_dependencies( + behaviortree_cpp + geometry_msgs + nav2_behavior_tree + nav2_msgs +) +ament_export_targets(${PROJECT_NAME}) ament_package() diff --git a/nav2_docking/opennav_docking_bt/package.xml b/nav2_docking/opennav_docking_bt/package.xml index 85b90b1207..3778555116 100644 --- a/nav2_docking/opennav_docking_bt/package.xml +++ b/nav2_docking/opennav_docking_bt/package.xml @@ -8,16 +8,17 @@ Apache-2.0 ament_cmake + nav2_common - rclcpp - rclcpp_action + behaviortree_cpp + geometry_msgs nav2_behavior_tree - nav2_util nav2_core nav2_msgs + nav2_util nav_msgs - geometry_msgs - behaviortree_cpp + rclcpp + rclcpp_action ament_lint_common ament_lint_auto diff --git a/nav2_docking/opennav_docking_bt/test/CMakeLists.txt b/nav2_docking/opennav_docking_bt/test/CMakeLists.txt index ba0c374f8b..077e3a8581 100644 --- a/nav2_docking/opennav_docking_bt/test/CMakeLists.txt +++ b/nav2_docking/opennav_docking_bt/test/CMakeLists.txt @@ -1,9 +1,21 @@ # Cancel test ament_add_gtest(test_dock_robot test_dock_robot.cpp) -target_link_libraries(test_dock_robot opennav_dock_action_bt_node) -ament_target_dependencies(test_dock_robot ${dependencies}) +target_link_libraries(test_dock_robot + behaviortree_cpp::behaviortree_cpp + ${geometry_msgs_TARGETS} + ${nav2_msgs_TARGETS} + opennav_dock_action_bt_node + rclcpp::rclcpp + rclcpp_action::rclcpp_action +) # Make command test ament_add_gtest(test_undock_robot test_undock_robot.cpp) -target_link_libraries(test_undock_robot opennav_undock_action_bt_node) -ament_target_dependencies(test_undock_robot ${dependencies}) +target_link_libraries(test_undock_robot + behaviortree_cpp::behaviortree_cpp + ${geometry_msgs_TARGETS} + ${nav2_msgs_TARGETS} + opennav_undock_action_bt_node + rclcpp::rclcpp + rclcpp_action::rclcpp_action +) diff --git a/nav2_docking/opennav_docking_core/CMakeLists.txt b/nav2_docking/opennav_docking_core/CMakeLists.txt index 639319bc5e..3d62476eff 100644 --- a/nav2_docking/opennav_docking_core/CMakeLists.txt +++ b/nav2_docking/opennav_docking_core/CMakeLists.txt @@ -2,23 +2,34 @@ cmake_minimum_required(VERSION 3.5) project(opennav_docking_core) find_package(ament_cmake REQUIRED) +find_package(geometry_msgs REQUIRED) find_package(nav2_common REQUIRED) -find_package(rclcpp REQUIRED) find_package(rclcpp_lifecycle REQUIRED) -find_package(nav2_util REQUIRED) -find_package(nav2_msgs REQUIRED) +find_package(tf2_ros REQUIRED) nav2_package() -set(dependencies - rclcpp - rclcpp_lifecycle - nav2_msgs - nav2_util +add_library(opennav_docking_core INTERFACE) +target_include_directories(opennav_docking_core + INTERFACE + "$" + "$" +) +target_link_libraries(opennav_docking_core INTERFACE + ${geometry_msgs_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros +) + +install(TARGETS opennav_docking_core + EXPORT opennav_docking_core + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -28,7 +39,12 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() endif() -ament_export_include_directories(include) -ament_export_dependencies(${dependencies}) +ament_export_include_directories(include/${PROJECT_NAME}) +ament_export_dependencies( + geometry_msgs + rclcpp_lifecycle + tf2_ros +) +ament_export_targets(opennav_docking_core) ament_package() diff --git a/nav2_docking/opennav_docking_core/include/opennav_docking_core/charging_dock.hpp b/nav2_docking/opennav_docking_core/include/opennav_docking_core/charging_dock.hpp index b58f9408fb..d4566e5836 100644 --- a/nav2_docking/opennav_docking_core/include/opennav_docking_core/charging_dock.hpp +++ b/nav2_docking/opennav_docking_core/include/opennav_docking_core/charging_dock.hpp @@ -18,9 +18,8 @@ #include #include -#include "rclcpp/rclcpp.hpp" +#include "rclcpp_lifecycle/lifecycle_node.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" -#include "nav2_util/lifecycle_node.hpp" #include "tf2_ros/buffer.h" diff --git a/nav2_docking/opennav_docking_core/package.xml b/nav2_docking/opennav_docking_core/package.xml index bcd03d786b..2df639d516 100644 --- a/nav2_docking/opennav_docking_core/package.xml +++ b/nav2_docking/opennav_docking_core/package.xml @@ -8,16 +8,14 @@ Apache-2.0 ament_cmake + nav2_common - rclcpp + geometry_msgs rclcpp_lifecycle - nav2_util - nav2_msgs + tf2_ros ament_lint_common ament_lint_auto - ament_cmake_gtest - ament_cmake_pytest ament_cmake