diff --git a/nav2_amcl/CMakeLists.txt b/nav2_amcl/CMakeLists.txt index 3a5836ab2d..9afb1902f3 100644 --- a/nav2_amcl/CMakeLists.txt +++ b/nav2_amcl/CMakeLists.txt @@ -20,72 +20,111 @@ find_package(pluginlib REQUIRED) nav2_package() -include_directories( - include -) - include(CheckSymbolExists) check_symbol_exists(drand48 stdlib.h HAVE_DRAND48) -add_subdirectory(src/pf) -add_subdirectory(src/map) -add_subdirectory(src/motion_model) -add_subdirectory(src/sensors) +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wno-gnu-folding-constant) +endif() -set(executable_name amcl) +add_library(pf_lib SHARED + src/pf/pf.c + src/pf/pf_kdtree.c + src/pf/pf_pdf.c + src/pf/pf_vector.c + src/pf/eig3.c + src/pf/pf_draw.c +) +target_include_directories(pf_lib + PUBLIC + "$" + "$") +if(HAVE_DRAND48) + target_compile_definitions(pf_lib PRIVATE "HAVE_DRAND48") +endif() -add_executable(${executable_name} - src/main.cpp +add_library(map_lib SHARED + src/map/map.c + src/map/map_range.c + src/map/map_draw.c + src/map/map_cspace.cpp ) +target_include_directories(map_lib + PUBLIC + "$" + "$") + +add_library(motions_lib SHARED + src/motion_model/omni_motion_model.cpp + src/motion_model/differential_motion_model.cpp +) +target_include_directories(motions_lib + PUBLIC + "$" + "$") +target_link_libraries(motions_lib pf_lib pluginlib::pluginlib nav2_util::nav2_util_core) + +add_library(sensors_lib SHARED + src/sensors/laser/laser.cpp + src/sensors/laser/beam_model.cpp + src/sensors/laser/likelihood_field_model.cpp + src/sensors/laser/likelihood_field_model_prob.cpp +) +target_include_directories(sensors_lib + PUBLIC + "$" + "$") +target_link_libraries(sensors_lib pf_lib map_lib) + +set(executable_name amcl) set(library_name ${executable_name}_core) add_library(${library_name} SHARED src/amcl_node.cpp ) - -target_include_directories(${library_name} PRIVATE src/include) - if(HAVE_DRAND48) target_compile_definitions(${library_name} PRIVATE "HAVE_DRAND48") endif() - -set(dependencies - rclcpp - rclcpp_lifecycle - rclcpp_components - message_filters - tf2_geometry_msgs - geometry_msgs - nav_msgs - sensor_msgs - std_srvs - tf2_ros - tf2 - nav2_util - nav2_msgs - pluginlib -) - -ament_target_dependencies(${executable_name} - ${dependencies} +target_include_directories(${library_name} + PUBLIC + "$" + "$") +target_link_libraries(${library_name} PUBLIC + ${geometry_msgs_TARGETS} + message_filters::message_filters + nav2_util::nav2_util_core + ${sensor_msgs_TARGETS} + ${std_srvs_TARGETS} + pluginlib::pluginlib + sensors_lib + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${nav_msgs_TARGETS} + tf2_ros::tf2_ros + tf2::tf2 + ${nav2_msgs_TARGETS} ) - -target_link_libraries(${executable_name} - ${library_name} +target_link_libraries(${library_name} PRIVATE + rclcpp_components::component + ${tf2_geometry_msgs_TARGETS} ) -ament_target_dependencies(${library_name} - ${dependencies} +add_executable(${executable_name} + src/main.cpp ) - -target_link_libraries(${library_name} - map_lib pf_lib sensors_lib +target_include_directories(${executable_name} + PUBLIC + "$" + "$") +target_link_libraries(${executable_name} PRIVATE + ${library_name} ) rclcpp_components_register_nodes(${library_name} "nav2_amcl::AmclNode") -install(TARGETS ${library_name} +install(TARGETS ${library_name} pf_lib map_lib motions_lib sensors_lib + EXPORT ${library_name} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin @@ -96,7 +135,7 @@ install(TARGETS ${executable_name} ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -109,6 +148,7 @@ endif() ament_export_include_directories(include) ament_export_libraries(${library_name} pf_lib sensors_lib motions_lib map_lib) -ament_export_dependencies(${dependencies}) +ament_export_dependencies(geometry_msgs message_filters nav2_util sensor_msgs std_srvs pluginlib rclcpp rclcpp_lifecycle nav_msgs tf2_ros tf2 nav2_msgs) +ament_export_targets(${library_name}) pluginlib_export_plugin_description_file(nav2_amcl plugins.xml) ament_package() diff --git a/nav2_amcl/src/map/CMakeLists.txt b/nav2_amcl/src/map/CMakeLists.txt deleted file mode 100644 index 9e965f6695..0000000000 --- a/nav2_amcl/src/map/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -add_library(map_lib SHARED - map.c - map_range.c - map_draw.c - map_cspace.cpp -) - -install(TARGETS - map_lib - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) diff --git a/nav2_amcl/src/motion_model/CMakeLists.txt b/nav2_amcl/src/motion_model/CMakeLists.txt deleted file mode 100644 index f1c2e35413..0000000000 --- a/nav2_amcl/src/motion_model/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_library(motions_lib SHARED - omni_motion_model.cpp - differential_motion_model.cpp -) -target_link_libraries(motions_lib pf_lib) -ament_target_dependencies(motions_lib - pluginlib - nav2_util -) - -install(TARGETS - motions_lib - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) diff --git a/nav2_amcl/src/pf/CMakeLists.txt b/nav2_amcl/src/pf/CMakeLists.txt deleted file mode 100644 index c6f16e6a7d..0000000000 --- a/nav2_amcl/src/pf/CMakeLists.txt +++ /dev/null @@ -1,24 +0,0 @@ -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wno-gnu-folding-constant) -endif() - -add_library(pf_lib SHARED - pf.c - pf_kdtree.c - pf_pdf.c - pf_vector.c - eig3.c - pf_draw.c -) - -target_include_directories(pf_lib PRIVATE ../include) -if(HAVE_DRAND48) - target_compile_definitions(pf_lib PRIVATE "HAVE_DRAND48") -endif() - -install(TARGETS - pf_lib - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) diff --git a/nav2_amcl/src/sensors/CMakeLists.txt b/nav2_amcl/src/sensors/CMakeLists.txt deleted file mode 100644 index e105675cbf..0000000000 --- a/nav2_amcl/src/sensors/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -add_library(sensors_lib SHARED - laser/laser.cpp - laser/beam_model.cpp - laser/likelihood_field_model.cpp - laser/likelihood_field_model_prob.cpp -) -# map_update_cspace -target_link_libraries(sensors_lib pf_lib map_lib) - -install(TARGETS - sensors_lib - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) diff --git a/nav2_behavior_tree/CMakeLists.txt b/nav2_behavior_tree/CMakeLists.txt index fe539b0965..6a32fe2b10 100644 --- a/nav2_behavior_tree/CMakeLists.txt +++ b/nav2_behavior_tree/CMakeLists.txt @@ -2,53 +2,45 @@ cmake_minimum_required(VERSION 3.5) project(nav2_behavior_tree CXX) find_package(ament_cmake REQUIRED) +find_package(behaviortree_cpp_v3 REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(nav_msgs REQUIRED) find_package(nav2_common REQUIRED) +find_package(nav2_msgs REQUIRED) +find_package(nav2_util REQUIRED) +find_package(rcl_action REQUIRED) find_package(rclcpp REQUIRED) find_package(rclcpp_action REQUIRED) find_package(rclcpp_lifecycle REQUIRED) -find_package(builtin_interfaces REQUIRED) -find_package(geometry_msgs REQUIRED) find_package(sensor_msgs REQUIRED) -find_package(nav2_msgs REQUIRED) -find_package(nav_msgs REQUIRED) -find_package(behaviortree_cpp_v3 REQUIRED) -find_package(tf2_ros REQUIRED) -find_package(tf2_geometry_msgs REQUIRED) find_package(std_msgs REQUIRED) find_package(std_srvs REQUIRED) -find_package(nav2_util REQUIRED) +find_package(tf2 REQUIRED) +find_package(tf2_ros REQUIRED) nav2_package() -include_directories( - include -) - set(library_name ${PROJECT_NAME}) -set(dependencies - rclcpp - rclcpp_action - rclcpp_lifecycle - geometry_msgs - sensor_msgs - nav2_msgs - nav_msgs - behaviortree_cpp_v3 - tf2 - tf2_ros - tf2_geometry_msgs - std_msgs - std_srvs - nav2_util -) - add_library(${library_name} SHARED src/behavior_tree_engine.cpp ) - -ament_target_dependencies(${library_name} - ${dependencies} +target_include_directories(${library_name} + PUBLIC + "$" + "$") +target_link_libraries(${library_name} PUBLIC + BT::behaviortree_cpp_v3 + ${geometry_msgs_TARGETS} + ${nav_msgs_TARGETS} + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + rclcpp::rclcpp + rclcpp_action::rclcpp_action + rclcpp_lifecycle::rclcpp_lifecycle + ${sensor_msgs_TARGETS} + tf2::tf2 + tf2_ros::tf2_ros ) add_library(nav2_compute_path_to_pose_action_bt_node SHARED plugins/action/compute_path_to_pose_action.cpp) @@ -211,23 +203,43 @@ add_library(nav2_goal_updated_controller_bt_node SHARED plugins/decorator/goal_u list(APPEND plugin_libs nav2_goal_updated_controller_bt_node) foreach(bt_plugin ${plugin_libs}) - ament_target_dependencies(${bt_plugin} ${dependencies}) + target_include_directories(${bt_plugin} + PRIVATE + "$" + "$") + target_link_libraries(${bt_plugin} PUBLIC + BT::behaviortree_cpp_v3 + ${geometry_msgs_TARGETS} + ${nav_msgs_TARGETS} + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + rclcpp::rclcpp + rclcpp_action::rclcpp_action + rclcpp_lifecycle::rclcpp_lifecycle + ${sensor_msgs_TARGETS} + tf2::tf2 + tf2_ros::tf2_ros + ${std_msgs_TARGETS} + ${std_srvs_TARGETS} + ) target_compile_definitions(${bt_plugin} PRIVATE BT_PLUGIN_EXPORT) endforeach() install(TARGETS ${library_name} - ${plugin_libs} + EXPORT ${library_name} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) -install(DIRECTORY include/ - DESTINATION include/ +install(TARGETS ${plugin_libs} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin ) -install(DIRECTORY test/utils/ - DESTINATION include/${PROJECT_NAME}/utils/ +install(DIRECTORY include/ + DESTINATION include/${PROJECT_NAME} ) install(FILES nav2_tree_nodes.xml DESTINATION share/${PROJECT_NAME}) @@ -236,11 +248,14 @@ if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) + + ament_find_gtest() + add_subdirectory(test) endif() ament_export_include_directories( - include + include/${PROJECT_NAME} ) ament_export_libraries( @@ -248,6 +263,23 @@ ament_export_libraries( ${plugin_libs} ) -ament_export_dependencies(${dependencies}) +ament_export_dependencies( + behaviortree_cpp_v3 + geometry_msgs + nav_msgs + nav2_common + nav2_msgs + nav2_util + rcl_action + rclcpp + rclcpp_action + rclcpp_lifecycle + sensor_msgs + std_msgs + std_srvs + tf2 + tf2_ros +) +ament_export_targets(${library_name}) ament_package() diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server.hpp index 4e98fea490..bc4ba2ac5f 100644 --- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server.hpp +++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server.hpp @@ -15,6 +15,8 @@ #ifndef NAV2_BEHAVIOR_TREE__BT_ACTION_SERVER_HPP_ #define NAV2_BEHAVIOR_TREE__BT_ACTION_SERVER_HPP_ +#include +#include #include #include #include @@ -24,6 +26,8 @@ #include "nav2_behavior_tree/ros_topic_logger.hpp" #include "nav2_util/lifecycle_node.hpp" #include "nav2_util/simple_action_server.hpp" +#include "rclcpp/rclcpp.hpp" +#include "rclcpp_lifecycle/lifecycle_node.hpp" namespace nav2_behavior_tree { diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp index fa5c550224..cc927a550b 100644 --- a/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp +++ b/nav2_behavior_tree/include/nav2_behavior_tree/bt_action_server_impl.hpp @@ -15,18 +15,20 @@ #ifndef NAV2_BEHAVIOR_TREE__BT_ACTION_SERVER_IMPL_HPP_ #define NAV2_BEHAVIOR_TREE__BT_ACTION_SERVER_IMPL_HPP_ -#include -#include +#include +#include #include +#include +#include #include -#include +#include #include -#include #include "nav2_msgs/action/navigate_to_pose.hpp" #include "nav2_behavior_tree/bt_action_server.hpp" -#include "ament_index_cpp/get_package_share_directory.hpp" #include "nav2_util/node_utils.hpp" +#include "rcl_action/action_server.h" +#include "rclcpp_lifecycle/lifecycle_node.hpp" namespace nav2_behavior_tree { diff --git a/nav2_behavior_tree/include/nav2_behavior_tree/ros_topic_logger.hpp b/nav2_behavior_tree/include/nav2_behavior_tree/ros_topic_logger.hpp index d71a57bc04..2047fb89b4 100644 --- a/nav2_behavior_tree/include/nav2_behavior_tree/ros_topic_logger.hpp +++ b/nav2_behavior_tree/include/nav2_behavior_tree/ros_topic_logger.hpp @@ -23,6 +23,7 @@ #include "rclcpp/rclcpp.hpp" #include "nav2_msgs/msg/behavior_tree_log.hpp" #include "nav2_msgs/msg/behavior_tree_status_change.h" +#include "tf2/time.h" #include "tf2_ros/buffer_interface.h" namespace nav2_behavior_tree diff --git a/nav2_behavior_tree/package.xml b/nav2_behavior_tree/package.xml index 53ca2b0dca..a2c0e58919 100644 --- a/nav2_behavior_tree/package.xml +++ b/nav2_behavior_tree/package.xml @@ -11,46 +11,26 @@ ament_cmake - tf2_geometry_msgs - std_srvs - - rclcpp - rclcpp_action - rclcpp_lifecycle - behaviortree_cpp_v3 - builtin_interfaces - geometry_msgs - sensor_msgs - nav2_msgs - nav_msgs - tf2 - tf2_ros - tf2_geometry_msgs - std_msgs - std_srvs - nav2_util - lifecycle_msgs - nav2_common - - rclcpp - rclcpp_action - rclcpp_lifecycle - std_msgs - behaviortree_cpp_v3 - builtin_interfaces - geometry_msgs - sensor_msgs - nav2_msgs - nav_msgs - tf2 - tf2_ros - tf2_geometry_msgs - nav2_util - lifecycle_msgs + behaviortree_cpp_v3 + geometry_msgs + nav_msgs + nav2_common + nav2_msgs + nav2_util + rcl_action + rclcpp + rclcpp_action + rclcpp_lifecycle + sensor_msgs + std_msgs + std_srvs + tf2 + tf2_ros ament_lint_common ament_lint_auto ament_cmake_gtest + lifecycle_msgs test_msgs diff --git a/nav2_behavior_tree/plugins/action/truncate_path_local_action.cpp b/nav2_behavior_tree/plugins/action/truncate_path_local_action.cpp index 934f2b86bb..9bf32b109c 100644 --- a/nav2_behavior_tree/plugins/action/truncate_path_local_action.cpp +++ b/nav2_behavior_tree/plugins/action/truncate_path_local_action.cpp @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include #include @@ -22,6 +23,9 @@ #include "nav2_util/geometry_utils.hpp" #include "nav2_util/robot_utils.hpp" #include "nav_msgs/msg/path.hpp" +#include "rclcpp/rclcpp.hpp" +#include "tf2/LinearMath/Quaternion.h" +#include "tf2_ros/buffer.h" #include "tf2_ros/create_timer_ros.h" #include "nav2_behavior_tree/plugins/action/truncate_path_local_action.hpp" diff --git a/nav2_behavior_tree/plugins/condition/transform_available_condition.cpp b/nav2_behavior_tree/plugins/condition/transform_available_condition.cpp index 8daca5afed..4710910c53 100644 --- a/nav2_behavior_tree/plugins/condition/transform_available_condition.cpp +++ b/nav2_behavior_tree/plugins/condition/transform_available_condition.cpp @@ -12,9 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include #include #include +#include + +#include "rclcpp/rclcpp.hpp" +#include "tf2/time.h" +#include "tf2_ros/buffer.h" #include "nav2_behavior_tree/plugins/condition/transform_available_condition.hpp" diff --git a/nav2_behavior_tree/test/CMakeLists.txt b/nav2_behavior_tree/test/CMakeLists.txt index 43696b1614..c96f4fed6d 100644 --- a/nav2_behavior_tree/test/CMakeLists.txt +++ b/nav2_behavior_tree/test/CMakeLists.txt @@ -1,7 +1,16 @@ ament_add_gtest(test_bt_conversions test_bt_conversions.cpp) -ament_target_dependencies(test_bt_conversions ${dependencies}) +target_link_libraries(test_bt_conversions + ${library_name} + ${geometry_msgs_TARGETS} +) -include_directories(.) +function(plugin_add_test target filename plugin) + ament_add_gtest(${target} ${filename}) + target_link_libraries(${target} ${geometry_msgs_TARGETS} nav2_util::nav2_util_core BT::behaviortree_cpp_v3 ${library_name} ${plugin}) + target_include_directories(${target} + PRIVATE + "$") +endfunction() add_subdirectory(plugins/condition) add_subdirectory(plugins/decorator) diff --git a/nav2_behavior_tree/test/plugins/action/CMakeLists.txt b/nav2_behavior_tree/test/plugins/action/CMakeLists.txt index 4aaf185306..8c3657f326 100644 --- a/nav2_behavior_tree/test/plugins/action/CMakeLists.txt +++ b/nav2_behavior_tree/test/plugins/action/CMakeLists.txt @@ -1,113 +1,58 @@ find_package(test_msgs REQUIRED) ament_add_gtest(test_bt_action_node test_bt_action_node.cpp) -ament_target_dependencies(test_bt_action_node ${dependencies} test_msgs) +target_link_libraries(test_bt_action_node rclcpp::rclcpp ${test_msgs_TARGETS} rclcpp_action::rclcpp_action ${library_name}) -ament_add_gtest(test_action_spin_action test_spin_action.cpp) -target_link_libraries(test_action_spin_action nav2_spin_action_bt_node) -ament_target_dependencies(test_action_spin_action ${dependencies}) +plugin_add_test(test_action_spin_action test_spin_action.cpp nav2_spin_action_bt_node) -ament_add_gtest(test_action_back_up_action test_back_up_action.cpp) -target_link_libraries(test_action_back_up_action nav2_back_up_action_bt_node) -ament_target_dependencies(test_action_back_up_action ${dependencies}) +plugin_add_test(test_action_back_up_action test_back_up_action.cpp nav2_back_up_action_bt_node) -ament_add_gtest(test_action_drive_on_heading test_drive_on_heading_action.cpp) -target_link_libraries(test_action_drive_on_heading nav2_drive_on_heading_bt_node) -ament_target_dependencies(test_action_drive_on_heading ${dependencies}) +plugin_add_test(test_action_drive_on_heading test_drive_on_heading_action.cpp nav2_drive_on_heading_bt_node) -ament_add_gtest(test_action_wait_action test_wait_action.cpp) -target_link_libraries(test_action_wait_action nav2_wait_action_bt_node) -ament_target_dependencies(test_action_wait_action ${dependencies}) +plugin_add_test(test_action_wait_action test_wait_action.cpp nav2_wait_action_bt_node) -ament_add_gtest(test_action_assisted_teleop_action test_assisted_teleop_action.cpp) -target_link_libraries(test_action_assisted_teleop_action nav2_assisted_teleop_action_bt_node) -ament_target_dependencies(test_action_assisted_teleop_action ${dependencies}) +plugin_add_test(test_action_assisted_teleop_action test_assisted_teleop_action.cpp nav2_assisted_teleop_action_bt_node) -ament_add_gtest(test_action_controller_cancel_action test_controller_cancel_node.cpp) -target_link_libraries(test_action_controller_cancel_action nav2_controller_cancel_bt_node) -ament_target_dependencies(test_action_controller_cancel_action ${dependencies}) +plugin_add_test(test_action_controller_cancel_action test_controller_cancel_node.cpp nav2_controller_cancel_bt_node) -ament_add_gtest(test_action_wait_cancel_action test_wait_cancel_node.cpp) -target_link_libraries(test_action_wait_cancel_action nav2_wait_cancel_bt_node) -ament_target_dependencies(test_action_wait_cancel_action ${dependencies}) +plugin_add_test(test_action_wait_cancel_action test_wait_cancel_node.cpp nav2_wait_cancel_bt_node) -ament_add_gtest(test_action_spin_cancel_action test_spin_cancel_node.cpp) -target_link_libraries(test_action_spin_cancel_action nav2_spin_cancel_bt_node) -ament_target_dependencies(test_action_spin_cancel_action ${dependencies}) +plugin_add_test(test_action_spin_cancel_action test_spin_cancel_node.cpp nav2_spin_cancel_bt_node) +plugin_add_test(test_action_back_up_cancel_action test_back_up_cancel_node.cpp nav2_back_up_cancel_bt_node) -ament_add_gtest(test_action_back_up_cancel_action test_back_up_cancel_node.cpp) -target_link_libraries(test_action_back_up_cancel_action nav2_back_up_cancel_bt_node) -ament_target_dependencies(test_action_back_up_cancel_action ${dependencies}) +plugin_add_test(test_action_assisted_teleop_cancel_action test_assisted_teleop_cancel_node.cpp nav2_assisted_teleop_cancel_bt_node) -ament_add_gtest(test_action_assisted_teleop_cancel_action test_assisted_teleop_cancel_node.cpp) -target_link_libraries(test_action_assisted_teleop_cancel_action nav2_assisted_teleop_cancel_bt_node) -ament_target_dependencies(test_action_assisted_teleop_cancel_action ${dependencies}) +plugin_add_test(test_action_drive_on_heading_cancel_action test_drive_on_heading_cancel_node.cpp nav2_drive_on_heading_cancel_bt_node) -ament_add_gtest(test_action_drive_on_heading_cancel_action test_drive_on_heading_cancel_node.cpp) -target_link_libraries(test_action_drive_on_heading_cancel_action nav2_drive_on_heading_cancel_bt_node) -ament_target_dependencies(test_action_drive_on_heading_cancel_action ${dependencies}) +plugin_add_test(test_action_clear_costmap_service test_clear_costmap_service.cpp nav2_clear_costmap_service_bt_node) -ament_add_gtest(test_action_clear_costmap_service test_clear_costmap_service.cpp) -target_link_libraries(test_action_clear_costmap_service nav2_clear_costmap_service_bt_node) -ament_target_dependencies(test_action_clear_costmap_service ${dependencies}) +plugin_add_test(test_action_reinitialize_global_localization_service test_reinitialize_global_localization_service.cpp nav2_reinitialize_global_localization_service_bt_node) -ament_add_gtest(test_action_reinitialize_global_localization_service test_reinitialize_global_localization_service.cpp) -target_link_libraries(test_action_reinitialize_global_localization_service nav2_reinitialize_global_localization_service_bt_node) -ament_target_dependencies(test_action_reinitialize_global_localization_service ${dependencies}) +plugin_add_test(test_action_compute_path_to_pose_action test_compute_path_to_pose_action.cpp nav2_compute_path_to_pose_action_bt_node) -ament_add_gtest(test_action_compute_path_to_pose_action test_compute_path_to_pose_action.cpp) -target_link_libraries(test_action_compute_path_to_pose_action nav2_compute_path_to_pose_action_bt_node) -ament_target_dependencies(test_action_compute_path_to_pose_action ${dependencies}) +plugin_add_test(test_action_compute_path_through_poses_action test_compute_path_through_poses_action.cpp nav2_compute_path_through_poses_action_bt_node) -ament_add_gtest(test_action_compute_path_through_poses_action test_compute_path_through_poses_action.cpp) -target_link_libraries(test_action_compute_path_through_poses_action nav2_compute_path_through_poses_action_bt_node) -ament_target_dependencies(test_action_compute_path_through_poses_action ${dependencies}) +plugin_add_test(test_action_smooth_path_action test_smooth_path_action.cpp nav2_smooth_path_action_bt_node) -ament_add_gtest(test_action_smooth_path_action test_smooth_path_action.cpp) -target_link_libraries(test_action_smooth_path_action nav2_smooth_path_action_bt_node) -ament_target_dependencies(test_action_smooth_path_action ${dependencies}) +plugin_add_test(test_action_follow_path_action test_follow_path_action.cpp nav2_follow_path_action_bt_node) -ament_add_gtest(test_action_follow_path_action test_follow_path_action.cpp) -target_link_libraries(test_action_follow_path_action nav2_follow_path_action_bt_node) -ament_target_dependencies(test_action_follow_path_action ${dependencies}) +plugin_add_test(test_action_navigate_to_pose_action test_navigate_to_pose_action.cpp nav2_navigate_to_pose_action_bt_node) -ament_add_gtest(test_action_navigate_to_pose_action test_navigate_to_pose_action.cpp) -target_link_libraries(test_action_navigate_to_pose_action nav2_navigate_to_pose_action_bt_node) -ament_target_dependencies(test_action_navigate_to_pose_action ${dependencies}) +plugin_add_test(test_action_navigate_through_poses_action test_navigate_through_poses_action.cpp nav2_navigate_through_poses_action_bt_node) -ament_add_gtest(test_action_navigate_through_poses_action test_navigate_through_poses_action.cpp) -target_link_libraries(test_action_navigate_through_poses_action nav2_navigate_through_poses_action_bt_node) -ament_target_dependencies(test_action_navigate_through_poses_action ${dependencies}) +plugin_add_test(test_truncate_path_action test_truncate_path_action.cpp nav2_truncate_path_action_bt_node) -ament_add_gtest(test_truncate_path_action test_truncate_path_action.cpp) -target_link_libraries(test_truncate_path_action nav2_truncate_path_action_bt_node) -ament_target_dependencies(test_truncate_path_action ${dependencies}) +plugin_add_test(test_truncate_path_local_action test_truncate_path_local_action.cpp nav2_truncate_path_local_action_bt_node) -ament_add_gtest(test_truncate_path_local_action test_truncate_path_local_action.cpp) -target_link_libraries(test_truncate_path_local_action nav2_truncate_path_local_action_bt_node) -ament_target_dependencies(test_truncate_path_local_action ${dependencies}) +plugin_add_test(test_remove_passed_goals_action test_remove_passed_goals_action.cpp nav2_remove_passed_goals_action_bt_node) -ament_add_gtest(test_remove_passed_goals_action test_remove_passed_goals_action.cpp) -target_link_libraries(test_remove_passed_goals_action nav2_remove_passed_goals_action_bt_node) -ament_target_dependencies(test_remove_passed_goals_action ${dependencies}) +plugin_add_test(test_planner_selector_node test_planner_selector_node.cpp nav2_planner_selector_bt_node) -ament_add_gtest(test_planner_selector_node test_planner_selector_node.cpp) -target_link_libraries(test_planner_selector_node nav2_planner_selector_bt_node) -ament_target_dependencies(test_planner_selector_node ${dependencies}) +plugin_add_test(test_controller_selector_node test_controller_selector_node.cpp nav2_controller_selector_bt_node) -ament_add_gtest(test_controller_selector_node test_controller_selector_node.cpp) -target_link_libraries(test_controller_selector_node nav2_controller_selector_bt_node) -ament_target_dependencies(test_controller_selector_node ${dependencies}) +plugin_add_test(test_smoother_selector_node test_smoother_selector_node.cpp nav2_smoother_selector_bt_node) -ament_add_gtest(test_smoother_selector_node test_smoother_selector_node.cpp) -target_link_libraries(test_smoother_selector_node nav2_smoother_selector_bt_node) -ament_target_dependencies(test_smoother_selector_node ${dependencies}) +plugin_add_test(test_goal_checker_selector_node test_goal_checker_selector_node.cpp nav2_goal_checker_selector_bt_node) -ament_add_gtest(test_goal_checker_selector_node test_goal_checker_selector_node.cpp) -target_link_libraries(test_goal_checker_selector_node nav2_goal_checker_selector_bt_node) -ament_target_dependencies(test_goal_checker_selector_node ${dependencies}) - -ament_add_gtest(test_progress_checker_selector_node test_progress_checker_selector_node.cpp) -target_link_libraries(test_progress_checker_selector_node nav2_progress_checker_selector_bt_node) -ament_target_dependencies(test_progress_checker_selector_node ${dependencies}) +plugin_add_test(ttest_progress_checker_selector_node test_progress_checker_selector_node.cpp nav2_progress_checker_selector_bt_node) diff --git a/nav2_behavior_tree/test/plugins/action/test_truncate_path_action.cpp b/nav2_behavior_tree/test/plugins/action/test_truncate_path_action.cpp index 5540b7b645..f372556a95 100644 --- a/nav2_behavior_tree/test/plugins/action/test_truncate_path_action.cpp +++ b/nav2_behavior_tree/test/plugins/action/test_truncate_path_action.cpp @@ -14,13 +14,17 @@ // limitations under the License. #include + #include #include #include -#include "nav_msgs/msg/path.hpp" #include "geometry_msgs/msg/pose_stamped.hpp" +#include "nav_msgs/msg/path.hpp" #include "nav2_util/geometry_utils.hpp" +#include "rclcpp/rclcpp.hpp" +#include "tf2/LinearMath/Matrix3x3.h" +#include "tf2/LinearMath/Quaternion.h" #include "behaviortree_cpp_v3/bt_factory.h" diff --git a/nav2_behavior_tree/test/plugins/condition/CMakeLists.txt b/nav2_behavior_tree/test/plugins/condition/CMakeLists.txt index d2ba3c1179..f2f29871a4 100644 --- a/nav2_behavior_tree/test/plugins/condition/CMakeLists.txt +++ b/nav2_behavior_tree/test/plugins/condition/CMakeLists.txt @@ -1,63 +1,31 @@ -ament_add_gtest(test_condition_distance_traveled test_distance_traveled.cpp) -target_link_libraries(test_condition_distance_traveled nav2_distance_traveled_condition_bt_node) -ament_target_dependencies(test_condition_distance_traveled ${dependencies}) +plugin_add_test(test_condition_distance_traveled test_distance_traveled.cpp nav2_distance_traveled_condition_bt_node) -ament_add_gtest(test_condition_time_expired test_time_expired.cpp) -target_link_libraries(test_condition_time_expired nav2_time_expired_condition_bt_node) -ament_target_dependencies(test_condition_time_expired ${dependencies}) +plugin_add_test(test_condition_time_expired test_time_expired.cpp nav2_time_expired_condition_bt_node) -ament_add_gtest(test_condition_path_expiring_timer test_path_expiring_timer.cpp) -target_link_libraries(test_condition_path_expiring_timer nav2_path_expiring_timer_condition) -ament_target_dependencies(test_condition_time_expired ${dependencies}) +plugin_add_test(test_condition_path_expiring_timer test_path_expiring_timer.cpp nav2_path_expiring_timer_condition) -ament_add_gtest(test_condition_goal_reached test_goal_reached.cpp) -target_link_libraries(test_condition_goal_reached nav2_goal_reached_condition_bt_node) -ament_target_dependencies(test_condition_goal_reached ${dependencies}) +plugin_add_test(test_condition_goal_reached test_goal_reached.cpp nav2_goal_reached_condition_bt_node) -ament_add_gtest(test_condition_goal_updated test_goal_updated.cpp) -target_link_libraries(test_condition_goal_updated nav2_goal_updated_condition_bt_node) -ament_target_dependencies(test_condition_goal_updated ${dependencies}) +plugin_add_test(test_condition_goal_updated test_goal_updated.cpp nav2_goal_updated_condition_bt_node) -ament_add_gtest(test_condition_globally_updated_goal test_globally_updated_goal.cpp) -target_link_libraries(test_condition_globally_updated_goal nav2_globally_updated_goal_condition_bt_node) -ament_target_dependencies(test_condition_globally_updated_goal ${dependencies}) +plugin_add_test(test_condition_globally_updated_goal test_globally_updated_goal.cpp nav2_globally_updated_goal_condition_bt_node) -ament_add_gtest(test_condition_initial_pose_received test_initial_pose_received.cpp) -target_link_libraries(test_condition_initial_pose_received nav2_initial_pose_received_condition_bt_node) -ament_target_dependencies(test_condition_initial_pose_received ${dependencies}) +plugin_add_test(test_condition_initial_pose_received test_initial_pose_received.cpp nav2_initial_pose_received_condition_bt_node) -ament_add_gtest(test_condition_transform_available test_transform_available.cpp) -target_link_libraries(test_condition_transform_available nav2_transform_available_condition_bt_node) -ament_target_dependencies(test_condition_transform_available ${dependencies}) +plugin_add_test(test_condition_transform_available test_transform_available.cpp nav2_transform_available_condition_bt_node) -ament_add_gtest(test_condition_is_stuck test_is_stuck.cpp) -target_link_libraries(test_condition_is_stuck nav2_is_stuck_condition_bt_node) -ament_target_dependencies(test_condition_is_stuck ${dependencies}) +plugin_add_test(test_condition_is_stuck test_is_stuck.cpp nav2_is_stuck_condition_bt_node) -ament_add_gtest(test_condition_is_battery_charging test_is_battery_charging.cpp) -target_link_libraries(test_condition_is_battery_charging nav2_is_battery_charging_condition_bt_node) -ament_target_dependencies(test_condition_is_battery_charging ${dependencies}) +plugin_add_test(test_condition_is_battery_charging test_is_battery_charging.cpp nav2_is_battery_charging_condition_bt_node) -ament_add_gtest(test_condition_is_battery_low test_is_battery_low.cpp) -target_link_libraries(test_condition_is_battery_low nav2_is_battery_low_condition_bt_node) -ament_target_dependencies(test_condition_is_battery_low ${dependencies}) +plugin_add_test(test_condition_is_battery_low test_is_battery_low.cpp nav2_is_battery_low_condition_bt_node) -ament_add_gtest(test_condition_is_path_valid test_is_path_valid.cpp) -target_link_libraries(test_condition_is_path_valid nav2_is_path_valid_condition_bt_node) -ament_target_dependencies(test_condition_is_path_valid ${dependencies}) +plugin_add_test(test_condition_is_path_valid test_is_path_valid.cpp nav2_is_path_valid_condition_bt_node) -ament_add_gtest(test_are_error_codes_present test_are_error_codes_present.cpp) -target_link_libraries(test_are_error_codes_present nav2_would_a_controller_recovery_help_condition_bt_node) -ament_target_dependencies(test_are_error_codes_present ${dependencies}) +plugin_add_test(test_are_error_codes_present test_are_error_codes_present.cpp nav2_would_a_controller_recovery_help_condition_bt_node) -ament_add_gtest(test_would_a_controller_recovery_help test_would_a_controller_recovery_help.cpp) -target_link_libraries(test_would_a_controller_recovery_help nav2_would_a_controller_recovery_help_condition_bt_node) -ament_target_dependencies(test_would_a_controller_recovery_help ${dependencies}) +plugin_add_test(test_would_a_controller_recovery_help test_would_a_controller_recovery_help.cpp nav2_would_a_controller_recovery_help_condition_bt_node) -ament_add_gtest(test_would_a_planner_recovery_help test_would_a_planner_recovery_help.cpp) -target_link_libraries(test_would_a_planner_recovery_help nav2_would_a_planner_recovery_help_condition_bt_node) -ament_target_dependencies(test_would_a_planner_recovery_help ${dependencies}) +plugin_add_test(test_would_a_planner_recovery_help test_would_a_planner_recovery_help.cpp nav2_would_a_planner_recovery_help_condition_bt_node) -ament_add_gtest(test_would_a_smoother_recovery_help test_would_a_smoother_recovery_help.cpp) -target_link_libraries(test_would_a_smoother_recovery_help nav2_would_a_smoother_recovery_help_condition_bt_node) -ament_target_dependencies(test_would_a_smoother_recovery_help ${dependencies}) +plugin_add_test(test_would_a_smoother_recovery_help test_would_a_smoother_recovery_help.cpp nav2_would_a_smoother_recovery_help_condition_bt_node) diff --git a/nav2_behavior_tree/test/plugins/control/CMakeLists.txt b/nav2_behavior_tree/test/plugins/control/CMakeLists.txt index 16138305c2..e4bcb592be 100644 --- a/nav2_behavior_tree/test/plugins/control/CMakeLists.txt +++ b/nav2_behavior_tree/test/plugins/control/CMakeLists.txt @@ -1,11 +1,5 @@ -ament_add_gtest(test_control_recovery_node test_recovery_node.cpp) -target_link_libraries(test_control_recovery_node nav2_recovery_node_bt_node) -ament_target_dependencies(test_control_recovery_node ${dependencies}) +plugin_add_test(test_control_recovery_node test_recovery_node.cpp nav2_recovery_node_bt_node) -ament_add_gtest(test_control_pipeline_sequence test_pipeline_sequence.cpp) -target_link_libraries(test_control_pipeline_sequence nav2_pipeline_sequence_bt_node) -ament_target_dependencies(test_control_pipeline_sequence ${dependencies}) +plugin_add_test(test_control_pipeline_sequence test_pipeline_sequence.cpp nav2_pipeline_sequence_bt_node) -ament_add_gtest(test_control_round_robin_node test_round_robin_node.cpp) -target_link_libraries(test_control_round_robin_node nav2_round_robin_node_bt_node) -ament_target_dependencies(test_control_round_robin_node ${dependencies}) +plugin_add_test(test_control_round_robin_node test_round_robin_node.cpp nav2_round_robin_node_bt_node) diff --git a/nav2_behavior_tree/test/plugins/decorator/CMakeLists.txt b/nav2_behavior_tree/test/plugins/decorator/CMakeLists.txt index ed6504a682..98e6db595b 100644 --- a/nav2_behavior_tree/test/plugins/decorator/CMakeLists.txt +++ b/nav2_behavior_tree/test/plugins/decorator/CMakeLists.txt @@ -1,27 +1,13 @@ -ament_add_gtest(test_decorator_distance_controller test_distance_controller.cpp) -target_link_libraries(test_decorator_distance_controller nav2_distance_controller_bt_node) -ament_target_dependencies(test_decorator_distance_controller ${dependencies}) +plugin_add_test(test_decorator_distance_controller test_distance_controller.cpp nav2_distance_controller_bt_node) -ament_add_gtest(test_decorator_speed_controller test_speed_controller.cpp) -target_link_libraries(test_decorator_speed_controller nav2_speed_controller_bt_node) -ament_target_dependencies(test_decorator_speed_controller ${dependencies}) +plugin_add_test(test_decorator_speed_controller test_speed_controller.cpp nav2_speed_controller_bt_node) -ament_add_gtest(test_decorator_rate_controller test_rate_controller.cpp) -target_link_libraries(test_decorator_rate_controller nav2_rate_controller_bt_node) -ament_target_dependencies(test_decorator_rate_controller ${dependencies}) +plugin_add_test(test_decorator_rate_controller test_rate_controller.cpp nav2_rate_controller_bt_node) -ament_add_gtest(test_goal_updater_node test_goal_updater_node.cpp) -target_link_libraries(test_goal_updater_node nav2_goal_updater_node_bt_node) -ament_target_dependencies(test_goal_updater_node ${dependencies}) +plugin_add_test(test_goal_updater_node test_goal_updater_node.cpp nav2_goal_updater_node_bt_node) -ament_add_gtest(test_single_trigger_node test_single_trigger_node.cpp) -target_link_libraries(test_single_trigger_node nav2_single_trigger_bt_node) -ament_target_dependencies(test_single_trigger_node ${dependencies}) +plugin_add_test(test_single_trigger_node test_single_trigger_node.cpp nav2_single_trigger_bt_node) -ament_add_gtest(test_goal_updated_controller test_goal_updated_controller.cpp) -target_link_libraries(test_goal_updated_controller nav2_goal_updated_controller_bt_node) -ament_target_dependencies(test_goal_updated_controller ${dependencies}) +plugin_add_test(test_goal_updated_controller test_goal_updated_controller.cpp nav2_goal_updated_controller_bt_node) -ament_add_gtest(test_decorator_path_longer_on_approach test_path_longer_on_approach.cpp) -target_link_libraries(test_decorator_path_longer_on_approach nav2_path_longer_on_approach_bt_node) -ament_target_dependencies(test_decorator_path_longer_on_approach ${dependencies}) +plugin_add_test(test_decorator_path_longer_on_approach test_path_longer_on_approach.cpp nav2_path_longer_on_approach_bt_node) diff --git a/nav2_behavior_tree/test/test_bt_conversions.cpp b/nav2_behavior_tree/test/test_bt_conversions.cpp index 1c5c01cf67..6431681a85 100644 --- a/nav2_behavior_tree/test/test_bt_conversions.cpp +++ b/nav2_behavior_tree/test/test_bt_conversions.cpp @@ -14,9 +14,11 @@ // limitations under the License. #include -#include + #include +#include #include +#include #include "geometry_msgs/msg/point.hpp" #include "geometry_msgs/msg/quaternion.hpp" diff --git a/nav2_behaviors/CMakeLists.txt b/nav2_behaviors/CMakeLists.txt index df200309d9..a311259298 100644 --- a/nav2_behaviors/CMakeLists.txt +++ b/nav2_behaviors/CMakeLists.txt @@ -4,15 +4,13 @@ project(nav2_behaviors) find_package(ament_cmake REQUIRED) find_package(nav2_common 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(nav2_behavior_tree REQUIRED) find_package(nav2_util REQUIRED) find_package(nav2_msgs REQUIRED) -find_package(nav_msgs REQUIRED) find_package(tf2 REQUIRED) +find_package(tf2_ros REQUIRED) find_package(tf2_geometry_msgs REQUIRED) find_package(geometry_msgs REQUIRED) find_package(nav2_costmap_2d REQUIRED) @@ -21,24 +19,18 @@ find_package(pluginlib REQUIRED) nav2_package() -include_directories( - include -) - set(library_name behavior_server_core) set(executable_name behavior_server) set(dependencies rclcpp - rclcpp_action rclcpp_lifecycle rclcpp_components std_msgs nav2_util - nav2_behavior_tree nav2_msgs - nav_msgs tf2 + tf2_ros tf2_geometry_msgs geometry_msgs nav2_costmap_2d @@ -50,41 +42,115 @@ set(dependencies add_library(nav2_spin_behavior SHARED plugins/spin.cpp ) - -ament_target_dependencies(nav2_spin_behavior - ${dependencies} +target_include_directories(nav2_spin_behavior + PUBLIC + "$" + "$" +) +target_link_libraries(nav2_spin_behavior PUBLIC + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros + ${nav2_msgs_TARGETS} + ${geometry_msgs_TARGETS} + nav2_core::nav2_core + tf2::tf2 + nav2_util::nav2_util_core + nav2_costmap_2d::nav2_costmap_2d_core +) +target_link_libraries(nav2_spin_behavior PRIVATE + ${tf2_geometry_msgs_TARGETS} + pluginlib::pluginlib ) add_library(nav2_wait_behavior SHARED -plugins/wait.cpp + plugins/wait.cpp ) - -ament_target_dependencies(nav2_wait_behavior -${dependencies} +target_include_directories(nav2_wait_behavior + PUBLIC + "$" + "$" +) +target_link_libraries(nav2_wait_behavior PUBLIC + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros + ${nav2_msgs_TARGETS} + ${geometry_msgs_TARGETS} + nav2_core::nav2_core + tf2::tf2 + nav2_util::nav2_util_core + nav2_costmap_2d::nav2_costmap_2d_core ) add_library(nav2_drive_on_heading_behavior SHARED plugins/drive_on_heading.cpp ) - -ament_target_dependencies(nav2_drive_on_heading_behavior - ${dependencies} +target_include_directories(nav2_drive_on_heading_behavior + PUBLIC + "$" + "$" +) +target_link_libraries(nav2_drive_on_heading_behavior PUBLIC + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros + ${nav2_msgs_TARGETS} + ${geometry_msgs_TARGETS} + nav2_core::nav2_core + tf2::tf2 + nav2_util::nav2_util_core + nav2_costmap_2d::nav2_costmap_2d_core +) +target_link_libraries(nav2_drive_on_heading_behavior PRIVATE + pluginlib::pluginlib ) add_library(nav2_back_up_behavior SHARED plugins/back_up.cpp ) - -ament_target_dependencies(nav2_back_up_behavior - ${dependencies} +target_include_directories(nav2_back_up_behavior + PUBLIC + "$" + "$" +) +target_link_libraries(nav2_back_up_behavior PUBLIC + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros + ${nav2_msgs_TARGETS} + ${geometry_msgs_TARGETS} + nav2_core::nav2_core + tf2::tf2 + nav2_util::nav2_util_core + nav2_costmap_2d::nav2_costmap_2d_core +) +target_link_libraries(nav2_back_up_behavior PRIVATE + pluginlib::pluginlib ) add_library(nav2_assisted_teleop_behavior SHARED plugins/assisted_teleop.cpp ) - -ament_target_dependencies(nav2_assisted_teleop_behavior - ${dependencies} +target_include_directories(nav2_assisted_teleop_behavior + PUBLIC + "$" + "$" +) +target_link_libraries(nav2_assisted_teleop_behavior PUBLIC + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros + ${nav2_msgs_TARGETS} + ${geometry_msgs_TARGETS} + ${std_msgs_TARGETS} + nav2_core::nav2_core + tf2::tf2 + nav2_util::nav2_util_core + nav2_costmap_2d::nav2_costmap_2d_core +) +target_link_libraries(nav2_assisted_teleop_behavior PRIVATE + pluginlib::pluginlib ) pluginlib_export_plugin_description_file(nav2_core behavior_plugin.xml) @@ -93,26 +159,33 @@ pluginlib_export_plugin_description_file(nav2_core behavior_plugin.xml) add_library(${library_name} SHARED src/behavior_server.cpp ) - -ament_target_dependencies(${library_name} - ${dependencies} +target_include_directories(${library_name} + PUBLIC + "$" + "$" +) +target_link_libraries(${library_name} PUBLIC + rclcpp_lifecycle::rclcpp_lifecycle + nav2_util::nav2_util_core + tf2_ros::tf2_ros + pluginlib::pluginlib + nav2_core::nav2_core + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client +) +target_link_libraries(${library_name} PRIVATE + rclcpp_components::component ) # Executable add_executable(${executable_name} src/main.cpp ) - -target_link_libraries(${executable_name} ${library_name}) - -ament_target_dependencies(${executable_name} - ${dependencies} -) +target_link_libraries(${executable_name} PRIVATE rclcpp::rclcpp ${library_name}) rclcpp_components_register_nodes(${library_name} "behavior_server::BehaviorServer") -install(TARGETS ${library_name} - nav2_spin_behavior +install(TARGETS nav2_spin_behavior nav2_wait_behavior nav2_assisted_teleop_behavior nav2_drive_on_heading_behavior @@ -122,12 +195,19 @@ install(TARGETS ${library_name} RUNTIME DESTINATION bin ) +install(TARGETS ${library_name} + EXPORT ${library_name} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + install(TARGETS ${executable_name} RUNTIME DESTINATION lib/${PROJECT_NAME} ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) install(FILES behavior_plugin.xml @@ -142,10 +222,13 @@ if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) + find_package(rclcpp_action REQUIRED) + + ament_find_gtest() add_subdirectory(test) endif() -ament_export_include_directories(include) +ament_export_include_directories(include/${PROJECT_NAME}) ament_export_libraries(${library_name} nav2_spin_behavior nav2_wait_behavior @@ -154,4 +237,5 @@ ament_export_libraries(${library_name} nav2_back_up_behavior ) ament_export_dependencies(${dependencies}) +ament_export_targets(${library_name}) ament_package() diff --git a/nav2_behaviors/package.xml b/nav2_behaviors/package.xml index 6ab1b283d2..5e41b139be 100644 --- a/nav2_behaviors/package.xml +++ b/nav2_behaviors/package.xml @@ -11,35 +11,22 @@ ament_cmake nav2_common - rclcpp - rclcpp_action - rclcpp_lifecycle - nav2_behavior_tree - nav2_util - nav2_msgs - nav_msgs - tf2 - tf2_geometry_msgs - geometry_msgs - nav2_costmap_2d - nav2_core - pluginlib - - rclcpp - rclcpp_action - rclcpp_lifecycle - nav2_behavior_tree - nav2_util - nav2_msgs - nav_msgs - geometry_msgs - nav2_costmap_2d - nav2_core - pluginlib + geometry_msgs + nav2_core + nav2_costmap_2d + nav2_msgs + nav2_util + pluginlib + rclcpp + rclcpp_lifecycle + tf2 + tf2_geometry_msgs + tf2_ros ament_lint_common ament_lint_auto ament_cmake_gtest + rclcpp_action ament_cmake diff --git a/nav2_behaviors/test/CMakeLists.txt b/nav2_behaviors/test/CMakeLists.txt index 9418db1571..6e170d7c80 100644 --- a/nav2_behaviors/test/CMakeLists.txt +++ b/nav2_behaviors/test/CMakeLists.txt @@ -1,7 +1,4 @@ ament_add_gtest(test_behaviors test_behaviors.cpp ) - -ament_target_dependencies(test_behaviors - ${dependencies} -) +target_link_libraries(test_behaviors rclcpp::rclcpp rclcpp_action::rclcpp_action ${nav2_msgs_TARGETS} ${library_name}) diff --git a/nav2_bt_navigator/CMakeLists.txt b/nav2_bt_navigator/CMakeLists.txt index cfe6a0d486..40bcebaaed 100644 --- a/nav2_bt_navigator/CMakeLists.txt +++ b/nav2_bt_navigator/CMakeLists.txt @@ -7,74 +7,105 @@ 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(geometry_msgs REQUIRED) find_package(nav2_behavior_tree REQUIRED) find_package(nav_msgs REQUIRED) find_package(nav2_msgs REQUIRED) -find_package(behaviortree_cpp_v3 REQUIRED) -find_package(std_srvs REQUIRED) find_package(nav2_util REQUIRED) find_package(nav2_core REQUIRED) find_package(tf2_ros REQUIRED) find_package(pluginlib REQUIRED) +find_package(ament_index_cpp REQUIRED) nav2_package() -include_directories( - include -) - set(executable_name bt_navigator) -add_executable(${executable_name} - src/main.cpp -) - set(library_name ${executable_name}_core) -set(dependencies - rclcpp - rclcpp_action - rclcpp_lifecycle - rclcpp_components - std_msgs - geometry_msgs - nav2_behavior_tree - nav_msgs - nav2_msgs - behaviortree_cpp_v3 - std_srvs - nav2_util - nav2_core - tf2_ros - pluginlib -) - add_library(${library_name} SHARED src/bt_navigator.cpp ) - -ament_target_dependencies(${executable_name} - ${dependencies} +target_include_directories(${library_name} + PRIVATE + "$" + "$" +) +target_link_libraries(${library_name} PUBLIC + nav2_util::nav2_util_core + rclcpp_action::rclcpp_action + tf2_ros::tf2_ros + nav2_core::nav2_core + pluginlib::pluginlib + rclcpp::rclcpp +) +target_link_libraries(${library_name} PRIVATE + nav2_behavior_tree::nav2_behavior_tree + rclcpp_lifecycle::rclcpp_lifecycle + rclcpp_components::component ) -target_link_libraries(${executable_name} ${library_name}) - -ament_target_dependencies(${library_name} - ${dependencies} +add_executable(${executable_name} + src/main.cpp +) +target_include_directories(${executable_name} + PRIVATE + "$" + "$" +) +target_link_libraries(${executable_name} PRIVATE + ${library_name} + rclcpp::rclcpp ) add_library(nav2_navigate_to_pose_navigator SHARED src/navigators/navigate_to_pose.cpp) -ament_target_dependencies(nav2_navigate_to_pose_navigator ${dependencies}) +target_include_directories(nav2_navigate_to_pose_navigator + PRIVATE + "$" + "$" +) +target_link_libraries(nav2_navigate_to_pose_navigator PUBLIC + rclcpp::rclcpp + rclcpp_action::rclcpp_action + ${geometry_msgs_TARGETS} + nav2_core::nav2_core + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + ${nav_msgs_TARGETS} +) +target_link_libraries(nav2_navigate_to_pose_navigator PRIVATE + rclcpp_lifecycle::rclcpp_lifecycle + ament_index_cpp::ament_index_cpp + nav2_behavior_tree::nav2_behavior_tree + pluginlib::pluginlib +) add_library(nav2_navigate_through_poses SHARED src/navigators/navigate_through_poses.cpp) -ament_target_dependencies(nav2_navigate_through_poses ${dependencies}) +target_include_directories(nav2_navigate_through_poses + PRIVATE + "$" + "$" +) +target_link_libraries(nav2_navigate_through_poses PUBLIC + rclcpp::rclcpp + rclcpp_action::rclcpp_action + ${geometry_msgs_TARGETS} + nav2_core::nav2_core + ${nav_msgs_TARGETS} + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core +) +target_link_libraries(nav2_navigate_through_poses PRIVATE + rclcpp_lifecycle::rclcpp_lifecycle + ament_index_cpp::ament_index_cpp + pluginlib::pluginlib +) pluginlib_export_plugin_description_file(nav2_core navigator_plugins.xml) rclcpp_components_register_nodes(${library_name} "nav2_bt_navigator::BtNavigator") install(TARGETS ${library_name} nav2_navigate_to_pose_navigator nav2_navigate_through_poses + EXPORT export_${library_name} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin @@ -85,7 +116,7 @@ install(TARGETS ${executable_name} ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) install(DIRECTORY behavior_trees DESTINATION share/${PROJECT_NAME}) @@ -97,5 +128,6 @@ endif() ament_export_include_directories(include) ament_export_libraries(${library_name} nav2_navigate_to_pose_navigator nav2_navigate_through_poses) -ament_export_dependencies(${dependencies}) +ament_export_dependencies(rclcpp rclcpp_action geometry_msgs nav2_core nav_msgs nav2_msgs nav2_util tf2_ros pluginlib) +ament_export_targets(export_${library_name}) ament_package() diff --git a/nav2_bt_navigator/package.xml b/nav2_bt_navigator/package.xml index f4a3dbe655..e5390accb1 100644 --- a/nav2_bt_navigator/package.xml +++ b/nav2_bt_navigator/package.xml @@ -7,36 +7,22 @@ Michael Jeronimo Apache-2.0 - tf2_ros - ament_cmake + nav2_common - rclcpp - rclcpp_action - rclcpp_lifecycle - nav2_behavior_tree - nav_msgs - nav2_msgs - behaviortree_cpp_v3 - std_msgs - geometry_msgs - std_srvs - nav2_util - pluginlib - nav2_core - behaviortree_cpp_v3 - rclcpp - rclcpp_action - rclcpp_lifecycle - nav2_behavior_tree - nav_msgs - nav2_msgs - std_msgs - nav2_util - geometry_msgs - pluginlib - nav2_core + ament_index_cpp + geometry_msgs + nav_msgs + nav2_behavior_tree + nav2_core + nav2_msgs + nav2_util + pluginlib + rclcpp + rclcpp_action + rclcpp_lifecycle + tf2_ros ament_lint_common ament_lint_auto diff --git a/nav2_collision_monitor/CMakeLists.txt b/nav2_collision_monitor/CMakeLists.txt index b902cc4ea8..6888784fc2 100644 --- a/nav2_collision_monitor/CMakeLists.txt +++ b/nav2_collision_monitor/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.5) project(nav2_collision_monitor) -### Dependencies ### - find_package(ament_cmake REQUIRED) find_package(rclcpp REQUIRED) find_package(rclcpp_components REQUIRED) @@ -17,30 +15,8 @@ find_package(nav2_costmap_2d REQUIRED) find_package(nav2_msgs REQUIRED) find_package(visualization_msgs REQUIRED) -### Header ### - nav2_package() -### Libraries and executables ### - -include_directories( - include -) - -set(dependencies - rclcpp - rclcpp_components - sensor_msgs - geometry_msgs - tf2 - tf2_ros - tf2_geometry_msgs - nav2_util - nav2_costmap_2d - nav2_msgs - visualization_msgs -) - set(monitor_executable_name collision_monitor) set(detector_executable_name collision_detector) set(monitor_library_name ${monitor_executable_name}_core) @@ -56,6 +32,27 @@ add_library(${monitor_library_name} SHARED src/range.cpp src/kinematics.cpp ) +target_include_directories(${monitor_library_name} + PUBLIC + "$" + "$") +target_link_libraries(${monitor_library_name} PUBLIC + rclcpp::rclcpp + ${geometry_msgs_TARGETS} + ${visualization_msgs_TARGETS} + tf2::tf2 + tf2_ros::tf2_ros + nav2_util::nav2_util_core + ${nav2_msgs_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle + nav2_costmap_2d::nav2_costmap_2d_core + ${sensor_msgs_TARGETS} + nav2_costmap_2d::nav2_costmap_2d_client +) +target_link_libraries(${monitor_library_name} PRIVATE + rclcpp_components::component +) + add_library(${detector_library_name} SHARED src/collision_detector_node.cpp src/polygon.cpp @@ -66,43 +63,57 @@ add_library(${detector_library_name} SHARED src/range.cpp src/kinematics.cpp ) - -add_executable(${monitor_executable_name} - src/collision_monitor_main.cpp +target_include_directories(${detector_library_name} + PUBLIC + "$" + "$") +target_link_libraries(${detector_library_name} PUBLIC + tf2_ros::tf2_ros + tf2::tf2 + nav2_util::nav2_util_core + ${nav2_msgs_TARGETS} + ${visualization_msgs_TARGETS} + ${sensor_msgs_TARGETS} + ${geometry_msgs_TARGETS} + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client ) -add_executable(${detector_executable_name} - src/collision_detector_main.cpp +target_link_libraries(${detector_library_name} PRIVATE + rclcpp_components::component ) -ament_target_dependencies(${monitor_library_name} - ${dependencies} -) -ament_target_dependencies(${detector_library_name} - ${dependencies} +add_executable(${monitor_executable_name} + src/collision_monitor_main.cpp ) - -target_link_libraries(${monitor_executable_name} +target_include_directories(${monitor_executable_name} + PUBLIC + "$" + "$") +target_link_libraries(${monitor_executable_name} PRIVATE + rclcpp::rclcpp ${monitor_library_name} ) -target_link_libraries(${detector_executable_name} - ${detector_library_name} -) -ament_target_dependencies(${monitor_executable_name} - ${dependencies} +add_executable(${detector_executable_name} + src/collision_detector_main.cpp ) - -ament_target_dependencies(${detector_executable_name} - ${dependencies} +target_include_directories(${detector_executable_name} + PUBLIC + "$" + "$") +target_link_libraries(${detector_executable_name} PRIVATE + rclcpp::rclcpp + ${detector_library_name} ) rclcpp_components_register_nodes(${monitor_library_name} "nav2_collision_monitor::CollisionMonitor") rclcpp_components_register_nodes(${detector_library_name} "nav2_collision_monitor::CollisionDetector") -### Install ### - install(TARGETS ${monitor_library_name} ${detector_library_name} + EXPORT export_${PROJECT_NAME} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin @@ -113,14 +124,12 @@ install(TARGETS ${monitor_executable_name} ${detector_executable_name} ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) install(DIRECTORY params DESTINATION share/${PROJECT_NAME}) -### Testing ### - if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) # the following line skips the linter which checks for copyrights @@ -129,13 +138,15 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) + + ament_find_gtest() + add_subdirectory(test) endif() -### Ament stuff ### - ament_export_include_directories(include) ament_export_libraries(${monitor_library_name} ${detector_library_name}) ament_export_dependencies(${dependencies}) +ament_export_targets(export_${PROJECT_NAME}) ament_package() diff --git a/nav2_collision_monitor/test/CMakeLists.txt b/nav2_collision_monitor/test/CMakeLists.txt index f2b4619bbd..4ca61588fa 100644 --- a/nav2_collision_monitor/test/CMakeLists.txt +++ b/nav2_collision_monitor/test/CMakeLists.txt @@ -1,43 +1,50 @@ # Kinematics test ament_add_gtest(kinematics_test kinematics_test.cpp) -ament_target_dependencies(kinematics_test - ${dependencies} -) target_link_libraries(kinematics_test + rclcpp::rclcpp ${monitor_library_name} ) # Data sources test ament_add_gtest(sources_test sources_test.cpp) -ament_target_dependencies(sources_test - ${dependencies} -) target_link_libraries(sources_test ${monitor_library_name} + rclcpp::rclcpp + nav2_util::nav2_util_core + ${sensor_msgs_TARGETS} + tf2_ros::tf2_ros ) # Polygon shapes test ament_add_gtest(polygons_test polygons_test.cpp) -ament_target_dependencies(polygons_test - ${dependencies} -) target_link_libraries(polygons_test ${monitor_library_name} + rclcpp::rclcpp + nav2_util::nav2_util_core + ${geometry_msgs_TARGETS} + tf2_ros::tf2_ros ) # Collision Monitor node test ament_add_gtest(collision_monitor_node_test collision_monitor_node_test.cpp) -ament_target_dependencies(collision_monitor_node_test - ${dependencies} -) target_link_libraries(collision_monitor_node_test ${monitor_library_name} + rclcpp::rclcpp + nav2_util::nav2_util_core + ${nav2_msgs_TARGETS} + ${sensor_msgs_TARGETS} + ${geometry_msgs_TARGETS} + ${visualization_msgs_TARGETS} + tf2_ros::tf2_ros ) # Collision Detector node test ament_add_gtest(collision_detector_node_test collision_detector_node_test.cpp) -ament_target_dependencies(collision_detector_node_test - ${dependencies} -) target_link_libraries(collision_detector_node_test ${detector_library_name} -) \ No newline at end of file + rclcpp::rclcpp + nav2_util::nav2_util_core + ${sensor_msgs_TARGETS} + ${geometry_msgs_TARGETS} + ${visualization_msgs_TARGETS} + tf2_ros::tf2_ros +) diff --git a/nav2_constrained_smoother/CMakeLists.txt b/nav2_constrained_smoother/CMakeLists.txt index c68732d4d7..76798309cc 100644 --- a/nav2_constrained_smoother/CMakeLists.txt +++ b/nav2_constrained_smoother/CMakeLists.txt @@ -6,16 +6,15 @@ set(CMAKE_BUILD_TYPE Release) # significant Ceres optimization speedup find_package(ament_cmake REQUIRED) find_package(nav2_core REQUIRED) find_package(nav2_common REQUIRED) -find_package(angles REQUIRED) find_package(rclcpp REQUIRED) find_package(rclcpp_action REQUIRED) find_package(nav2_util REQUIRED) find_package(nav2_msgs REQUIRED) find_package(nav2_costmap_2d REQUIRED) find_package(pluginlib REQUIRED) +find_package(Eigen3 REQUIRED) find_package(Ceres REQUIRED COMPONENTS SuiteSparse) - -set(CMAKE_CXX_STANDARD 17) +find_package(tf2_ros REQUIRED) if(${CERES_VERSION} VERSION_LESS_EQUAL 2.0.0) add_definitions(-DUSE_OLD_CERES_API) @@ -25,26 +24,27 @@ nav2_package() set(library_name nav2_constrained_smoother) -include_directories( - include +add_library(${library_name} SHARED src/constrained_smoother.cpp) +target_include_directories(${library_name} + PUBLIC + "$" + "$" ) - -set(dependencies - angles - rclcpp - rclcpp_action - nav2_msgs - nav2_costmap_2d - nav2_util - nav2_core - pluginlib +target_link_libraries(${library_name} PUBLIC + nav2_core::nav2_core + rclcpp::rclcpp + nav2_util::nav2_util_core + ${geometry_msgs_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros + nav2_costmap_2d::nav2_costmap_2d_core + Ceres::ceres + Eigen3::Eigen +) +target_link_libraries(${library_name} PRIVATE + pluginlib::pluginlib + ${nav_msgs_TARGETS} ) - -add_library(${library_name} SHARED src/constrained_smoother.cpp) -target_link_libraries(${library_name} Ceres::ceres) -# prevent pluginlib from using boost -target_compile_definitions(${library_name} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") -ament_target_dependencies(${library_name} ${dependencies}) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) @@ -53,29 +53,29 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) + find_package(angles REQUIRED) + + ament_find_gtest() + add_subdirectory(test) endif() install( - TARGETS - ${library_name} + 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) - ament_lint_auto_find_test_dependencies() -endif() - ament_export_include_directories(include) ament_export_libraries(${library_name}) -ament_export_dependencies(${dependencies}) +ament_export_dependencies(nav2_core rclcpp nav2_util geometry_msgs rclcpp_lifecycle tf2_ros nav2_costmap_2d ceres eigen3) +ament_export_targets(${library_name}) pluginlib_export_plugin_description_file(nav2_core nav2_constrained_smoother.xml) diff --git a/nav2_constrained_smoother/package.xml b/nav2_constrained_smoother/package.xml index c90edc7c82..53f1873ff1 100644 --- a/nav2_constrained_smoother/package.xml +++ b/nav2_constrained_smoother/package.xml @@ -9,8 +9,9 @@ Apache-2.0 ament_cmake + eigen + nav2_common - angles rclcpp nav2_util nav2_msgs @@ -18,11 +19,13 @@ nav2_core pluginlib libceres-dev + tf2_ros ament_lint_common ament_lint_auto ament_cmake_gtest ament_cmake_pytest + angles ament_cmake diff --git a/nav2_constrained_smoother/test/CMakeLists.txt b/nav2_constrained_smoother/test/CMakeLists.txt index cf4ecd1967..65b8f3f7db 100644 --- a/nav2_constrained_smoother/test/CMakeLists.txt +++ b/nav2_constrained_smoother/test/CMakeLists.txt @@ -1,12 +1,15 @@ ament_add_gtest(test_constrained_smoother test_constrained_smoother.cpp ) - target_link_libraries(test_constrained_smoother ${library_name} -) -ament_target_dependencies(test_constrained_smoother - ${dependencies} + angles::angles + rclcpp::rclcpp + tf2_ros::tf2_ros + nav2_util::nav2_util_core + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client + ${geometry_msgs_TARGETS} ) ament_add_gtest(test_smoother_cost_function @@ -14,7 +17,5 @@ ament_add_gtest(test_smoother_cost_function ) target_link_libraries(test_smoother_cost_function ${library_name} + rclcpp::rclcpp ) -ament_target_dependencies(test_smoother_cost_function - ${dependencies} -) \ No newline at end of file diff --git a/nav2_controller/CMakeLists.txt b/nav2_controller/CMakeLists.txt index ded67fbf41..7f166d6ec6 100644 --- a/nav2_controller/CMakeLists.txt +++ b/nav2_controller/CMakeLists.txt @@ -14,55 +14,135 @@ find_package(nav2_msgs REQUIRED) find_package(nav_2d_utils REQUIRED) find_package(nav_2d_msgs REQUIRED) find_package(pluginlib REQUIRED) +find_package(lifecycle_msgs REQUIRED) +find_package(rcl_interfaces REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(tf2_ros REQUIRED) nav2_package() -include_directories( - include -) - set(executable_name controller_server) -add_executable(${executable_name} - src/main.cpp -) - set(library_name ${executable_name}_core) add_library(${library_name} SHARED src/controller_server.cpp ) +target_include_directories(${library_name} + PUBLIC + "$" + "$" +) +target_link_libraries(${library_name} PUBLIC + nav2_core::nav2_core + nav2_costmap_2d::nav2_costmap_2d_core + tf2_ros::tf2_ros + ${nav2_msgs_TARGETS} + pluginlib::pluginlib + nav2_util::nav2_util_core + nav_2d_utils::conversions + nav_2d_utils::tf_help + rclcpp::rclcpp + ${rcl_interfaces_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle + ${geometry_msgs_TARGETS} + ${nav_2d_msgs_TARGETS} +) +target_link_libraries(${library_name} PRIVATE + ${lifecycle_msgs_TARGETS} + rclcpp_components::component +) -set(dependencies - angles - rclcpp - rclcpp_action - rclcpp_components - std_msgs - nav2_msgs - nav_2d_utils - nav_2d_msgs - nav2_util - nav2_core - pluginlib +add_executable(${executable_name} + src/main.cpp +) +target_include_directories(${executable_name} + PUBLIC + "$" + "$" +) +target_link_libraries(${executable_name} PRIVATE + rclcpp::rclcpp + ${library_name} ) add_library(simple_progress_checker SHARED plugins/simple_progress_checker.cpp) -ament_target_dependencies(simple_progress_checker ${dependencies}) +target_include_directories(simple_progress_checker + PUBLIC + "$" + "$" +) +target_link_libraries(simple_progress_checker PUBLIC + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${geometry_msgs_TARGETS} + nav2_core::nav2_core + ${rcl_interfaces_TARGETS} +) +target_link_libraries(simple_progress_checker PRIVATE + nav2_util::nav2_util_core + nav_2d_utils::conversions + pluginlib::pluginlib +) add_library(pose_progress_checker SHARED plugins/pose_progress_checker.cpp) -target_link_libraries(pose_progress_checker simple_progress_checker) -ament_target_dependencies(pose_progress_checker ${dependencies}) +target_include_directories(pose_progress_checker + PUBLIC + "$" + "$" +) +target_link_libraries(pose_progress_checker PUBLIC + simple_progress_checker + rclcpp_lifecycle::rclcpp_lifecycle + rclcpp::rclcpp + ${geometry_msgs_TARGETS} + ${rcl_interfaces_TARGETS} +) +target_link_libraries(pose_progress_checker PRIVATE + pluginlib::pluginlib + nav2_util::nav2_util_core + nav_2d_utils::conversions + angles::angles +) add_library(simple_goal_checker SHARED plugins/simple_goal_checker.cpp) -ament_target_dependencies(simple_goal_checker ${dependencies}) +target_include_directories(simple_goal_checker + PUBLIC + "$" + "$" +) +target_link_libraries(simple_goal_checker PUBLIC + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + nav2_core::nav2_core + ${rcl_interfaces_TARGETS} + ${geometry_msgs_TARGETS} + nav2_costmap_2d::nav2_costmap_2d_core +) +target_link_libraries(simple_goal_checker PRIVATE + pluginlib::pluginlib + angles::angles + nav2_util::nav2_util_core + tf2::tf2 +) add_library(stopped_goal_checker SHARED plugins/stopped_goal_checker.cpp) -target_link_libraries(stopped_goal_checker simple_goal_checker) -ament_target_dependencies(stopped_goal_checker ${dependencies}) - -ament_target_dependencies(${library_name} - ${dependencies} +target_include_directories(stopped_goal_checker + PUBLIC + "$" + "$" +) +target_link_libraries(stopped_goal_checker PUBLIC + simple_goal_checker + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${geometry_msgs_TARGETS} + nav2_costmap_2d::nav2_costmap_2d_core + ${rcl_interfaces_TARGETS} +) +target_link_libraries(stopped_goal_checker PRIVATE + pluginlib::pluginlib + nav2_util::nav2_util_core ) if(BUILD_TESTING) @@ -72,18 +152,17 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) - add_subdirectory(plugins/test) -endif() -ament_target_dependencies(${executable_name} - ${dependencies} -) + ament_find_gtest() -target_link_libraries(${executable_name} ${library_name}) + add_subdirectory(test) + add_subdirectory(plugins/test) +endif() rclcpp_components_register_nodes(${library_name} "nav2_controller::ControllerServer") install(TARGETS simple_progress_checker pose_progress_checker simple_goal_checker stopped_goal_checker ${library_name} + EXPORT ${library_name} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin @@ -94,23 +173,17 @@ install(TARGETS ${executable_name} ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - find_package(ament_cmake_gtest REQUIRED) - ament_lint_auto_find_test_dependencies() - add_subdirectory(test) -endif() - ament_export_include_directories(include) ament_export_libraries(simple_progress_checker pose_progress_checker simple_goal_checker stopped_goal_checker ${library_name}) -ament_export_dependencies(${dependencies}) +ament_export_dependencies(nav2_core nav2_costmap_2d tf2_ros nav2_msgs pluginlib nav2_util nav_2d_utils rclcpp rcl_interfaces rclcpp_lifecycle geometry_msgs nav_2d_msgs) +ament_export_targets(${library_name}) pluginlib_export_plugin_description_file(nav2_core plugins.xml) ament_package() diff --git a/nav2_controller/package.xml b/nav2_controller/package.xml index 48a7359614..0e4f4bf82c 100644 --- a/nav2_controller/package.xml +++ b/nav2_controller/package.xml @@ -19,6 +19,10 @@ nav_2d_msgs nav2_core pluginlib + lifecycle_msgs + rcl_interfaces + geometry_msgs + tf2_ros ament_lint_common ament_lint_auto diff --git a/nav2_controller/plugins/test/CMakeLists.txt b/nav2_controller/plugins/test/CMakeLists.txt index 0226676ce3..3a0d0d2cf5 100644 --- a/nav2_controller/plugins/test/CMakeLists.txt +++ b/nav2_controller/plugins/test/CMakeLists.txt @@ -1,4 +1,4 @@ ament_add_gtest(pctest progress_checker.cpp) -target_link_libraries(pctest simple_progress_checker pose_progress_checker) +target_link_libraries(pctest simple_progress_checker pose_progress_checker nav_2d_utils::conversions) ament_add_gtest(gctest goal_checker.cpp) -target_link_libraries(gctest simple_goal_checker stopped_goal_checker) +target_link_libraries(gctest simple_goal_checker stopped_goal_checker nav_2d_utils::conversions) diff --git a/nav2_controller/test/CMakeLists.txt b/nav2_controller/test/CMakeLists.txt index d415d906ef..16d75498b4 100644 --- a/nav2_controller/test/CMakeLists.txt +++ b/nav2_controller/test/CMakeLists.txt @@ -2,9 +2,8 @@ ament_add_gtest(test_dynamic_parameters test_dynamic_parameters.cpp ) -ament_target_dependencies(test_dynamic_parameters - ${dependencies} -) target_link_libraries(test_dynamic_parameters ${library_name} + nav2_util::nav2_util_core + rclcpp::rclcpp ) diff --git a/nav2_core/CMakeLists.txt b/nav2_core/CMakeLists.txt index 988f940864..62f7e2a9fd 100644 --- a/nav2_core/CMakeLists.txt +++ b/nav2_core/CMakeLists.txt @@ -30,8 +30,35 @@ set(dependencies nav2_behavior_tree ) +add_library(nav2_core INTERFACE) +target_include_directories(nav2_core + INTERFACE + "$" + "$" +) +target_link_libraries(nav2_core INTERFACE + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${std_msgs_TARGETS} + ${geometry_msgs_TARGETS} + nav2_costmap_2d::nav2_costmap_2d_core + pluginlib::pluginlib + ${visualization_msgs_TARGETS} + ${nav_msgs_TARGETS} + tf2_ros::tf2_ros + nav2_util::nav2_util_core + nav2_behavior_tree::nav2_behavior_tree +) + +install(TARGETS nav2_core + EXPORT nav2_core + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -41,7 +68,8 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() endif() -ament_export_include_directories(include) +ament_export_include_directories(include/${PROJECT_NAME}) ament_export_dependencies(${dependencies}) +ament_export_targets(nav2_core) ament_package() diff --git a/nav2_costmap_2d/CMakeLists.txt b/nav2_costmap_2d/CMakeLists.txt index 3be30b2853..23d156f1cf 100644 --- a/nav2_costmap_2d/CMakeLists.txt +++ b/nav2_costmap_2d/CMakeLists.txt @@ -26,7 +26,6 @@ find_package(visualization_msgs REQUIRED) find_package(angles REQUIRED) remove_definitions(-DDISABLE_LIBUSB-1.0) -find_package(Eigen3 3.3 REQUIRED) nav2_package() @@ -45,41 +44,22 @@ add_library(nav2_costmap_2d_core SHARED src/footprint_collision_checker.cpp plugins/costmap_filters/costmap_filter.cpp ) -add_library(${PROJECT_NAME}::nav2_costmap_2d_core ALIAS nav2_costmap_2d_core) - target_include_directories(nav2_costmap_2d_core PUBLIC "$" "$" ) - -set(dependencies - geometry_msgs - laser_geometry - map_msgs - message_filters - nav2_msgs - nav2_util - nav2_voxel_grid - nav_msgs - pluginlib - rclcpp - rclcpp_lifecycle - sensor_msgs - std_msgs - std_srvs - tf2 - tf2_geometry_msgs - tf2_ros - tf2_sensor_msgs - visualization_msgs - angles -) - -ament_target_dependencies(nav2_costmap_2d_core - ${dependencies} -) -target_link_libraries(nav2_costmap_2d_core Eigen3::Eigen) +target_link_libraries(nav2_costmap_2d_core PUBLIC + ${geometry_msgs_TARGETS} + tf2_ros::tf2_ros + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + ${nav_msgs_TARGETS} + ${tf2_sensor_msgs_TARGETS} + ${map_msgs_TARGETS} + ${std_srvs_TARGETS} + pluginlib::pluginlib +) add_library(layers SHARED plugins/inflation_layer.cpp @@ -90,12 +70,21 @@ add_library(layers SHARED plugins/range_sensor_layer.cpp plugins/denoise_layer.cpp ) -add_library(${PROJECT_NAME}::layers ALIAS layers) -ament_target_dependencies(layers - ${dependencies} +target_include_directories(layers + PUBLIC + "$" + "$" ) -target_link_libraries(layers - ${PROJECT_NAME}::nav2_costmap_2d_core +target_link_libraries(layers PUBLIC + angles::angles + rclcpp::rclcpp + message_filters::message_filters + laser_geometry::laser_geometry + nav2_voxel_grid::voxel_grid + nav2_costmap_2d_core +) +target_link_libraries(layers PRIVATE + pluginlib::pluginlib ) add_library(filters SHARED @@ -103,14 +92,13 @@ add_library(filters SHARED plugins/costmap_filters/speed_filter.cpp plugins/costmap_filters/binary_filter.cpp ) -add_library(${PROJECT_NAME}::filters ALIAS filters) - - -ament_target_dependencies(filters - ${dependencies} +target_include_directories(filters + PUBLIC + "$" + "$" ) -target_link_libraries(filters - ${PROJECT_NAME}::nav2_costmap_2d_core +target_link_libraries(filters PUBLIC + nav2_costmap_2d_core ) add_library(nav2_costmap_2d_client SHARED @@ -118,39 +106,37 @@ add_library(nav2_costmap_2d_client SHARED src/costmap_subscriber.cpp src/costmap_topic_collision_checker.cpp ) -add_library(${PROJECT_NAME}::nav2_costmap_2d_client ALIAS nav2_costmap_2d_client) - -ament_target_dependencies(nav2_costmap_2d_client - ${dependencies} +target_include_directories(nav2_costmap_2d_client + PUBLIC + "$" + "$" ) - -target_link_libraries(nav2_costmap_2d_client - ${PROJECT_NAME}::nav2_costmap_2d_core +target_link_libraries(nav2_costmap_2d_client PUBLIC + nav2_costmap_2d_core ) add_executable(nav2_costmap_2d_markers src/costmap_2d_markers.cpp) -target_link_libraries(nav2_costmap_2d_markers - ${PROJECT_NAME}::nav2_costmap_2d_core -) - -ament_target_dependencies(nav2_costmap_2d_markers - ${dependencies} +target_link_libraries(nav2_costmap_2d_markers PRIVATE + rclcpp::rclcpp + ${visualization_msgs_TARGETS} + ${nav2_msgs_TARGETS} + nav2_voxel_grid::voxel_grid + nav2_util::nav2_util_core ) add_executable(nav2_costmap_2d_cloud src/costmap_2d_cloud.cpp) -target_link_libraries(nav2_costmap_2d_cloud - ${PROJECT_NAME}::nav2_costmap_2d_core +target_link_libraries(nav2_costmap_2d_cloud PRIVATE + rclcpp::rclcpp + ${sensor_msgs_TARGETS} + nav2_voxel_grid::voxel_grid + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core ) add_executable(nav2_costmap_2d src/costmap_2d_node.cpp) -ament_target_dependencies(nav2_costmap_2d - ${dependencies} -) - -target_link_libraries(nav2_costmap_2d - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::layers - ${PROJECT_NAME}::filters +target_link_libraries(nav2_costmap_2d PRIVATE + rclcpp::rclcpp + nav2_costmap_2d_core ) install(TARGETS @@ -184,11 +170,12 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) + ament_find_gtest() add_subdirectory(test) pluginlib_export_plugin_description_file(nav2_costmap_2d test/regression/order_layer.xml) endif() ament_export_targets(export_${PROJECT_NAME} HAS_LIBRARY_TARGET) -ament_export_dependencies(${dependencies}) +ament_export_dependencies(geometry_msgs tf2_ros nav2_msgs nav2_util nav_msgs tf2_sensor_msgs map_msgs std_srvs pluginlib angles rclcpp message_filters laser_geometry nav2_voxel_grid) pluginlib_export_plugin_description_file(nav2_costmap_2d costmap_plugins.xml) ament_package() diff --git a/nav2_costmap_2d/test/integration/CMakeLists.txt b/nav2_costmap_2d/test/integration/CMakeLists.txt index 6e0e32a3bd..09bbca1fdb 100644 --- a/nav2_costmap_2d/test/integration/CMakeLists.txt +++ b/nav2_costmap_2d/test/integration/CMakeLists.txt @@ -2,57 +2,57 @@ ament_add_gtest_executable(footprint_tests_exec footprint_tests.cpp ) target_link_libraries(footprint_tests_exec - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::layers + nav2_costmap_2d_core + layers ) ament_add_gtest_executable(test_collision_checker_exec test_costmap_topic_collision_checker.cpp ) target_link_libraries(test_collision_checker_exec - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::nav2_costmap_2d_client - ${PROJECT_NAME}::layers + nav2_costmap_2d_core + nav2_costmap_2d_client + layers ) ament_add_gtest_executable(inflation_tests_exec inflation_tests.cpp ) target_link_libraries(inflation_tests_exec - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::layers + nav2_costmap_2d_core + layers ) ament_add_gtest_executable(obstacle_tests_exec obstacle_tests.cpp ) target_link_libraries(obstacle_tests_exec - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::layers + nav2_costmap_2d_core + layers ) ament_add_gtest_executable(range_tests_exec range_tests.cpp ) target_link_libraries(range_tests_exec - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::layers + nav2_costmap_2d_core + layers ) ament_add_gtest(dyn_params_tests dyn_params_tests.cpp ) target_link_libraries(dyn_params_tests - ${PROJECT_NAME}::nav2_costmap_2d_core + nav2_costmap_2d_core ) ament_add_gtest_executable(test_costmap_publisher_exec test_costmap_2d_publisher.cpp ) target_link_libraries(test_costmap_publisher_exec - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::nav2_costmap_2d_client - ${PROJECT_NAME}::layers + nav2_costmap_2d_core + nav2_costmap_2d_client + layers ) ament_add_test(test_collision_checker @@ -124,6 +124,6 @@ ament_add_test(test_costmap_publisher_exec # ${dependencies} # ) # target_link_libraries(costmap_tester -# ${PROJECT_NAME}::nav2_costmap_2d_core +# nav2_costmap_2d_core # layers # ) diff --git a/nav2_costmap_2d/test/regression/CMakeLists.txt b/nav2_costmap_2d/test/regression/CMakeLists.txt index ab9f01ee4a..dafa695699 100644 --- a/nav2_costmap_2d/test/regression/CMakeLists.txt +++ b/nav2_costmap_2d/test/regression/CMakeLists.txt @@ -1,18 +1,17 @@ # Bresenham2D corner cases test ament_add_gtest(costmap_bresenham_2d costmap_bresenham_2d.cpp) target_link_libraries(costmap_bresenham_2d - ${PROJECT_NAME}::nav2_costmap_2d_core + nav2_costmap_2d_core ) # OrderLayer for checking Costmap2D plugins API calling order add_library(order_layer SHARED order_layer.cpp) -ament_target_dependencies(order_layer - ${dependencies} +target_link_libraries(order_layer PUBLIC + nav2_costmap_2d_core ) - -target_link_libraries(order_layer - ${PROJECT_NAME}::nav2_costmap_2d_core +target_link_libraries(order_layer PRIVATE + pluginlib::pluginlib ) install(TARGETS order_layer @@ -24,5 +23,5 @@ install(TARGETS # Costmap2D plugins API calling order test ament_add_gtest(plugin_api_order plugin_api_order.cpp) target_link_libraries(plugin_api_order - ${PROJECT_NAME}::nav2_costmap_2d_core + nav2_costmap_2d_core ) diff --git a/nav2_costmap_2d/test/unit/CMakeLists.txt b/nav2_costmap_2d/test/unit/CMakeLists.txt index a4148ad7d2..06bffed46b 100644 --- a/nav2_costmap_2d/test/unit/CMakeLists.txt +++ b/nav2_costmap_2d/test/unit/CMakeLists.txt @@ -5,59 +5,59 @@ target_link_libraries(array_parser_test ament_add_gtest(collision_footprint_test footprint_collision_checker_test.cpp) target_link_libraries(collision_footprint_test - ${PROJECT_NAME}::nav2_costmap_2d_core + nav2_costmap_2d_core ) ament_add_gtest(costmap_convesion_test costmap_conversion_test.cpp) target_link_libraries(costmap_convesion_test - ${PROJECT_NAME}::nav2_costmap_2d_core + nav2_costmap_2d_core ) ament_add_gtest(declare_parameter_test declare_parameter_test.cpp) target_link_libraries(declare_parameter_test - ${PROJECT_NAME}::nav2_costmap_2d_core + nav2_costmap_2d_core ) ament_add_gtest(costmap_filter_test costmap_filter_test.cpp) target_link_libraries(costmap_filter_test - ${PROJECT_NAME}::nav2_costmap_2d_core + nav2_costmap_2d_core ) ament_add_gtest(keepout_filter_test keepout_filter_test.cpp) target_link_libraries(keepout_filter_test - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::filters + nav2_costmap_2d_core + filters ) ament_add_gtest(speed_filter_test speed_filter_test.cpp) target_link_libraries(speed_filter_test - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::filters + nav2_costmap_2d_core + filters ) ament_add_gtest(binary_filter_test binary_filter_test.cpp) target_link_libraries(binary_filter_test - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::filters + nav2_costmap_2d_core + filters ) ament_add_gtest(copy_window_test copy_window_test.cpp) target_link_libraries(copy_window_test - ${PROJECT_NAME}::nav2_costmap_2d_core + nav2_costmap_2d_core ) ament_add_gtest(costmap_filter_service_test costmap_filter_service_test.cpp) target_link_libraries(costmap_filter_service_test - ${PROJECT_NAME}::nav2_costmap_2d_core + nav2_costmap_2d_core ) ament_add_gtest(denoise_layer_test denoise_layer_test.cpp image_test.cpp image_processing_test.cpp) target_link_libraries(denoise_layer_test - ${PROJECT_NAME}::nav2_costmap_2d_core - ${PROJECT_NAME}::layers + nav2_costmap_2d_core + layers ) ament_add_gtest(lifecycle_test lifecycle_test.cpp) target_link_libraries(lifecycle_test - ${PROJECT_NAME}::nav2_costmap_2d_core -) \ No newline at end of file + nav2_costmap_2d_core +) diff --git a/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt b/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt index 9d45a06ab8..31dc373e8e 100644 --- a/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt +++ b/nav2_dwb_controller/nav_2d_utils/CMakeLists.txt @@ -28,41 +28,64 @@ set(dependencies 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 + ${tf2_geometry_msgs_TARGETS} + nav2_util::nav2_util_core ) 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 + tf2_ros::tf2_ros + ${geometry_msgs_TARGETS} + rclcpp::rclcpp + ${nav_2d_msgs_TARGETS} + tf2::tf2 + ${tf2_geometry_msgs_TARGETS} + conversions ) - -target_link_libraries(tf_help conversions) - install(TARGETS conversions path_ops tf_help + 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 +95,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_targets(${PROJECT_NAME}) ament_package() 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) - diff --git a/nav2_lifecycle_manager/CMakeLists.txt b/nav2_lifecycle_manager/CMakeLists.txt index 5f4b3f3c23..b7dec68f61 100644 --- a/nav2_lifecycle_manager/CMakeLists.txt +++ b/nav2_lifecycle_manager/CMakeLists.txt @@ -19,53 +19,47 @@ find_package(diagnostic_updater REQUIRED) nav2_package() -include_directories( - include -) - set(library_name ${PROJECT_NAME}_core) add_library(${library_name} SHARED src/lifecycle_manager.cpp src/lifecycle_manager_client.cpp ) - -set(dependencies - geometry_msgs - lifecycle_msgs - nav2_msgs - nav2_util - rclcpp - rclcpp_action - rclcpp_lifecycle - rclcpp_components - std_msgs - std_srvs - tf2_geometry_msgs - bondcpp - diagnostic_updater +target_include_directories(${library_name} + PUBLIC + "$" + "$" ) - -ament_target_dependencies(${library_name} - ${dependencies} +target_link_libraries(${library_name} PUBLIC + nav2_util::nav2_util_core + bondcpp::bondcpp + rclcpp::rclcpp + ${std_srvs_TARGETS} + diagnostic_updater::diagnostic_updater +) +target_link_libraries(${library_name} PRIVATE + ${lifecycle_msgs_TARGETS} + ${diagnostic_msgs_TARGETS} + rclcpp_components::component ) add_executable(lifecycle_manager src/main.cpp ) - -target_link_libraries(lifecycle_manager - ${library_name} +target_include_directories(lifecycle_manager + PUBLIC + "$" + "$" ) - -ament_target_dependencies(lifecycle_manager - ${dependencies} +target_link_libraries(lifecycle_manager PRIVATE + ${library_name} + rclcpp::rclcpp ) rclcpp_components_register_nodes(${library_name} "nav2_lifecycle_manager::LifecycleManager") -install(TARGETS - ${library_name} +install(TARGETS ${library_name} + EXPORT ${library_name} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin @@ -76,7 +70,7 @@ install(TARGETS RUNTIME DESTINATION lib/${PROJECT_NAME} ) -install(DIRECTORY include/ DESTINATION include/) +install(DIRECTORY include/ DESTINATION include/${PROJECT_NAME}) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) @@ -85,11 +79,14 @@ if(BUILD_TESTING) find_package(ament_cmake_gtest REQUIRED) find_package(ament_cmake_pytest REQUIRED) + ament_find_gtest() + add_subdirectory(test) endif() ament_export_include_directories(include) ament_export_libraries(${library_name}) -ament_export_dependencies(${dependencies}) +ament_export_dependencies(nav2_util bondcpp rclcpp std_srvs diagnostic_updater) +ament_export_targets(${library_name}) ament_package() diff --git a/nav2_lifecycle_manager/src/lifecycle_manager_client.cpp b/nav2_lifecycle_manager/src/lifecycle_manager_client.cpp index 632eb1aa8e..7fb03c9cc5 100644 --- a/nav2_lifecycle_manager/src/lifecycle_manager_client.cpp +++ b/nav2_lifecycle_manager/src/lifecycle_manager_client.cpp @@ -19,7 +19,6 @@ #include #include -#include "tf2_geometry_msgs/tf2_geometry_msgs.hpp" #include "nav2_util/geometry_utils.hpp" namespace nav2_lifecycle_manager diff --git a/nav2_lifecycle_manager/test/CMakeLists.txt b/nav2_lifecycle_manager/test/CMakeLists.txt index 96cbaa5f7a..a471ef33ff 100644 --- a/nav2_lifecycle_manager/test/CMakeLists.txt +++ b/nav2_lifecycle_manager/test/CMakeLists.txt @@ -1,13 +1,11 @@ ament_add_gtest_executable(test_lifecycle_gtest test_lifecycle_manager.cpp ) - target_link_libraries(test_lifecycle_gtest ${library_name} -) - -ament_target_dependencies(test_lifecycle_gtest - ${dependencies} + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + nav2_util::nav2_util_core ) ament_add_test(test_lifecycle @@ -22,13 +20,10 @@ ament_add_test(test_lifecycle ament_add_gtest_executable(test_bond_gtest test_bond.cpp ) - target_link_libraries(test_bond_gtest ${library_name} -) - -ament_target_dependencies(test_bond_gtest - ${dependencies} + rclcpp::rclcpp + nav2_util::nav2_util_core ) ament_add_test(test_bond diff --git a/nav2_map_server/CMakeLists.txt b/nav2_map_server/CMakeLists.txt index 0a43c13696..8bafe0919c 100644 --- a/nav2_map_server/CMakeLists.txt +++ b/nav2_map_server/CMakeLists.txt @@ -14,123 +14,141 @@ find_package(yaml_cpp_vendor REQUIRED) find_package(std_msgs REQUIRED) find_package(tf2 REQUIRED) find_package(nav2_util REQUIRED) +find_package(lifecycle_msgs REQUIRED) find_package(GRAPHICSMAGICKCPP REQUIRED) nav2_package() -include_directories(include) - set(map_server_executable map_server) +set(library_name ${map_server_executable}_core) + +set(map_io_library_name map_io) + set(map_saver_cli_executable map_saver_cli) set(map_saver_server_executable map_saver_server) set(costmap_filter_info_server_executable costmap_filter_info_server) -add_executable(${map_server_executable} - src/map_server/main.cpp) - -add_executable(${map_saver_cli_executable} - src/map_saver/main_cli.cpp) - -add_executable(${map_saver_server_executable} - src/map_saver/main_server.cpp) - -add_executable(${costmap_filter_info_server_executable} - src/costmap_filter_info/main.cpp) - -set(map_io_library_name map_io) - -set(library_name ${map_server_executable}_core) - -add_library(${map_io_library_name} SHARED - src/map_mode.cpp - src/map_io.cpp) - add_library(${library_name} SHARED src/map_server/map_server.cpp src/map_saver/map_saver.cpp src/costmap_filter_info/costmap_filter_info_server.cpp) +target_include_directories(${library_name} + PUBLIC + "$" + "$") +target_link_libraries(${library_name} PUBLIC + nav2_util::nav2_util_core + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${nav2_msgs_TARGETS} + ${nav_msgs_TARGETS} +) +target_link_libraries(${library_name} PRIVATE + ${lifecycle_msgs_TARGETS} + rclcpp_components::component + yaml-cpp +) -set(map_io_dependencies - yaml_cpp_vendor - nav_msgs - nav2_util - tf2) - -set(map_server_dependencies - rclcpp - rclcpp_lifecycle - rclcpp_components - nav_msgs - nav2_msgs - yaml_cpp_vendor - std_msgs - nav2_util) - -set(map_saver_dependencies - rclcpp - rclcpp_lifecycle - nav_msgs - nav2_msgs - nav2_util) - -ament_target_dependencies(${map_server_executable} - ${map_server_dependencies}) - -ament_target_dependencies(${map_saver_cli_executable} - ${map_saver_dependencies}) - -ament_target_dependencies(${map_saver_server_executable} - ${map_saver_dependencies}) - -ament_target_dependencies(${costmap_filter_info_server_executable} - ${map_saver_dependencies}) - -ament_target_dependencies(${library_name} - ${map_server_dependencies}) - -ament_target_dependencies(${map_io_library_name} - ${map_io_dependencies}) - -target_link_libraries(${library_name} - ${map_io_library_name}) - -target_link_libraries(${map_server_executable} - ${library_name}) +add_library(${map_io_library_name} SHARED + src/map_mode.cpp + src/map_io.cpp) +target_include_directories(${map_io_library_name} + PUBLIC + "$" + "$") +target_link_libraries(${map_io_library_name} PUBLIC + nav2_util::nav2_util_core + ${nav_msgs_TARGETS} +) +target_link_libraries(${map_io_library_name} PRIVATE + tf2::tf2 + yaml-cpp + ${GRAPHICSMAGICKCPP_LIBRARIES} +) +if(WIN32) + target_compile_definitions(${map_io_library_name} PRIVATE + YAML_CPP_DLL) +endif() +add_executable(${map_server_executable} + src/map_server/main.cpp) +target_include_directories(${map_server_executable} + PRIVATE + "$" + "$") +target_link_libraries(${map_server_executable} PRIVATE + rclcpp::rclcpp + ${library_name} + ${map_io_library_name} +) if(WIN32) target_compile_definitions(${map_server_executable} PRIVATE YAML_CPP_DLL) endif() -target_link_libraries(${map_saver_cli_executable} - ${library_name}) - -target_link_libraries(${map_saver_server_executable} - ${library_name}) - -target_link_libraries(${costmap_filter_info_server_executable} - ${library_name}) - -target_include_directories(${map_io_library_name} SYSTEM PRIVATE - ${GRAPHICSMAGICKCPP_INCLUDE_DIRS}) +add_executable(${map_saver_cli_executable} + src/map_saver/main_cli.cpp) +target_include_directories(${map_saver_cli_executable} + PRIVATE + "$" + "$") +target_link_libraries(${map_saver_cli_executable} PRIVATE + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${nav_msgs_TARGETS} + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + ${library_name} + ${map_io_library_name} +) -target_link_libraries(${map_io_library_name} - ${GRAPHICSMAGICKCPP_LIBRARIES}) +add_executable(${map_saver_server_executable} + src/map_saver/main_server.cpp) +target_include_directories(${map_saver_server_executable} + PRIVATE + "$" + "$") +target_link_libraries(${map_saver_server_executable} PRIVATE + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${nav_msgs_TARGETS} + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + ${library_name} + ${map_io_library_name} +) -if(WIN32) - target_compile_definitions(${map_io_library_name} PRIVATE - YAML_CPP_DLL) -endif() +add_executable(${costmap_filter_info_server_executable} + src/costmap_filter_info/main.cpp) +target_include_directories(${costmap_filter_info_server_executable} + PRIVATE + "$" + "$") +target_link_libraries(${costmap_filter_info_server_executable} PRIVATE + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + ${nav_msgs_TARGETS} + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + ${library_name} + ${map_io_library_name} +) rclcpp_components_register_nodes(${library_name} "nav2_map_server::CostmapFilterInfoServer") rclcpp_components_register_nodes(${library_name} "nav2_map_server::MapSaver") rclcpp_components_register_nodes(${library_name} "nav2_map_server::MapServer") -install(TARGETS - ${library_name} ${map_io_library_name} +install(TARGETS ${library_name} + EXPORT ${library_name} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) + +install(TARGETS ${map_io_library_name} + EXPORT ${map_io_library_name} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin) @@ -141,7 +159,7 @@ install(TARGETS RUNTIME DESTINATION lib/${PROJECT_NAME}) install(DIRECTORY include/ - DESTINATION include/) + DESTINATION include/${PROJECT_NAME}) install(DIRECTORY launch DESTINATION share/${PROJECT_NAME}) @@ -160,5 +178,6 @@ ament_export_libraries( ${library_name} ${map_io_library_name} ) -ament_export_dependencies(${map_io_dependencies} ${map_server_dependencies}) +ament_export_dependencies(nav2_util rclcpp rclcpp_lifecycle nav2_msgs nav_msgs) +ament_export_targets(${library_name} ${map_io_library_name}) ament_package() diff --git a/nav2_map_server/include/nav2_map_server/map_saver.hpp b/nav2_map_server/include/nav2_map_server/map_saver.hpp index bfeb986c62..8f2ad85c24 100644 --- a/nav2_map_server/include/nav2_map_server/map_saver.hpp +++ b/nav2_map_server/include/nav2_map_server/map_saver.hpp @@ -20,6 +20,7 @@ #include #include "rclcpp/rclcpp.hpp" +#include "rclcpp_lifecycle/state.hpp" #include "nav2_util/lifecycle_node.hpp" #include "nav2_msgs/srv/save_map.hpp" diff --git a/nav2_map_server/package.xml b/nav2_map_server/package.xml index 24f5315d0c..0f9881204d 100644 --- a/nav2_map_server/package.xml +++ b/nav2_map_server/package.xml @@ -25,6 +25,7 @@ nav2_msgs nav2_util graphicsmagick + lifecycle_msgs ament_lint_common ament_lint_auto diff --git a/nav2_map_server/test/component/CMakeLists.txt b/nav2_map_server/test/component/CMakeLists.txt index a394a5201e..b19c182dce 100644 --- a/nav2_map_server/test/component/CMakeLists.txt +++ b/nav2_map_server/test/component/CMakeLists.txt @@ -1,15 +1,17 @@ -include_directories(${PROJECT_SOURCE_DIR}/test) - # map_server component test ament_add_gtest_executable(test_map_server_node test_map_server_node.cpp ${PROJECT_SOURCE_DIR}/test/test_constants.cpp ) -ament_target_dependencies(test_map_server_node rclcpp nav_msgs) target_link_libraries(test_map_server_node + rclcpp::rclcpp + ${nav_msgs_TARGETS} ${library_name} stdc++fs ) +target_include_directories(test_map_server_node + PRIVATE + "$") ament_add_test(test_map_server_node GENERATE_RESULT_FOR_RETURN_CODE_ZERO @@ -26,22 +28,28 @@ ament_add_gtest_executable(test_map_saver_node test_map_saver_node.cpp ${PROJECT_SOURCE_DIR}/test/test_constants.cpp ) - -ament_target_dependencies(test_map_saver_node rclcpp nav_msgs) target_link_libraries(test_map_saver_node + rclcpp::rclcpp + ${nav_msgs_TARGETS} ${library_name} stdc++fs + ${map_io_library_name} ) +target_include_directories(test_map_saver_node + PRIVATE + "$") add_executable(test_map_saver_publisher test_map_saver_publisher.cpp ${PROJECT_SOURCE_DIR}/test/test_constants.cpp ) - target_link_libraries(test_map_saver_publisher ${map_io_library_name} stdc++fs ) +target_include_directories(test_map_saver_publisher + PRIVATE + "$") ament_add_test(test_map_saver_node GENERATE_RESULT_FOR_RETURN_CODE_ZERO diff --git a/nav2_map_server/test/map_saver_cli/CMakeLists.txt b/nav2_map_server/test/map_saver_cli/CMakeLists.txt index f7e3b52950..55c652b0db 100644 --- a/nav2_map_server/test/map_saver_cli/CMakeLists.txt +++ b/nav2_map_server/test/map_saver_cli/CMakeLists.txt @@ -1,13 +1,10 @@ -include_directories(${PROJECT_SOURCE_DIR}/test) - # map_saver CLI ament_add_gtest(test_map_saver_cli test_map_saver_cli.cpp ${PROJECT_SOURCE_DIR}/test/test_constants.cpp ) - -ament_target_dependencies(test_map_saver_cli rclcpp nav_msgs) target_link_libraries(test_map_saver_cli + rclcpp::rclcpp + ${nav_msgs_TARGETS} stdc++fs - ${dependencies} ) diff --git a/nav2_map_server/test/unit/CMakeLists.txt b/nav2_map_server/test/unit/CMakeLists.txt index 095a6509ae..9d466517e8 100644 --- a/nav2_map_server/test/unit/CMakeLists.txt +++ b/nav2_map_server/test/unit/CMakeLists.txt @@ -1,22 +1,12 @@ -include_directories(${PROJECT_SOURCE_DIR}/test) - # map_io unit test ament_add_gtest(test_map_io test_map_io.cpp ${PROJECT_SOURCE_DIR}/test/test_constants.cpp) - -ament_target_dependencies(test_map_io rclcpp nav_msgs) - -target_link_libraries(test_map_io - ${map_io_library_name} - stdc++fs -) +target_link_libraries(test_map_io rclcpp::rclcpp ${nav_msgs_TARGETS} ${map_io_library_name} stdc++fs) +target_include_directories(test_map_io + PRIVATE + "$") # costmap_filter_info_server unit test ament_add_gtest(test_costmap_filter_info_server test_costmap_filter_info_server.cpp ) - -ament_target_dependencies(test_costmap_filter_info_server rclcpp) - -target_link_libraries(test_costmap_filter_info_server - ${library_name} -) +target_link_libraries(test_costmap_filter_info_server rclcpp::rclcpp ${library_name} ${map_io_library_name}) diff --git a/nav2_mppi_controller/CMakeLists.txt b/nav2_mppi_controller/CMakeLists.txt index d2bb6d9c9d..63e6444907 100644 --- a/nav2_mppi_controller/CMakeLists.txt +++ b/nav2_mppi_controller/CMakeLists.txt @@ -8,36 +8,24 @@ set(XTENSOR_USE_TBB 0) set(XTENSOR_USE_OPENMP 0) set(XTENSOR_USE_XSIMD 1) -# set(XTENSOR_DEFAULT_LAYOUT column_major) # row_major, column_major -# set(XTENSOR_DEFAULT_TRAVERSAL row_major) # row_major, column_major - find_package(ament_cmake REQUIRED) find_package(xtensor REQUIRED) find_package(xsimd REQUIRED) - -include_directories( - include -) - -set(dependencies_pkgs - rclcpp - nav2_common - pluginlib - tf2 - geometry_msgs - visualization_msgs - nav_msgs - nav2_core - nav2_costmap_2d - nav2_util - tf2_geometry_msgs - tf2_eigen - tf2_ros -) - -foreach(pkg IN LISTS dependencies_pkgs) - find_package(${pkg} REQUIRED) -endforeach() +find_package(rclcpp REQUIRED) +find_package(nav2_common REQUIRED) +find_package(pluginlib REQUIRED) +find_package(tf2 REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(visualization_msgs REQUIRED) +find_package(nav_msgs REQUIRED) +find_package(nav2_core REQUIRED) +find_package(nav2_costmap_2d REQUIRED) +find_package(nav2_util REQUIRED) +find_package(tf2_geometry_msgs REQUIRED) +find_package(tf2_eigen REQUIRED) +find_package(tf2_ros REQUIRED) +find_package(angles REQUIRED) +find_package(std_msgs REQUIRED) nav2_package() @@ -95,19 +83,21 @@ set(libraries mppi_controller mppi_critics) foreach(lib IN LISTS libraries) target_compile_options(${lib} PUBLIC -fconcepts) - target_include_directories(${lib} PUBLIC ${xsimd_INCLUDE_DIRS}) # ${OpenMP_INCLUDE_DIRS} - target_link_libraries(${lib} xtensor xtensor::optimize xtensor::use_xsimd) - ament_target_dependencies(${lib} ${dependencies_pkgs}) + target_include_directories(${lib} PUBLIC ${xsimd_INCLUDE_DIRS} + "$" + "$") + target_link_libraries(${lib} PUBLIC xtensor xtensor::optimize xtensor::use_xsimd rclcpp_lifecycle::rclcpp_lifecycle nav2_costmap_2d::nav2_costmap_2d_core tf2_ros::tf2_ros ${geometry_msgs_TARGETS} ${nav_msgs_TARGETS} pluginlib::pluginlib nav2_core::nav2_core angles::angles ${visualization_msgs_TARGETS} ${std_msgs_TARGETS} nav2_costmap_2d::layers) endforeach() install(TARGETS mppi_controller mppi_critics + EXPORT nav2_mppi_controller ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -115,13 +105,18 @@ if(BUILD_TESTING) find_package(ament_cmake_gtest REQUIRED) set(ament_cmake_copyright_FOUND TRUE) ament_lint_auto_find_test_dependencies() + + ament_find_gtest() + add_subdirectory(test) # add_subdirectory(benchmark) endif() ament_export_libraries(${libraries}) ament_export_dependencies(${dependencies_pkgs}) -ament_export_include_directories(include) +ament_export_include_directories(include/${PROJECT_NAME}) +ament_export_targets(nav2_mppi_controller) + pluginlib_export_plugin_description_file(nav2_core mppic.xml) pluginlib_export_plugin_description_file(nav2_mppi_controller critics.xml) diff --git a/nav2_mppi_controller/package.xml b/nav2_mppi_controller/package.xml index dd6142c52f..4170ef25f5 100644 --- a/nav2_mppi_controller/package.xml +++ b/nav2_mppi_controller/package.xml @@ -29,6 +29,7 @@ libomp-dev benchmark xsimd + angles ament_lint_auto ament_lint_common diff --git a/nav2_mppi_controller/test/CMakeLists.txt b/nav2_mppi_controller/test/CMakeLists.txt index 6305d4e31a..9fb93d2c01 100644 --- a/nav2_mppi_controller/test/CMakeLists.txt +++ b/nav2_mppi_controller/test/CMakeLists.txt @@ -16,13 +16,15 @@ foreach(name IN LISTS TEST_NAMES) ament_add_gtest(${name} ${name}.cpp ) - - ament_target_dependencies(${name} - ${dependencies_pkgs} - ) - target_link_libraries(${name} mppi_controller + ${geometry_msgs_TARGETS} + ${nav_msgs_TARGETS} + nav2_costmap_2d::nav2_costmap_2d_core + xtensor + xtensor::optimize + xtensor::use_xsimd + nav2_core::nav2_core ) if(${TEST_DEBUG_INFO}) @@ -33,8 +35,8 @@ endforeach() # This is a special case requiring linking against the critics library ament_add_gtest(critics_tests critics_tests.cpp) -ament_target_dependencies(critics_tests ${dependencies_pkgs}) -target_link_libraries(critics_tests mppi_controller mppi_critics) +target_link_libraries(critics_tests mppi_controller mppi_critics rclcpp::rclcpp rclcpp_lifecycle::rclcpp_lifecycle nav2_costmap_2d::nav2_costmap_2d_core xtensor xtensor::optimize xtensor::use_xsimd +) if(${TEST_DEBUG_INFO}) target_compile_definitions(critics_tests PUBLIC -DTEST_DEBUG_INFO) endif() diff --git a/nav2_navfn_planner/CMakeLists.txt b/nav2_navfn_planner/CMakeLists.txt index 624c5168e3..d5c30784a2 100644 --- a/nav2_navfn_planner/CMakeLists.txt +++ b/nav2_navfn_planner/CMakeLists.txt @@ -20,10 +20,6 @@ find_package(pluginlib REQUIRED) nav2_package() -include_directories( - include -) - set(library_name nav2_navfn_planner) set(dependencies @@ -47,21 +43,37 @@ add_library(${library_name} SHARED src/navfn_planner.cpp src/navfn.cpp ) - -ament_target_dependencies(${library_name} - ${dependencies} +target_include_directories(${library_name} + PUBLIC + "$" + "$" +) +target_link_libraries(${library_name} PUBLIC + ${geometry_msgs_TARGETS} + nav2_core::nav2_core + ${nav_msgs_TARGETS} + nav2_util::nav2_util_core + nav2_costmap_2d::nav2_costmap_2d_core + ${rcl_interfaces_TARGETS} + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle +) +target_link_libraries(${library_name} PRIVATE + ${builtin_interfaces_TARGETS} + pluginlib::pluginlib ) pluginlib_export_plugin_description_file(nav2_core global_planner_plugin.xml) 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} ) install(FILES global_planner_plugin.xml @@ -72,10 +84,13 @@ if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_gtest 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}) ament_export_dependencies(${dependencies}) +ament_export_targets(${library_name}) ament_package() diff --git a/nav2_navfn_planner/test/CMakeLists.txt b/nav2_navfn_planner/test/CMakeLists.txt index d415d906ef..39b2fb06a4 100644 --- a/nav2_navfn_planner/test/CMakeLists.txt +++ b/nav2_navfn_planner/test/CMakeLists.txt @@ -2,9 +2,10 @@ ament_add_gtest(test_dynamic_parameters test_dynamic_parameters.cpp ) -ament_target_dependencies(test_dynamic_parameters - ${dependencies} -) target_link_libraries(test_dynamic_parameters ${library_name} + nav2_util::nav2_util_core + rclcpp::rclcpp + nav2_costmap_2d::nav2_costmap_2d_core + rclcpp_lifecycle::rclcpp_lifecycle ) diff --git a/nav2_planner/CMakeLists.txt b/nav2_planner/CMakeLists.txt index 197150837c..5ab32356b3 100644 --- a/nav2_planner/CMakeLists.txt +++ b/nav2_planner/CMakeLists.txt @@ -8,12 +8,10 @@ find_package(rclcpp_action REQUIRED) find_package(rclcpp_lifecycle REQUIRED) find_package(rclcpp_components REQUIRED) find_package(std_msgs REQUIRED) -find_package(visualization_msgs REQUIRED) find_package(nav2_util REQUIRED) find_package(nav2_msgs REQUIRED) find_package(nav_msgs REQUIRED) find_package(geometry_msgs REQUIRED) -find_package(builtin_interfaces REQUIRED) find_package(tf2_ros REQUIRED) find_package(nav2_costmap_2d REQUIRED) find_package(pluginlib REQUIRED) @@ -21,52 +19,44 @@ find_package(nav2_core REQUIRED) nav2_package() -include_directories( - include -) - set(executable_name planner_server) set(library_name ${executable_name}_core) -set(dependencies - rclcpp - rclcpp_action - rclcpp_lifecycle - rclcpp_components - std_msgs - visualization_msgs - nav2_util - nav2_msgs - nav_msgs - geometry_msgs - builtin_interfaces - tf2_ros - nav2_costmap_2d - pluginlib - nav2_core -) - add_library(${library_name} SHARED src/planner_server.cpp ) - -ament_target_dependencies(${library_name} - ${dependencies} +target_include_directories(${library_name} + PUBLIC + "$" + "$" +) +target_link_libraries(${library_name} PUBLIC + ${geometry_msgs_TARGETS} + ${nav_msgs_TARGETS} + nav2_util::nav2_util_core + ${nav2_msgs_TARGETS} + tf2_ros::tf2_ros + nav2_costmap_2d::nav2_costmap_2d_core + pluginlib::pluginlib + nav2_core::nav2_core + rclcpp::rclcpp + ${rcl_interfaces_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle +) +target_link_libraries(${library_name} PRIVATE + ${lifecycle_msgs_TARGETS} + rclcpp_components::component ) add_executable(${executable_name} src/main.cpp ) - -target_link_libraries(${executable_name} ${library_name}) - -ament_target_dependencies(${executable_name} - ${dependencies} -) +target_link_libraries(${executable_name} PRIVATE ${library_name} rclcpp::rclcpp) rclcpp_components_register_nodes(${library_name} "nav2_planner::PlannerServer") install(TARGETS ${library_name} + EXPORT ${library_name} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin @@ -77,17 +67,20 @@ install(TARGETS ${executable_name} ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) find_package(ament_lint_auto REQUIRED) find_package(ament_cmake_gtest 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}) ament_export_dependencies(${dependencies}) +ament_export_targets(${library_name}) ament_package() diff --git a/nav2_planner/include/nav2_planner/planner_server.hpp b/nav2_planner/include/nav2_planner/planner_server.hpp index 3c21b9a4a3..ea43a787f8 100644 --- a/nav2_planner/include/nav2_planner/planner_server.hpp +++ b/nav2_planner/include/nav2_planner/planner_server.hpp @@ -31,7 +31,6 @@ #include "nav2_msgs/msg/costmap.hpp" #include "nav2_util/robot_utils.hpp" #include "nav2_util/simple_action_server.hpp" -#include "visualization_msgs/msg/marker.hpp" #include "tf2_ros/transform_listener.h" #include "tf2_ros/create_timer_ros.h" #include "nav2_costmap_2d/costmap_2d_ros.hpp" diff --git a/nav2_planner/package.xml b/nav2_planner/package.xml index 58b8343666..78eff64e32 100644 --- a/nav2_planner/package.xml +++ b/nav2_planner/package.xml @@ -12,12 +12,10 @@ rclcpp rclcpp_action rclcpp_lifecycle - visualization_msgs nav2_util nav2_msgs nav_msgs geometry_msgs - builtin_interfaces nav2_common tf2_ros nav2_costmap_2d diff --git a/nav2_planner/src/planner_server.cpp b/nav2_planner/src/planner_server.cpp index 1278656cf3..cfee663e10 100644 --- a/nav2_planner/src/planner_server.cpp +++ b/nav2_planner/src/planner_server.cpp @@ -24,7 +24,6 @@ #include #include -#include "builtin_interfaces/msg/duration.hpp" #include "lifecycle_msgs/msg/state.hpp" #include "nav2_util/costmap.hpp" #include "nav2_util/node_utils.hpp" diff --git a/nav2_planner/test/CMakeLists.txt b/nav2_planner/test/CMakeLists.txt index d415d906ef..a551d1208f 100644 --- a/nav2_planner/test/CMakeLists.txt +++ b/nav2_planner/test/CMakeLists.txt @@ -2,9 +2,9 @@ ament_add_gtest(test_dynamic_parameters test_dynamic_parameters.cpp ) -ament_target_dependencies(test_dynamic_parameters - ${dependencies} -) target_link_libraries(test_dynamic_parameters ${library_name} + nav2_util::nav2_util_core + rclcpp::rclcpp + ${rcl_interfaces_TARGETS} ) diff --git a/nav2_regulated_pure_pursuit_controller/CMakeLists.txt b/nav2_regulated_pure_pursuit_controller/CMakeLists.txt index 6f84b05382..189f32d4fd 100644 --- a/nav2_regulated_pure_pursuit_controller/CMakeLists.txt +++ b/nav2_regulated_pure_pursuit_controller/CMakeLists.txt @@ -14,11 +14,6 @@ find_package(tf2 REQUIRED) find_package(tf2_geometry_msgs REQUIRED) nav2_package() -set(CMAKE_CXX_STANDARD 17) - -include_directories( - include -) set(dependencies rclcpp @@ -35,23 +30,37 @@ set(dependencies set(library_name nav2_regulated_pure_pursuit_controller) add_library(${library_name} SHARED - src/regulated_pure_pursuit_controller.cpp - src/collision_checker.cpp - src/parameter_handler.cpp - src/path_handler.cpp) - -ament_target_dependencies(${library_name} - ${dependencies} + src/regulated_pure_pursuit_controller.cpp + src/collision_checker.cpp + src/parameter_handler.cpp + src/path_handler.cpp) +target_include_directories(${library_name} + PUBLIC + "$" + "$" +) +target_link_libraries(${library_name} PUBLIC + rclcpp_lifecycle::rclcpp_lifecycle + rclcpp::rclcpp + nav2_costmap_2d::nav2_costmap_2d_core + ${geometry_msgs_TARGETS} + pluginlib::pluginlib + nav2_core::nav2_core + nav2_util::nav2_util_core + tf2_ros::tf2_ros + ${nav_msgs_TARGETS} + ${rcl_interfaces_TARGETS} ) 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) @@ -59,14 +68,16 @@ if(BUILD_TESTING) # 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_targets(${library_name}) pluginlib_export_plugin_description_file(nav2_core nav2_regulated_pure_pursuit_controller.xml) ament_package() - diff --git a/nav2_regulated_pure_pursuit_controller/test/CMakeLists.txt b/nav2_regulated_pure_pursuit_controller/test/CMakeLists.txt index 3e8d4c5b0a..bcbe50364c 100644 --- a/nav2_regulated_pure_pursuit_controller/test/CMakeLists.txt +++ b/nav2_regulated_pure_pursuit_controller/test/CMakeLists.txt @@ -3,13 +3,17 @@ ament_add_gtest(test_regulated_pp test_regulated_pp.cpp path_utils/path_utils.cpp ) -ament_target_dependencies(test_regulated_pp - ${dependencies} -) target_link_libraries(test_regulated_pp ${library_name} + rclcpp::rclcpp + nav2_costmap_2d::nav2_costmap_2d_core + nav2_util::nav2_util_core + nav2_core::nav2_core + ${geometry_msgs_TARGETS} + ${nav_msgs_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle ) # Path utils test ament_add_gtest(test_path_utils path_utils/test_path_utils.cpp path_utils/path_utils.cpp) -ament_target_dependencies(test_path_utils nav_msgs geometry_msgs tf2_geometry_msgs) +target_link_libraries(test_path_utils ${nav_msgs_TARGETS} ${geometry_msgs_TARGETS} tf2::tf2 tf2_geometry_msgs::tf2_geometry_msgs) diff --git a/nav2_rotation_shim_controller/CMakeLists.txt b/nav2_rotation_shim_controller/CMakeLists.txt index 2e141d5f44..f37db79edf 100644 --- a/nav2_rotation_shim_controller/CMakeLists.txt +++ b/nav2_rotation_shim_controller/CMakeLists.txt @@ -14,11 +14,6 @@ find_package(tf2 REQUIRED) find_package(angles REQUIRED) nav2_package() -set(CMAKE_CXX_STANDARD 17) - -include_directories( - include -) set(dependencies rclcpp @@ -29,26 +24,43 @@ set(dependencies nav2_util nav2_core tf2 - angles + tf2_ros + rclcpp_lifecycle ) 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 + "$" + "$" +) +target_link_libraries(${library_name} PUBLIC + rclcpp::rclcpp + pluginlib::pluginlib + nav2_util::nav2_util_core + nav2_core::nav2_core + nav2_costmap_2d::nav2_costmap_2d_core + rclcpp_lifecycle::rclcpp_lifecycle + ${rcl_interfaces_TARGETS} + tf2_ros::tf2_ros + ${geometry_msgs_TARGETS} +) +target_link_libraries(${library_name} PRIVATE + angles::angles ) 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) @@ -56,12 +68,15 @@ if(BUILD_TESTING) # 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_targets(${library_name}) pluginlib_export_plugin_description_file(nav2_core nav2_rotation_shim_controller.xml) diff --git a/nav2_rotation_shim_controller/include/nav2_rotation_shim_controller/nav2_rotation_shim_controller.hpp b/nav2_rotation_shim_controller/include/nav2_rotation_shim_controller/nav2_rotation_shim_controller.hpp index c3812ec1d3..dad5ca2a5b 100644 --- a/nav2_rotation_shim_controller/include/nav2_rotation_shim_controller/nav2_rotation_shim_controller.hpp +++ b/nav2_rotation_shim_controller/include/nav2_rotation_shim_controller/nav2_rotation_shim_controller.hpp @@ -30,7 +30,6 @@ #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 { diff --git a/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp b/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp index afd3238145..0f986374bf 100644 --- a/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp +++ b/nav2_rotation_shim_controller/src/nav2_rotation_shim_controller.cpp @@ -18,6 +18,7 @@ #include #include +#include "angles/angles.h" #include "nav2_rotation_shim_controller/nav2_rotation_shim_controller.hpp" using rcl_interfaces::msg::ParameterType; diff --git a/nav2_rotation_shim_controller/test/CMakeLists.txt b/nav2_rotation_shim_controller/test/CMakeLists.txt index ae3161d1a7..eb550c0d7c 100644 --- a/nav2_rotation_shim_controller/test/CMakeLists.txt +++ b/nav2_rotation_shim_controller/test/CMakeLists.txt @@ -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_util::nav2_util_core + nav2_controller::simple_goal_checker + tf2_ros::tf2_ros ) diff --git a/nav2_rviz_plugins/CMakeLists.txt b/nav2_rviz_plugins/CMakeLists.txt index 51df97f421..4caaba7251 100644 --- a/nav2_rviz_plugins/CMakeLists.txt +++ b/nav2_rviz_plugins/CMakeLists.txt @@ -15,6 +15,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) find_package(ament_cmake REQUIRED) +find_package(ament_index_cpp REQUIRED) find_package(geometry_msgs REQUIRED) find_package(nav2_util REQUIRED) find_package(nav2_lifecycle_manager REQUIRED) @@ -42,10 +43,6 @@ set(nav2_rviz_plugins_headers_to_moc include/nav2_rviz_plugins/particle_cloud_display/particle_cloud_display.hpp ) -include_directories( - include -) - set(library_name ${PROJECT_NAME}) add_library(${library_name} SHARED @@ -55,6 +52,28 @@ add_library(${library_name} SHARED src/particle_cloud_display/particle_cloud_display.cpp ${nav2_rviz_plugins_headers_to_moc} ) +target_include_directories(${library_name} PUBLIC + ${Qt5Widgets_INCLUDE_DIRS} + ${OGRE_INCLUDE_DIRS} + "$" + "$" +) + +target_link_libraries(${library_name} PUBLIC + rviz_common::rviz_common + pluginlib::pluginlib + ament_index_cpp::ament_index_cpp + yaml-cpp + ${geometry_msgs_TARGETS} + nav2_util::nav2_util_core + nav2_lifecycle_manager::nav2_lifecycle_manager_core + rclcpp_action::rclcpp_action + ${nav2_msgs_TARGETS} + ${visualization_msgs_TARGETS} + rclcpp::rclcpp + rviz_rendering::rviz_rendering + rviz_default_plugins::rviz_default_plugins +) set(dependencies geometry_msgs @@ -75,19 +94,6 @@ set(dependencies yaml_cpp_vendor ) -ament_target_dependencies(${library_name} - ${dependencies} -) - -target_include_directories(${library_name} PUBLIC - ${Qt5Widgets_INCLUDE_DIRS} - ${OGRE_INCLUDE_DIRS} -) - -target_link_libraries(${library_name} - rviz_common::rviz_common -) - # Causes the visibility macros to use dllexport rather than dllimport, # which is appropriate when building the dll but not consuming it. # TODO: Make this specific to this project (not rviz default plugins) @@ -101,12 +107,11 @@ install( ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin - INCLUDES DESTINATION include ) install( DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -114,7 +119,7 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() endif() -ament_export_include_directories(include) +ament_export_include_directories(include/${PROJECT_NAME}) ament_export_targets(${library_name} HAS_LIBRARY_TARGET) ament_export_dependencies( Qt5 diff --git a/nav2_smoother/CMakeLists.txt b/nav2_smoother/CMakeLists.txt index 0ab7c83628..402dbafc4f 100644 --- a/nav2_smoother/CMakeLists.txt +++ b/nav2_smoother/CMakeLists.txt @@ -16,16 +16,8 @@ find_package(nav_2d_utils REQUIRED) find_package(nav_2d_msgs REQUIRED) find_package(pluginlib REQUIRED) -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 17) -endif() - nav2_package() -include_directories( - include -) - set(executable_name smoother_server) set(library_name ${executable_name}_core) @@ -48,33 +40,85 @@ set(dependencies add_library(${library_name} SHARED src/nav2_smoother.cpp ) -ament_target_dependencies(${library_name} - ${dependencies} +target_include_directories(${library_name} + PUBLIC + "$" + "$") +target_link_libraries(${library_name} PUBLIC + nav2_core::nav2_core + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + pluginlib::pluginlib + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros + ${nav_msgs_TARGETS} +) +target_link_libraries(${library_name} PRIVATE + nav_2d_utils::conversions + nav_2d_utils::tf_help + tf2::tf2 + rclcpp_components::component ) # Main executable add_executable(${executable_name} src/main.cpp ) -ament_target_dependencies(${executable_name} - ${dependencies} -) -target_link_libraries(${executable_name} ${library_name}) +target_include_directories(${executable_name} + PUBLIC + "$" + "$") +target_link_libraries(${executable_name} PRIVATE rclcpp::rclcpp ${library_name}) # Simple Smoother plugin add_library(simple_smoother SHARED src/simple_smoother.cpp ) -ament_target_dependencies(simple_smoother - ${dependencies} +target_include_directories(simple_smoother + PUBLIC + "$" + "$") +target_link_libraries(simple_smoother PUBLIC + tf2::tf2 + nav2_core::nav2_core + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client + nav2_util::nav2_util_core + ${nav_msgs_TARGETS} + angles::angles + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros +) +target_link_libraries(simple_smoother PRIVATE + pluginlib::pluginlib ) # Savitzky Golay Smoother plugin add_library(savitzky_golay_smoother SHARED src/savitzky_golay_smoother.cpp ) -ament_target_dependencies(savitzky_golay_smoother - ${dependencies} +target_include_directories(savitzky_golay_smoother + PUBLIC + "$" + "$") +target_link_libraries(savitzky_golay_smoother PUBLIC + nav2_core::nav2_core + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client + nav2_util::nav2_util_core + ${nav_msgs_TARGETS} + angles::angles + tf2::tf2 + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros +) +target_link_libraries(savitzky_golay_smoother PRIVATE + pluginlib::pluginlib ) pluginlib_export_plugin_description_file(nav2_core plugins.xml) @@ -87,12 +131,16 @@ if(BUILD_TESTING) ament_lint_auto_find_test_dependencies() find_package(ament_cmake_gtest REQUIRED) + + ament_find_gtest() + add_subdirectory(test) endif() rclcpp_components_register_nodes(${library_name} "nav2_smoother::SmootherServer") install( TARGETS ${library_name} simple_smoother savitzky_golay_smoother + EXPORT ${library_name} ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin @@ -103,17 +151,11 @@ install(TARGETS ${executable_name} ) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() - find_package(ament_cmake_gtest REQUIRED) - add_subdirectory(test) -endif() - -ament_export_include_directories(include) +ament_export_include_directories(include/${PROJECT_NAME}) ament_export_libraries(${library_name} simple_smoother savitzky_golay_smoother) ament_export_dependencies(${dependencies}) +ament_export_targets(${library_name}) ament_package() diff --git a/nav2_smoother/package.xml b/nav2_smoother/package.xml index d55321b3f3..24fbc107b6 100644 --- a/nav2_smoother/package.xml +++ b/nav2_smoother/package.xml @@ -25,7 +25,6 @@ ament_lint_common ament_lint_auto ament_cmake_gtest - ament_cmake_pytest ament_cmake diff --git a/nav2_smoother/test/CMakeLists.txt b/nav2_smoother/test/CMakeLists.txt index 623447b5f9..be9d6ab1b2 100644 --- a/nav2_smoother/test/CMakeLists.txt +++ b/nav2_smoother/test/CMakeLists.txt @@ -1,36 +1,48 @@ ament_add_gtest(test_smoother_server test_smoother_server.cpp ) - target_link_libraries(test_smoother_server ${library_name} -) - -ament_target_dependencies(test_smoother_server - ${dependencies} + rclcpp::rclcpp + rclcpp_action::rclcpp_action + nav2_core::nav2_core + ${nav2_msgs_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client + ${geometry_msgs_TARGETS} + pluginlib::pluginlib ) ament_add_gtest(test_simple_smoother test_simple_smoother.cpp ) - target_link_libraries(test_simple_smoother simple_smoother + rclcpp::rclcpp + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + nav2_core::nav2_core + ${nav_msgs_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle + tf2::tf2 ) -ament_target_dependencies(test_simple_smoother - ${dependencies} -) - - ament_add_gtest(test_savitzky_golay_smoother test_savitzky_golay_smoother.cpp ) - target_link_libraries(test_savitzky_golay_smoother savitzky_golay_smoother -) - -ament_target_dependencies(test_savitzky_golay_smoother - ${dependencies} + rclcpp::rclcpp + ament_index_cpp::ament_index_cpp + nav2_util::nav2_util_core + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client + nav2_core::nav2_core + ${nav2_msgs_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros + ${nav_msgs_TARGETS} ) diff --git a/nav2_system_tests/CMakeLists.txt b/nav2_system_tests/CMakeLists.txt index 2674b65e74..a0e17b455b 100644 --- a/nav2_system_tests/CMakeLists.txt +++ b/nav2_system_tests/CMakeLists.txt @@ -52,8 +52,7 @@ set(dependencies set(local_controller_plugin_lib local_controller) add_library(${local_controller_plugin_lib} SHARED src/error_codes/controller/controller_error_plugins.cpp) -ament_target_dependencies(${local_controller_plugin_lib} ${dependencies}) -target_compile_definitions(${local_controller_plugin_lib} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") +target_link_libraries(${local_controller_plugin_lib} PRIVATE nav2_core::nav2_core nav2_costmap_2d::nav2_costmap_2d_core ${nav_msgs_TARGETS} ${geometry_msgs_TARGETS} pluginlib::pluginlib) pluginlib_export_plugin_description_file(nav2_core src/error_codes/controller_plugins.xml) install(TARGETS ${local_controller_plugin_lib} @@ -69,8 +68,7 @@ install(FILES src/error_codes/controller_plugins.xml set(global_planner_plugin_lib global_planner) add_library(${global_planner_plugin_lib} SHARED src/error_codes/planner/planner_error_plugin.cpp) -ament_target_dependencies(${global_planner_plugin_lib} ${dependencies}) -target_compile_definitions(${global_planner_plugin_lib} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") +target_link_libraries(${global_planner_plugin_lib} PRIVATE rclcpp::rclcpp rclcpp_lifecycle::rclcpp_lifecycle tf2_ros::tf2_ros nav2_costmap_2d::nav2_costmap_2d_core ${geometry_msgs_TARGETS} nav2_core::nav2_core ${nav_msgs_TARGETS}) pluginlib_export_plugin_description_file(nav2_core src/error_codes/planner_plugins.xml) install(TARGETS ${global_planner_plugin_lib} @@ -86,8 +84,7 @@ install(FILES src/error_codes/planner_plugins.xml set(smoother_plugin_lib smoother) add_library(${smoother_plugin_lib} SHARED src/error_codes/smoother/smoother_error_plugin.cpp) -ament_target_dependencies(${smoother_plugin_lib} ${dependencies}) -target_compile_definitions(${smoother_plugin_lib} PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS") +target_link_libraries(${smoother_plugin_lib} PRIVATE nav2_core::nav2_core rclcpp_lifecycle::rclcpp_lifecycle tf2_ros::tf2_ros nav2_costmap_2d::nav2_costmap_2d_core rclcpp::rclcpp ${nav_msgs_TARGETS}) pluginlib_export_plugin_description_file(nav2_core src/error_codes/smoother_plugins.xml) install(TARGETS ${smoother_plugin_lib} @@ -107,6 +104,8 @@ if(BUILD_TESTING) find_package(ament_cmake_gtest REQUIRED) find_package(ament_cmake_pytest REQUIRED) + ament_find_gtest() + add_subdirectory(src/behavior_tree) add_subdirectory(src/planning) add_subdirectory(src/localization) diff --git a/nav2_system_tests/src/behavior_tree/CMakeLists.txt b/nav2_system_tests/src/behavior_tree/CMakeLists.txt index 19eca116e0..a807502f3d 100644 --- a/nav2_system_tests/src/behavior_tree/CMakeLists.txt +++ b/nav2_system_tests/src/behavior_tree/CMakeLists.txt @@ -1,16 +1,11 @@ -find_package(Boost COMPONENTS system filesystem REQUIRED) - ament_add_gtest(test_behavior_tree_node test_behavior_tree_node.cpp server_handler.cpp ) - -ament_target_dependencies(test_behavior_tree_node - ${dependencies} -) - -target_include_directories(test_behavior_tree_node PUBLIC ${Boost_INCLUDE_DIRS}) target_link_libraries(test_behavior_tree_node - ${Boost_FILESYSTEM_LIBRARY} - ${Boost_SYSTEM_LIBRARY} + BT::behaviortree_cpp_v3 + ament_index_cpp::ament_index_cpp + nav2_util::nav2_util_core + rclcpp::rclcpp + tf2_ros::tf2_ros ) diff --git a/nav2_system_tests/src/behavior_tree/test_behavior_tree_node.cpp b/nav2_system_tests/src/behavior_tree/test_behavior_tree_node.cpp index 48b97848f8..13554a4e22 100644 --- a/nav2_system_tests/src/behavior_tree/test_behavior_tree_node.cpp +++ b/nav2_system_tests/src/behavior_tree/test_behavior_tree_node.cpp @@ -15,9 +15,9 @@ #include #include #include +#include #include #include -#include #include "gtest/gtest.h" @@ -37,7 +37,6 @@ #include "server_handler.hpp" using namespace std::chrono_literals; -namespace fs = boost::filesystem; namespace nav2_system_tests { @@ -240,12 +239,12 @@ std::shared_ptr BehaviorTreeTestFixture::bt_handler = nullp TEST_F(BehaviorTreeTestFixture, TestBTXMLFiles) { - fs::path root = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); + std::filesystem::path root = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); root /= "behavior_trees/"; - if (boost::filesystem::exists(root) && boost::filesystem::is_directory(root)) { - for (auto const & entry : boost::filesystem::recursive_directory_iterator(root)) { - if (boost::filesystem::is_regular_file(entry) && entry.path().extension() == ".xml") { + if (std::filesystem::exists(root) && std::filesystem::is_directory(root)) { + for (auto const & entry : std::filesystem::recursive_directory_iterator(root)) { + if (std::filesystem::is_regular_file(entry) && entry.path().extension() == ".xml") { std::cout << entry.path().string() << std::endl; EXPECT_EQ(bt_handler->loadBehaviorTree(entry.path().string()), true); } @@ -262,7 +261,7 @@ TEST_F(BehaviorTreeTestFixture, TestBTXMLFiles) TEST_F(BehaviorTreeTestFixture, TestAllSuccess) { // Load behavior tree from file - fs::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); + std::filesystem::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); bt_file /= "behavior_trees/"; bt_file /= "navigate_to_pose_w_replanning_and_recovery.xml"; EXPECT_EQ(bt_handler->loadBehaviorTree(bt_file.string()), true); @@ -304,7 +303,7 @@ TEST_F(BehaviorTreeTestFixture, TestAllSuccess) TEST_F(BehaviorTreeTestFixture, TestAllFailure) { // Load behavior tree from file - fs::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); + std::filesystem::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); bt_file /= "behavior_trees/"; bt_file /= "navigate_to_pose_w_replanning_and_recovery.xml"; EXPECT_EQ(bt_handler->loadBehaviorTree(bt_file.string()), true); @@ -356,7 +355,7 @@ TEST_F(BehaviorTreeTestFixture, TestAllFailure) TEST_F(BehaviorTreeTestFixture, TestNavigateSubtreeRecoveries) { // Load behavior tree from file - fs::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); + std::filesystem::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); bt_file /= "behavior_trees/"; bt_file /= "navigate_to_pose_w_replanning_and_recovery.xml"; EXPECT_EQ(bt_handler->loadBehaviorTree(bt_file.string()), true); @@ -410,7 +409,7 @@ TEST_F(BehaviorTreeTestFixture, TestNavigateSubtreeRecoveries) TEST_F(BehaviorTreeTestFixture, TestNavigateRecoverySimple) { // Load behavior tree from file - fs::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); + std::filesystem::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); bt_file /= "behavior_trees/"; bt_file /= "navigate_to_pose_w_replanning_and_recovery.xml"; EXPECT_EQ(bt_handler->loadBehaviorTree(bt_file.string()), true); @@ -504,7 +503,7 @@ TEST_F(BehaviorTreeTestFixture, TestNavigateRecoverySimple) TEST_F(BehaviorTreeTestFixture, TestNavigateRecoveryComplex) { // Load behavior tree from file - fs::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); + std::filesystem::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); bt_file /= "behavior_trees/"; bt_file /= "navigate_to_pose_w_replanning_and_recovery.xml"; EXPECT_EQ(bt_handler->loadBehaviorTree(bt_file.string()), true); @@ -568,7 +567,7 @@ TEST_F(BehaviorTreeTestFixture, TestNavigateRecoveryComplex) TEST_F(BehaviorTreeTestFixture, TestRecoverySubtreeGoalUpdated) { // Load behavior tree from file - fs::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); + std::filesystem::path bt_file = ament_index_cpp::get_package_share_directory("nav2_bt_navigator"); bt_file /= "behavior_trees/"; bt_file /= "navigate_to_pose_w_replanning_and_recovery.xml"; EXPECT_EQ(bt_handler->loadBehaviorTree(bt_file.string()), true); diff --git a/nav2_system_tests/src/behaviors/assisted_teleop/CMakeLists.txt b/nav2_system_tests/src/behaviors/assisted_teleop/CMakeLists.txt index c2210b6fcb..11a4f0b4bd 100644 --- a/nav2_system_tests/src/behaviors/assisted_teleop/CMakeLists.txt +++ b/nav2_system_tests/src/behaviors/assisted_teleop/CMakeLists.txt @@ -4,9 +4,18 @@ ament_add_gtest_executable(${test_assisted_teleop_behavior} test_assisted_teleop_behavior_node.cpp assisted_teleop_behavior_tester.cpp ) - -ament_target_dependencies(${test_assisted_teleop_behavior} - ${dependencies} +target_link_libraries(${test_assisted_teleop_behavior} + rclcpp::rclcpp + ${nav2_msgs_TARGETS} + angles::angles + ${geometry_msgs_TARGETS} + nav2_costmap_2d::nav2_costmap_2d_core + nav2_costmap_2d::nav2_costmap_2d_client + nav2_util::nav2_util_core + rclcpp_action::rclcpp_action + ${std_msgs_TARGETS} + tf2::tf2 + tf2_ros::tf2_ros ) ament_add_test(test_assisted_teleop_behavior diff --git a/nav2_system_tests/src/behaviors/backup/CMakeLists.txt b/nav2_system_tests/src/behaviors/backup/CMakeLists.txt index 05afe3c50d..2623ef6cfe 100644 --- a/nav2_system_tests/src/behaviors/backup/CMakeLists.txt +++ b/nav2_system_tests/src/behaviors/backup/CMakeLists.txt @@ -4,9 +4,15 @@ ament_add_gtest_executable(${test_backup_behavior} test_backup_behavior_node.cpp backup_behavior_tester.cpp ) - -ament_target_dependencies(${test_backup_behavior} - ${dependencies} +target_link_libraries(${test_backup_behavior} + rclcpp::rclcpp + ${nav2_msgs_TARGETS} + rclcpp_action::rclcpp_action + angles::angles + nav2_util::nav2_util_core + ${geometry_msgs_TARGETS} + tf2::tf2 + tf2_ros::tf2_ros ) ament_add_test(test_backup_recovery diff --git a/nav2_system_tests/src/behaviors/drive_on_heading/CMakeLists.txt b/nav2_system_tests/src/behaviors/drive_on_heading/CMakeLists.txt index fe17417e16..cb916e79e3 100644 --- a/nav2_system_tests/src/behaviors/drive_on_heading/CMakeLists.txt +++ b/nav2_system_tests/src/behaviors/drive_on_heading/CMakeLists.txt @@ -4,9 +4,15 @@ ament_add_gtest_executable(${test_drive_on_heading_behavior} test_drive_on_heading_behavior_node.cpp drive_on_heading_behavior_tester.cpp ) - -ament_target_dependencies(${test_drive_on_heading_behavior} - ${dependencies} +target_link_libraries(${test_drive_on_heading_behavior} + rclcpp::rclcpp + rclcpp_action::rclcpp_action + angles::angles + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + ${geometry_msgs_TARGETS} + tf2::tf2 + tf2_ros::tf2_ros ) ament_add_test(test_drive_on_heading_recovery diff --git a/nav2_system_tests/src/behaviors/spin/CMakeLists.txt b/nav2_system_tests/src/behaviors/spin/CMakeLists.txt index 84ee7246e5..96a2bceca2 100644 --- a/nav2_system_tests/src/behaviors/spin/CMakeLists.txt +++ b/nav2_system_tests/src/behaviors/spin/CMakeLists.txt @@ -4,9 +4,15 @@ ament_add_gtest_executable(${test_spin_behavior_exec} test_spin_behavior_node.cpp spin_behavior_tester.cpp ) - -ament_target_dependencies(${test_spin_behavior_exec} - ${dependencies} +target_link_libraries(${test_spin_behavior_exec} + rclcpp::rclcpp + tf2_ros::tf2_ros + ${geometry_msgs_TARGETS} + ${nav2_msgs_TARGETS} + rclcpp_action::rclcpp_action + angles::angles + tf2::tf2 + nav2_util::nav2_util_core ) ament_add_test(test_spin_behavior diff --git a/nav2_system_tests/src/behaviors/wait/CMakeLists.txt b/nav2_system_tests/src/behaviors/wait/CMakeLists.txt index d6fb45401d..d9bdf4d7bd 100644 --- a/nav2_system_tests/src/behaviors/wait/CMakeLists.txt +++ b/nav2_system_tests/src/behaviors/wait/CMakeLists.txt @@ -4,9 +4,14 @@ ament_add_gtest_executable(${test_wait_behavior_exec} test_wait_behavior_node.cpp wait_behavior_tester.cpp ) - -ament_target_dependencies(${test_wait_behavior_exec} - ${dependencies} +target_link_libraries(${test_wait_behavior_exec} + rclcpp::rclcpp + tf2_ros::tf2_ros + ${geometry_msgs_TARGETS} + rclcpp_action::rclcpp_action + angles::angles + nav2_util::nav2_util_core + ${nav2_msgs_TARGETS} ) ament_add_test(test_wait_behavior diff --git a/nav2_system_tests/src/localization/CMakeLists.txt b/nav2_system_tests/src/localization/CMakeLists.txt index 740d38f53e..a3dd0fb498 100644 --- a/nav2_system_tests/src/localization/CMakeLists.txt +++ b/nav2_system_tests/src/localization/CMakeLists.txt @@ -1,11 +1,13 @@ ament_add_gtest_executable(test_localization_node test_localization_node.cpp ) -ament_target_dependencies(test_localization_node - ${dependencies} +target_link_libraries(test_localization_node + ${geometry_msgs_TARGETS} + ${std_msgs_TARGETS} + rclcpp::rclcpp + nav2_amcl::amcl_core ) - ament_add_test(test_localization GENERATE_RESULT_FOR_RETURN_CODE_ZERO COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/test_localization_launch.py" diff --git a/nav2_system_tests/src/planning/CMakeLists.txt b/nav2_system_tests/src/planning/CMakeLists.txt index 61355a82c4..da3f6ca5ca 100644 --- a/nav2_system_tests/src/planning/CMakeLists.txt +++ b/nav2_system_tests/src/planning/CMakeLists.txt @@ -4,12 +4,18 @@ ament_add_gtest_executable(${test_planner_costmaps_exec} test_planner_costmaps_node.cpp planner_tester.cpp ) - target_link_libraries(${test_planner_costmaps_exec} - ${nav2_map_server_LIBRARIES}) - -ament_target_dependencies(${test_planner_costmaps_exec} - ${dependencies} + ${nav2_map_server_LIBRARIES} + rclcpp::rclcpp + nav2_util::nav2_util_core + ${geometry_msgs_TARGETS} + ${nav_msgs_TARGETS} + ${nav2_msgs_TARGETS} + rclcpp_lifecycle::rclcpp_lifecycle + tf2_ros::tf2_ros + ${visualization_msgs_TARGETS} + nav2_planner::planner_server_core + nav2_map_server::map_io ) set(test_planner_random_exec test_planner_random_node) @@ -18,13 +24,19 @@ ament_add_gtest_executable(${test_planner_random_exec} test_planner_random_node.cpp planner_tester.cpp ) - -ament_target_dependencies(${test_planner_random_exec} - ${dependencies} -) - target_link_libraries(${test_planner_random_exec} - ${nav2_map_server_LIBRARIES}) + ${nav2_map_server_LIBRARIES} + nav2_util::nav2_util_core + ${nav_msgs_TARGETS} + ${geometry_msgs_TARGETS} + rclcpp::rclcpp + ${nav2_msgs_TARGETS} + tf2_ros::tf2_ros + rclcpp_action::rclcpp_action + ${visualization_msgs_TARGETS} + nav2_planner::planner_server_core + nav2_map_server::map_io +) ament_add_test(test_planner_costmaps GENERATE_RESULT_FOR_RETURN_CODE_ZERO @@ -50,14 +62,29 @@ ament_add_gtest(test_planner_plugins test_planner_plugins.cpp TIMEOUT 10 ) - -ament_target_dependencies(test_planner_plugins rclcpp geometry_msgs nav2_msgs ${dependencies}) target_link_libraries(test_planner_plugins stdc++fs + ${nav_msgs_TARGETS} + nav2_util::nav2_util_core + nav2_core::nav2_core + ${geometry_msgs_TARGETS} + tf2::tf2 + rclcpp::rclcpp + rclcpp_lifecycle::rclcpp_lifecycle + nav2_planner::planner_server_core + ${visualization_msgs_TARGETS} ) ament_add_gtest(test_planner_is_path_valid - test_planner_is_path_valid.cpp - planner_tester.cpp) - -ament_target_dependencies(test_planner_is_path_valid rclcpp geometry_msgs nav2_msgs ${dependencies}) + test_planner_is_path_valid.cpp + planner_tester.cpp) +target_link_libraries(test_planner_is_path_valid + rclcpp::rclcpp + ${nav2_msgs_TARGETS} + nav2_util::nav2_util_core + ${geometry_msgs_TARGETS} + ${nav_msgs_TARGETS} + ${visualization_msgs_TARGETS} + nav2_planner::planner_server_core + nav2_map_server::map_io +) diff --git a/nav2_system_tests/src/updown/CMakeLists.txt b/nav2_system_tests/src/updown/CMakeLists.txt index 273e1828ea..5c3af38ad1 100644 --- a/nav2_system_tests/src/updown/CMakeLists.txt +++ b/nav2_system_tests/src/updown/CMakeLists.txt @@ -1,11 +1,11 @@ add_executable(test_updown test_updown.cpp ) - -ament_target_dependencies(test_updown - ${dependencies} +target_link_libraries(test_updown + ${geometry_msgs_TARGETS} + nav2_lifecycle_manager::nav2_lifecycle_manager_core + rclcpp::rclcpp ) install(TARGETS test_updown RUNTIME DESTINATION lib/${PROJECT_NAME}) install(FILES test_updown_launch.py DESTINATION share/${PROJECT_NAME}) - diff --git a/nav2_system_tests/src/updown/test_updown.cpp b/nav2_system_tests/src/updown/test_updown.cpp index 092e0edf46..30851ffe6c 100644 --- a/nav2_system_tests/src/updown/test_updown.cpp +++ b/nav2_system_tests/src/updown/test_updown.cpp @@ -19,7 +19,6 @@ #include "geometry_msgs/msg/pose_stamped.hpp" #include "nav2_lifecycle_manager/lifecycle_manager_client.hpp" -#include "rcutils/cmdline_parser.h" using namespace std::chrono_literals; diff --git a/nav2_util/CMakeLists.txt b/nav2_util/CMakeLists.txt index 4635bab0b0..2be90432ce 100644 --- a/nav2_util/CMakeLists.txt +++ b/nav2_util/CMakeLists.txt @@ -16,34 +16,62 @@ find_package(rclcpp_lifecycle REQUIRED) find_package(tf2_geometry_msgs REQUIRED) find_package(bondcpp REQUIRED) find_package(bond REQUIRED) -find_package(action_msgs REQUIRED) - -set(dependencies - nav2_msgs - tf2_ros - tf2 - tf2_geometry_msgs - geometry_msgs - nav_msgs - rclcpp - lifecycle_msgs - rclcpp_action - rclcpp_lifecycle - bondcpp - bond - action_msgs - rcl_interfaces -) +find_package(rcl_interfaces REQUIRED) nav2_package() -include_directories(include) - set(library_name ${PROJECT_NAME}_core) -add_subdirectory(src) + +add_library(${library_name} SHARED + src/costmap.cpp + src/node_utils.cpp + src/lifecycle_service_client.cpp + src/string_utils.cpp + src/lifecycle_utils.cpp + src/lifecycle_node.cpp + src/robot_utils.cpp + src/node_thread.cpp + src/odometry_utils.cpp +) +target_include_directories(${library_name} + PUBLIC + "$" + "$") +target_link_libraries(${library_name} PUBLIC + ${nav2_msgs_TARGETS} + tf2_ros::tf2_ros + tf2::tf2 + ${tf2_geometry_msgs_TARGETS} + ${geometry_msgs_TARGETS} + ${nav_msgs_TARGETS} + rclcpp::rclcpp + ${lifecycle_msgs_TARGETS} + rclcpp_action::rclcpp_action + rclcpp_lifecycle::rclcpp_lifecycle + bondcpp::bondcpp + ${bond_TARGETS} + ${rcl_interfaces_TARGETS} +) + +add_executable(lifecycle_bringup + src/lifecycle_bringup_commandline.cpp +) +target_link_libraries(lifecycle_bringup PRIVATE ${library_name} rclcpp::rclcpp) + +install(TARGETS ${library_name} + EXPORT ${library_name} + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin +) + +install(TARGETS + lifecycle_bringup + RUNTIME DESTINATION lib/${PROJECT_NAME} +) install(DIRECTORY include/ - DESTINATION include/ + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -56,8 +84,23 @@ if(BUILD_TESTING) 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( + nav2_msgs + tf2_ros + tf2 + tf2_geometry_msgs + geometry_msgs + nav_msgs + rclcpp + lifecycle_msgs + rclcpp_action + rclcpp_lifecycle + bondcpp + bond + rcl_interfaces +) +ament_export_targets(${library_name}) ament_package() diff --git a/nav2_util/package.xml b/nav2_util/package.xml index 298b94eedc..e5c0bfc9fe 100644 --- a/nav2_util/package.xml +++ b/nav2_util/package.xml @@ -27,7 +27,6 @@ rclcpp_lifecycle launch launch_testing_ament_cmake - action_msgs rcl_interfaces libboost-program-options @@ -39,7 +38,6 @@ launch_testing_ament_cmake std_srvs test_msgs - action_msgs launch_testing_ros ament_cmake_pytest diff --git a/nav2_util/src/CMakeLists.txt b/nav2_util/src/CMakeLists.txt deleted file mode 100644 index a639a0e59e..0000000000 --- a/nav2_util/src/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -add_library(${library_name} SHARED - costmap.cpp - node_utils.cpp - lifecycle_service_client.cpp - string_utils.cpp - lifecycle_utils.cpp - lifecycle_node.cpp - robot_utils.cpp - node_thread.cpp - odometry_utils.cpp -) - -ament_target_dependencies(${library_name} - rclcpp - nav2_msgs - tf2 - tf2_ros - nav_msgs - geometry_msgs - lifecycle_msgs - rclcpp_lifecycle - tf2_geometry_msgs - bondcpp -) - -add_executable(lifecycle_bringup - lifecycle_bringup_commandline.cpp -) -target_link_libraries(lifecycle_bringup ${library_name}) - -find_package(Boost REQUIRED COMPONENTS program_options) - -install(TARGETS - ${library_name} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin -) - -install(TARGETS - lifecycle_bringup - RUNTIME DESTINATION lib/${PROJECT_NAME} -) diff --git a/nav2_util/test/CMakeLists.txt b/nav2_util/test/CMakeLists.txt index 9f1ae99bbc..01d364550e 100644 --- a/nav2_util/test/CMakeLists.txt +++ b/nav2_util/test/CMakeLists.txt @@ -1,4 +1,5 @@ ament_add_gtest(test_execution_timer test_execution_timer.cpp) +target_link_libraries(test_execution_timer ${library_name}) ament_add_gtest(test_node_utils test_node_utils.cpp) target_link_libraries(test_node_utils ${library_name}) @@ -7,37 +8,29 @@ find_package(std_srvs REQUIRED) find_package(test_msgs REQUIRED) ament_add_gtest(test_service_client test_service_client.cpp) -ament_target_dependencies(test_service_client std_srvs) -target_link_libraries(test_service_client ${library_name}) +target_link_libraries(test_service_client ${library_name} ${std_srvs_TARGETS}) ament_add_gtest(test_string_utils test_string_utils.cpp) target_link_libraries(test_string_utils ${library_name}) find_package(rclcpp_lifecycle REQUIRED) ament_add_gtest(test_lifecycle_utils test_lifecycle_utils.cpp) -ament_target_dependencies(test_lifecycle_utils rclcpp_lifecycle) -target_link_libraries(test_lifecycle_utils ${library_name}) +target_link_libraries(test_lifecycle_utils ${library_name} rclcpp_lifecycle::rclcpp_lifecycle) ament_add_gtest(test_actions test_actions.cpp) -ament_target_dependencies(test_actions rclcpp_action test_msgs) -target_link_libraries(test_actions ${library_name}) +target_link_libraries(test_actions ${library_name} rclcpp_action::rclcpp_action ${test_msgs_TARGETS}) ament_add_gtest(test_lifecycle_node test_lifecycle_node.cpp) -ament_target_dependencies(test_lifecycle_node rclcpp_lifecycle) -target_link_libraries(test_lifecycle_node ${library_name}) +target_link_libraries(test_lifecycle_node ${library_name} rclcpp_lifecycle::rclcpp_lifecycle) ament_add_gtest(test_lifecycle_cli_node test_lifecycle_cli_node.cpp) -ament_target_dependencies(test_lifecycle_cli_node rclcpp_lifecycle) -target_link_libraries(test_lifecycle_cli_node ${library_name}) +target_link_libraries(test_lifecycle_cli_node ${library_name} rclcpp_lifecycle::rclcpp_lifecycle) ament_add_gtest(test_geometry_utils test_geometry_utils.cpp) -ament_target_dependencies(test_geometry_utils geometry_msgs) -target_link_libraries(test_geometry_utils ${library_name}) +target_link_libraries(test_geometry_utils ${library_name} ${geometry_msgs_TARGETS}) ament_add_gtest(test_odometry_utils test_odometry_utils.cpp) -ament_target_dependencies(test_odometry_utils nav_msgs geometry_msgs) -target_link_libraries(test_odometry_utils ${library_name}) +target_link_libraries(test_odometry_utils ${library_name} ${nav_msgs_TARGETS} ${geometry_msgs_TARGETS}) ament_add_gtest(test_robot_utils test_robot_utils.cpp) -ament_target_dependencies(test_robot_utils geometry_msgs) -target_link_libraries(test_robot_utils ${library_name}) +target_link_libraries(test_robot_utils ${library_name} ${geometry_msgs_TARGETS}) diff --git a/nav2_voxel_grid/CMakeLists.txt b/nav2_voxel_grid/CMakeLists.txt index 4b88a87d86..88e2d59848 100644 --- a/nav2_voxel_grid/CMakeLists.txt +++ b/nav2_voxel_grid/CMakeLists.txt @@ -7,29 +7,26 @@ find_package(rclcpp REQUIRED) nav2_package() -include_directories( - include) - add_library(voxel_grid SHARED src/voxel_grid.cpp ) - -set(dependencies - rclcpp -) - -ament_target_dependencies(voxel_grid - ${dependencies} +target_include_directories(voxel_grid + PUBLIC + "$" + "$") +target_link_libraries(voxel_grid PUBLIC + rclcpp::rclcpp ) install(TARGETS voxel_grid + EXPORT voxel_grid ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) install(DIRECTORY include/ - DESTINATION include + DESTINATION include/${PROJECT_NAME} ) if(BUILD_TESTING) @@ -45,5 +42,6 @@ endif() ament_export_dependencies(rclcpp) ament_export_include_directories(include) ament_export_libraries(voxel_grid) +ament_export_targets(voxel_grid) ament_package()