From 29bc545d934eab8a4e7e9832828e837d9ad1d245 Mon Sep 17 00:00:00 2001 From: SyZbidi <104774720+SyZbidi@users.noreply.github.com> Date: Wed, 6 Mar 2024 16:35:59 +0100 Subject: [PATCH] port to ROS2 (#5) fix ROS2 message type Make geometry_msgs findable by CMake update dependencies --- CMakeLists.txt | 80 +++++++------------------ action/FollowCartesianTrajectory.action | 4 +- msg/CartesianTrajectory.msg | 2 +- msg/CartesianTrajectoryPoint.msg | 2 +- package.xml | 21 +++---- 5 files changed, 36 insertions(+), 73 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69b8513..3ea78d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,64 +1,30 @@ -cmake_minimum_required(VERSION 3.0.2) +cmake_minimum_required(VERSION 3.8) project(cartesian_control_msgs) -## Compile as C++11, supported in ROS Kinetic and newer -# add_compile_options(-std=c++11) - -## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages -find_package(catkin REQUIRED COMPONENTS - actionlib_msgs - geometry_msgs - message_generation -) - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -add_message_files( - FILES - CartesianPosture.msg - CartesianTolerance.msg - CartesianTrajectory.msg - CartesianTrajectoryPoint.msg -) - -# add_service_files( -# FILES -# Service1.srv -# Service2.srv -# ) - -add_action_files( - FILES - FollowCartesianTrajectory.action -) - -## Generate added messages and services with any dependencies listed here -generate_messages( +if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-Wall -Wextra -Wpedantic) +endif() + +find_package(ament_cmake REQUIRED) +find_package(action_msgs REQUIRED) +find_package(builtin_interfaces REQUIRED) +find_package(geometry_msgs REQUIRED) +find_package(rosidl_default_generators REQUIRED) +find_package(std_msgs REQUIRED) + +rosidl_generate_interfaces(${PROJECT_NAME} + "action/FollowCartesianTrajectory.action" + "msg/CartesianPosture.msg" + "msg/CartesianTolerance.msg" + "msg/CartesianTrajectory.msg" + "msg/CartesianTrajectoryPoint.msg" DEPENDENCIES - actionlib_msgs + action_msgs + builtin_interfaces geometry_msgs + std_msgs ) +ament_export_dependencies(rosidl_default_runtime) -################################### -## catkin specific configuration ## -################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if your package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need -catkin_package( -# INCLUDE_DIRS include -# LIBRARIES cartesian_control_msgs - CATKIN_DEPENDS - actionlib_msgs - geometry_msgs - message_runtime -# DEPENDS system_lib -) +ament_package() diff --git a/action/FollowCartesianTrajectory.action b/action/FollowCartesianTrajectory.action index d21c773..26a572f 100644 --- a/action/FollowCartesianTrajectory.action +++ b/action/FollowCartesianTrajectory.action @@ -1,7 +1,7 @@ CartesianTrajectory trajectory CartesianTolerance path_tolerance CartesianTolerance goal_tolerance -duration goal_time_tolerance +builtin_interfaces/Duration goal_time_tolerance --- @@ -18,7 +18,7 @@ string error_string --- -Header header +std_msgs/Header header string tcp_frame CartesianTrajectoryPoint desired CartesianTrajectoryPoint actual diff --git a/msg/CartesianTrajectory.msg b/msg/CartesianTrajectory.msg index a5922de..3abcff5 100644 --- a/msg/CartesianTrajectory.msg +++ b/msg/CartesianTrajectory.msg @@ -1,4 +1,4 @@ # header.frame_id is the frame in which all data from CartesianTrajectoryPoint[] is given -Header header +std_msgs/Header header CartesianTrajectoryPoint[] points string controlled_frame diff --git a/msg/CartesianTrajectoryPoint.msg b/msg/CartesianTrajectoryPoint.msg index 1509626..ea40ea7 100644 --- a/msg/CartesianTrajectoryPoint.msg +++ b/msg/CartesianTrajectoryPoint.msg @@ -1,4 +1,4 @@ -duration time_from_start +builtin_interfaces/Duration time_from_start geometry_msgs/Pose pose geometry_msgs/Twist twist geometry_msgs/Accel acceleration diff --git a/package.xml b/package.xml index e8a1856..6802026 100644 --- a/package.xml +++ b/package.xml @@ -1,5 +1,5 @@ - + cartesian_control_msgs 0.1.0 Cartesian trajectory execution interface. @@ -13,19 +13,16 @@ Felix Exner - - catkin - - message_generation - message_runtime - - actionlib_msgs + ament_cmake + rosidl_default_generators + action_msgs + builtin_interfaces geometry_msgs + std_msgs + rosidl_default_runtime - - + rosidl_interface_packages - - + ament_cmake