diff --git a/moveit_ros/planning/moveit_cpp/include/moveit/moveit_cpp/moveit_cpp.h b/moveit_ros/planning/moveit_cpp/include/moveit/moveit_cpp/moveit_cpp.h index bff2bed980..68db705ba2 100644 --- a/moveit_ros/planning/moveit_cpp/include/moveit/moveit_cpp/moveit_cpp.h +++ b/moveit_ros/planning/moveit_cpp/include/moveit/moveit_cpp/moveit_cpp.h @@ -40,6 +40,7 @@ #pragma once #include +#include #include #include #include @@ -167,8 +168,9 @@ class MoveItCpp /** \brief Execute a trajectory on the planning group specified by group_name using the trajectory execution manager. * If blocking is set to false, the execution is run in background and the function returns immediately. */ - bool execute(const std::string& group_name, const robot_trajectory::RobotTrajectoryPtr& robot_trajectory, - bool blocking = true); + moveit_controller_manager::ExecutionStatus execute(const std::string& group_name, + const robot_trajectory::RobotTrajectoryPtr& robot_trajectory, + bool blocking = true); private: // Core properties and instances diff --git a/moveit_ros/planning/moveit_cpp/src/moveit_cpp.cpp b/moveit_ros/planning/moveit_cpp/src/moveit_cpp.cpp index 609eddcaee..7780373d8c 100644 --- a/moveit_ros/planning/moveit_cpp/src/moveit_cpp.cpp +++ b/moveit_ros/planning/moveit_cpp/src/moveit_cpp.cpp @@ -35,6 +35,8 @@ /* Author: Henning Kayser */ #include + +#include #include #if __has_include() #include @@ -247,20 +249,21 @@ trajectory_execution_manager::TrajectoryExecutionManagerPtr MoveItCpp::getTrajec return trajectory_execution_manager_; } -bool MoveItCpp::execute(const std::string& group_name, const robot_trajectory::RobotTrajectoryPtr& robot_trajectory, - bool blocking) +moveit_controller_manager::ExecutionStatus +MoveItCpp::execute(const std::string& group_name, const robot_trajectory::RobotTrajectoryPtr& robot_trajectory, + bool blocking) { if (!robot_trajectory) { RCLCPP_ERROR(LOGGER, "Robot trajectory is undefined"); - return false; + return moveit_controller_manager::ExecutionStatus::ABORTED; } // Check if there are controllers that can handle the execution if (!trajectory_execution_manager_->ensureActiveControllersForGroup(group_name)) { RCLCPP_ERROR(LOGGER, "Execution failed! No active controllers configured for group '%s'", group_name.c_str()); - return false; + return moveit_controller_manager::ExecutionStatus::ABORTED; } // Execute trajectory @@ -273,7 +276,7 @@ bool MoveItCpp::execute(const std::string& group_name, const robot_trajectory::R return trajectory_execution_manager_->waitForExecution(); } trajectory_execution_manager_->pushAndExecute(robot_trajectory_msg); - return true; + return moveit_controller_manager::ExecutionStatus::RUNNING; } const std::shared_ptr& MoveItCpp::getTFBuffer() const