Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ 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)
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)
Expand All @@ -26,9 +30,11 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS
geometry_msgs
graph_msgs
moveit_core
moveit_msgs
moveit_ros_planning
rclcpp
rviz_visual_tools
interactive_markers
std_msgs
tf2_eigen
tf2_ros
Expand All @@ -47,16 +53,54 @@ target_include_directories(${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PUBLIC $<INSTALL_INTERFACE:include>
)
ament_target_dependencies(${PROJECT_NAME} ${THIS_PACKAGE_INCLUDE_DEPENDS})
target_link_libraries(${PROJECT_NAME}
PUBLIC
${geometry_msgs_TARGETS}
${graph_msgs_TARGETS}
moveit_core::moveit_robot_state
moveit_core::moveit_utils
${moveit_msgs_TARGETS}
moveit_ros_planning::moveit_planning_scene_monitor
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
add_executable(${PROJECT_NAME}_demo
src/${PROJECT_NAME}_demo.cpp
)
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_planning_scene_monitor
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
Expand Down
4 changes: 4 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>ament_index_cpp</depend>
<depend>geometric_shapes</depend>
<depend>geometry_msgs</depend>
<depend>graph_msgs</depend>
<depend>moveit_common</depend>
<depend>moveit_core</depend>
<depend>moveit_msgs</depend>
<depend>moveit_ros_planning</depend>
<depend>rclcpp</depend>
<depend>rviz_visual_tools</depend>
<depend>interactive_markers</depend>
<depend>std_msgs</depend>
<depend>tf2_eigen</depend>
<depend>tf2_ros</depend>
Expand Down
12 changes: 11 additions & 1 deletion src/moveit_visual_tools_demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,13 @@

// ROS
#include <rclcpp/rclcpp.hpp>
#include <ament_index_cpp/version.h>
#if AMENT_INDEX_CPP_VERSION_GTE(1, 14, 0)
#include <ament_index_cpp/get_package_share_path.hpp>
#include <filesystem>
#else
#include <ament_index_cpp/get_package_share_directory.hpp>
#endif

// For visualizing things in rviz
#include <moveit_visual_tools/moveit_visual_tools.h>
Expand Down Expand Up @@ -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");
Expand Down
Loading