From b102d8c9cf4a50d48d259962a30bb2f51c25a804 Mon Sep 17 00:00:00 2001 From: Nathan Brooks Date: Wed, 15 Jul 2026 22:37:37 -0600 Subject: [PATCH 1/4] =?UTF-8?q?CMake:=20migrate=20ament=5Ftarget=5Fdepende?= =?UTF-8?q?ncies=20=E2=86=92=20target=5Flink=5Flibraries=20+=20add=20inter?= =?UTF-8?q?active=5Fmarkers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rolling removed ament_target_dependencies. Migrate to target_link_libraries with imported targets across the library and demo call sites. Add explicit find_package(interactive_markers) + + link — no longer transitive through rviz_visual_tools after rviz_visual_tools#277. --- CMakeLists.txt | 34 ++++++++++++++++++++++++++++++++-- package.xml | 1 + 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 479fd14..979bf55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ find_package(moveit_ros_occupancy_map_monitor REQUIRED) find_package(rclcpp REQUIRED) find_package(rclcpp_components REQUIRED) find_package(rviz_visual_tools REQUIRED) +find_package(interactive_markers REQUIRED) find_package(std_msgs REQUIRED) find_package(tf2_eigen REQUIRED) find_package(tf2_ros REQUIRED) @@ -29,6 +30,7 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS moveit_ros_planning rclcpp rviz_visual_tools + interactive_markers std_msgs tf2_eigen tf2_ros @@ -47,7 +49,22 @@ target_include_directories(${PROJECT_NAME} PUBLIC $ PUBLIC $ ) -ament_target_dependencies(${PROJECT_NAME} ${THIS_PACKAGE_INCLUDE_DEPENDS}) +target_link_libraries(${PROJECT_NAME} + ${geometry_msgs_TARGETS} + ${graph_msgs_TARGETS} + moveit_core::moveit_robot_state + moveit_core::moveit_utils + moveit_ros_planning::moveit_ros_planning + rclcpp::rclcpp + rviz_visual_tools::rviz_visual_tools + interactive_markers::interactive_markers + ${std_msgs_TARGETS} + tf2_eigen::tf2_eigen + tf2_ros::tf2_ros + ${trajectory_msgs_TARGETS} + ${visualization_msgs_TARGETS} + ${Boost_LIBRARIES} +) # Demo executable add_executable(${PROJECT_NAME}_demo @@ -55,8 +72,21 @@ add_executable(${PROJECT_NAME}_demo ) target_link_libraries(${PROJECT_NAME}_demo ${PROJECT_NAME} + ${geometry_msgs_TARGETS} + ${graph_msgs_TARGETS} + moveit_core::moveit_robot_state + moveit_core::moveit_utils + moveit_ros_planning::moveit_ros_planning + rclcpp::rclcpp + rviz_visual_tools::rviz_visual_tools + interactive_markers::interactive_markers + ${std_msgs_TARGETS} + tf2_eigen::tf2_eigen + tf2_ros::tf2_ros + ${trajectory_msgs_TARGETS} + ${visualization_msgs_TARGETS} + ${Boost_LIBRARIES} ) -ament_target_dependencies(${PROJECT_NAME}_demo ${THIS_PACKAGE_INCLUDE_DEPENDS}) # Exports diff --git a/package.xml b/package.xml index bd807f3..041af2f 100644 --- a/package.xml +++ b/package.xml @@ -23,6 +23,7 @@ moveit_ros_planning rclcpp rviz_visual_tools + interactive_markers std_msgs tf2_eigen tf2_ros From 9aa4f9cb96c725956547152d3af56339ff32d44f Mon Sep 17 00:00:00 2001 From: Nathan Brooks Date: Wed, 15 Jul 2026 22:37:37 -0600 Subject: [PATCH 2/4] demo: guard ament_index_cpp header rename with AMENT_INDEX_CPP_VERSION_GTE ament_index_cpp 1.14+ removed . Use the new get_package_share_path (returns std::filesystem::path) when available, fall back to the old API otherwise. Same 3-tier guard pattern moveit2#3705 adopted. --- src/moveit_visual_tools_demo.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/moveit_visual_tools_demo.cpp b/src/moveit_visual_tools_demo.cpp index 4e4fe28..dfb819a 100644 --- a/src/moveit_visual_tools_demo.cpp +++ b/src/moveit_visual_tools_demo.cpp @@ -33,7 +33,13 @@ // ROS #include +#include +#if AMENT_INDEX_CPP_VERSION_GTE(1, 14, 0) +#include +#include +#else #include +#endif // For visualizing things in rviz #include @@ -204,8 +210,12 @@ class VisualToolsDemo // -------------------------------------------------------------------- RCLCPP_INFO_STREAM(LOGGER, "Publishing Collision Mesh"); - // TODO: Catch exception +// TODO: Catch exception +#if AMENT_INDEX_CPP_VERSION_GTE(1, 14, 0) + std::string file_path = "file://" + ament_index_cpp::get_package_share_path(THIS_PACKAGE).string(); +#else std::string file_path = "file://" + ament_index_cpp::get_package_share_directory(THIS_PACKAGE); +#endif if (file_path == "file://") RCLCPP_FATAL_STREAM(LOGGER, "Unable to get " << THIS_PACKAGE << " package path "); file_path.append("/resources/demo_mesh.stl"); From 0ef7ba0cacde14ed9593df545878aa92ed29c3c8 Mon Sep 17 00:00:00 2001 From: Nathan Brooks Date: Sun, 2 Aug 2026 18:58:37 -0600 Subject: [PATCH 3/4] Declare the three dependencies used directly but never declared moveit_visual_tools #includes these packages and uses their API directly, but declares none of them in package.xml or CMakeLists.txt. All three resolve today only because moveit_core / moveit_ros_planning happen to pull them in transitively. geometric_shapes src/moveit_visual_tools.cpp:67-68 includes solid_primitive_dims.h + shape_operations.h and calls shapes::createMeshFromResource / shapes::constructMsgFromShape at L861-863. Reported as #155. moveit_msgs include/moveit_visual_tools/moveit_visual_tools.h:48-52 includes five moveit_msgs headers, and the types appear in public method signatures (publishGrasps, publishTrajectoryPath, processCollisionObjectMsg, ...). ament_index_cpp src/moveit_visual_tools_demo.cpp:36-41. Each is scoped to what it is actually used for rather than added uniformly: - moveit_msgs is PUBLIC and exported via THIS_PACKAGE_INCLUDE_DEPENDS: it appears in installed public headers, so downstream consumers of find_package(moveit_visual_tools) need it resolved. - geometric_shapes is PRIVATE and deliberately NOT exported. It appears in no public header -- include/ contains zero references to it or to shapes::. This is a SHARED library, so a PRIVATE link is not recorded in the exported target's interface at all (no $ entry, which would appear for a STATIC library), and downstream consumers correctly do not need geometric_shapes. Linking the library target therefore uses the keyword signature; the demo target keeps the plain form, which is legal because the plain/keyword rule is per-target. - ament_index_cpp is linked to the demo executable only and kept out of THIS_PACKAGE_INCLUDE_DEPENDS; it is not part of the library's interface. All three still get in package.xml. A find_package(... REQUIRED) without a matching is a build-time dependency rosdep will never install, so the two halves are not substitutes for each other. This matters more on this branch than on ros2. The preceding commit replaces ament_target_dependencies with target_link_libraries, and ament_target_dependencies was flattening the recursive dependency tree onto every target -- which is precisely what was papering over these three gaps. Declaring them is a prerequisite for that migration, not a metadata cleanup. moveit_ros_occupancy_map_monitor is deliberately not among the three. #153 added find_package(moveit_ros_occupancy_map_monitor REQUIRED) on the base branch, but nothing here includes an occupancy_map_monitor header directly; it is reachable only via moveit/planning_scene_monitor/planning_scene_monitor.hpp:53. Verified against the built moveit_ros_planning export set: moveit_planning_scene_monitor carries moveit_ros_occupancy_map_monitor::moveit_ros_occupancy_map_monitor in its INTERFACE_LINK_LIBRARIES and moveit_ros_planning::moveit_ros_planning re-exports it, so planning_scene_monitor.hpp compiles under target_link_libraries with no explicit find_package. That line is left as-is here; note it has no matching in package.xml, which is the find_package/ mismatch this commit avoids for the other three. --- CMakeLists.txt | 42 ++++++++++++++++++++++++++++-------------- package.xml | 3 +++ 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 979bf55..9b901c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,14 @@ find_package(moveit_common REQUIRED) moveit_package() # Load all dependencies required for this package +find_package(ament_index_cpp REQUIRED) find_package(Boost REQUIRED) find_package(Eigen3 REQUIRED) +find_package(geometric_shapes REQUIRED) find_package(geometry_msgs REQUIRED) find_package(graph_msgs REQUIRED) find_package(moveit_core REQUIRED) +find_package(moveit_msgs REQUIRED) find_package(moveit_ros_planning REQUIRED) find_package(moveit_ros_occupancy_map_monitor REQUIRED) find_package(rclcpp REQUIRED) @@ -27,6 +30,7 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS geometry_msgs graph_msgs moveit_core + moveit_msgs moveit_ros_planning rclcpp rviz_visual_tools @@ -50,20 +54,28 @@ target_include_directories(${PROJECT_NAME} PUBLIC $ ) target_link_libraries(${PROJECT_NAME} - ${geometry_msgs_TARGETS} - ${graph_msgs_TARGETS} - moveit_core::moveit_robot_state - moveit_core::moveit_utils - moveit_ros_planning::moveit_ros_planning - rclcpp::rclcpp - rviz_visual_tools::rviz_visual_tools - interactive_markers::interactive_markers - ${std_msgs_TARGETS} - tf2_eigen::tf2_eigen - tf2_ros::tf2_ros - ${trajectory_msgs_TARGETS} - ${visualization_msgs_TARGETS} - ${Boost_LIBRARIES} + PUBLIC + ${geometry_msgs_TARGETS} + ${graph_msgs_TARGETS} + moveit_core::moveit_robot_state + moveit_core::moveit_utils + ${moveit_msgs_TARGETS} + moveit_ros_planning::moveit_ros_planning + rclcpp::rclcpp + rviz_visual_tools::rviz_visual_tools + interactive_markers::interactive_markers + ${std_msgs_TARGETS} + tf2_eigen::tf2_eigen + tf2_ros::tf2_ros + ${trajectory_msgs_TARGETS} + ${visualization_msgs_TARGETS} + ${Boost_LIBRARIES} + # Implementation-only: included by src/moveit_visual_tools.cpp and absent from + # every public header, so it is kept out of the exported interface and out of + # THIS_PACKAGE_INCLUDE_DEPENDS. This is a SHARED library, so a PRIVATE link is + # not re-exported at all -- downstream consumers do not need geometric_shapes. + PRIVATE + geometric_shapes::geometric_shapes ) # Demo executable @@ -72,10 +84,12 @@ add_executable(${PROJECT_NAME}_demo ) target_link_libraries(${PROJECT_NAME}_demo ${PROJECT_NAME} + ament_index_cpp::ament_index_cpp ${geometry_msgs_TARGETS} ${graph_msgs_TARGETS} moveit_core::moveit_robot_state moveit_core::moveit_utils + ${moveit_msgs_TARGETS} moveit_ros_planning::moveit_ros_planning rclcpp::rclcpp rviz_visual_tools::rviz_visual_tools diff --git a/package.xml b/package.xml index 041af2f..a93c3fd 100644 --- a/package.xml +++ b/package.xml @@ -16,10 +16,13 @@ ament_cmake + ament_index_cpp + geometric_shapes geometry_msgs graph_msgs moveit_common moveit_core + moveit_msgs moveit_ros_planning rclcpp rviz_visual_tools From 79e7a34f9b0fb90d02dc792e48095893ca7438c0 Mon Sep 17 00:00:00 2001 From: Nathan Brooks Date: Sun, 2 Aug 2026 21:39:38 -0600 Subject: [PATCH 4/4] CMake: link the specific planning_scene_monitor target, not the umbrella moveit_ros_planning::moveit_ros_planning is an INTERFACE target added by moveit2#3726 (merged 2026-06-16). It exists only on moveit2 main -- every released MoveIt predates it, so linking it fails at configure time on all three distros this package ships to: CMake Error: Target "moveit_visual_tools" links to moveit_ros_planning::moveit_ros_planning but the target was not found. Verified against the released debs; the specific target is present everywhere, the umbrella nowhere: distro moveit_ros_planning ::moveit_planning_scene_monitor ::moveit_ros_planning humble 2.5.9 present absent jazzy 2.12.4 present absent kilted 2.14.3 present absent moveit2 main - present present It is also the accurate dependency rather than merely the portable one: planning_scene_monitor.hpp is the only moveit_ros_planning header this package includes, so the umbrella would over-link all 14 of that package's libraries. Co-Authored-By: Claude Opus 5 (1M context) --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b901c3..770a376 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,7 +60,7 @@ target_link_libraries(${PROJECT_NAME} moveit_core::moveit_robot_state moveit_core::moveit_utils ${moveit_msgs_TARGETS} - moveit_ros_planning::moveit_ros_planning + moveit_ros_planning::moveit_planning_scene_monitor rclcpp::rclcpp rviz_visual_tools::rviz_visual_tools interactive_markers::interactive_markers @@ -90,7 +90,7 @@ target_link_libraries(${PROJECT_NAME}_demo moveit_core::moveit_robot_state moveit_core::moveit_utils ${moveit_msgs_TARGETS} - moveit_ros_planning::moveit_ros_planning + moveit_ros_planning::moveit_planning_scene_monitor rclcpp::rclcpp rviz_visual_tools::rviz_visual_tools interactive_markers::interactive_markers