43 #include <moveit_msgs/msg/robot_trajectory.hpp>
44 #include <moveit_msgs/msg/robot_state.hpp>
45 #include <moveit_msgs/msg/planner_interface_description.hpp>
46 #include <moveit_msgs/msg/constraints.hpp>
47 #include <moveit_msgs/msg/grasp.hpp>
48 #include <moveit_msgs/action/move_group.hpp>
49 #include <moveit_msgs/action/execute_trajectory.hpp>
50 #include <rclcpp/logger.hpp>
52 #include <moveit_msgs/msg/motion_plan_request.hpp>
53 #include <geometry_msgs/msg/pose_stamped.hpp>
55 #include <rclcpp_action/rclcpp_action.hpp>
59 #include <tf2_ros/buffer.h>
61 #include <moveit_move_group_interface_export.h>
84 Options(std::string group_name, std::string desc = ROBOT_DESCRIPTION, std::string move_group_namespace =
"")
85 : group_name(std::move(group_name))
86 , robot_description(std::move(desc))
87 , move_group_namespace(std::move(move_group_namespace))
130 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>(),
131 const rclcpp::Duration& wait_for_servers = rclcpp::Duration::from_seconds(-1));
141 const std::shared_ptr<tf2_ros::Buffer>& tf_buffer = std::shared_ptr<tf2_ros::Buffer>(),
142 const rclcpp::Duration& wait_for_servers = rclcpp::Duration::from_seconds(-1));
157 const std::string& getName()
const;
161 const std::vector<std::string>& getNamedTargets()
const;
164 moveit::core::RobotModelConstPtr getRobotModel()
const;
170 const std::string& getPlanningFrame()
const;
173 const std::vector<std::string>& getJointModelGroupNames()
const;
176 const std::vector<std::string>& getJointNames()
const;
179 const std::vector<std::string>& getLinkNames()
const;
182 std::map<std::string, double> getNamedTargetValues(
const std::string&
name)
const;
185 const std::vector<std::string>& getActiveJoints()
const;
188 const std::vector<std::string>& getJoints()
const;
192 unsigned int getVariableCount()
const;
195 bool getInterfaceDescriptions(std::vector<moveit_msgs::msg::PlannerInterfaceDescription>& desc)
const;
198 bool getInterfaceDescription(moveit_msgs::msg::PlannerInterfaceDescription& desc)
const;
201 std::map<std::string, std::string> getPlannerParams(
const std::string& planner_id,
202 const std::string& group =
"")
const;
205 void setPlannerParams(
const std::string& planner_id,
const std::string& group,
206 const std::map<std::string, std::string>& params,
bool bReplace =
false);
208 std::string getDefaultPlanningPipelineId()
const;
211 void setPlanningPipelineId(
const std::string& pipeline_id);
214 const std::string& getPlanningPipelineId()
const;
217 std::string getDefaultPlannerId(
const std::string& group =
"")
const;
220 void setPlannerId(
const std::string& planner_id);
223 const std::string& getPlannerId()
const;
226 void setPlanningTime(
double seconds);
230 void setNumPlanningAttempts(
unsigned int num_planning_attempts);
237 void setMaxVelocityScalingFactor(
double max_velocity_scaling_factor);
244 void setMaxAccelerationScalingFactor(
double max_acceleration_scaling_factor);
247 double getPlanningTime()
const;
251 double getGoalJointTolerance()
const;
255 double getGoalPositionTolerance()
const;
259 double getGoalOrientationTolerance()
const;
267 void setGoalTolerance(
double tolerance);
271 void setGoalJointTolerance(
double tolerance);
274 void setGoalPositionTolerance(
double tolerance);
277 void setGoalOrientationTolerance(
double tolerance);
283 void setWorkspace(
double minx,
double miny,
double minz,
double maxx,
double maxy,
double maxz);
287 void setStartState(
const moveit_msgs::msg::RobotState& start_state);
294 void setStartStateToCurrentState();
298 void setSupportSurfaceName(
const std::string&
name);
329 bool setJointValueTarget(
const std::vector<double>& group_variable_values);
346 bool setJointValueTarget(
const std::map<std::string, double>& variable_values);
363 bool setJointValueTarget(
const std::vector<std::string>& variable_names,
const std::vector<double>& variable_values);
387 bool setJointValueTarget(
const std::string& joint_name,
const std::vector<double>& values);
400 bool setJointValueTarget(
const std::string& joint_name,
double value);
412 bool setJointValueTarget(
const sensor_msgs::msg::JointState& state);
425 bool setJointValueTarget(
const geometry_msgs::msg::Pose& eef_pose,
const std::string& end_effector_link =
"");
438 bool setJointValueTarget(
const geometry_msgs::msg::PoseStamped& eef_pose,
const std::string& end_effector_link =
"");
451 bool setJointValueTarget(
const Eigen::Isometry3d& eef_pose,
const std::string& end_effector_link =
"");
463 bool setApproximateJointValueTarget(
const geometry_msgs::msg::Pose& eef_pose,
464 const std::string& end_effector_link =
"");
476 bool setApproximateJointValueTarget(
const geometry_msgs::msg::PoseStamped& eef_pose,
477 const std::string& end_effector_link =
"");
489 bool setApproximateJointValueTarget(
const Eigen::Isometry3d& eef_pose,
const std::string& end_effector_link =
"");
495 void setRandomTarget();
499 bool setNamedTarget(
const std::string&
name);
502 void getJointValueTarget(std::vector<double>& group_variable_values)
const;
525 bool setPositionTarget(
double x,
double y,
double z,
const std::string& end_effector_link =
"");
534 bool setRPYTarget(
double roll,
double pitch,
double yaw,
const std::string& end_effector_link =
"");
544 bool setOrientationTarget(
double x,
double y,
double z,
double w,
const std::string& end_effector_link =
"");
553 bool setPoseTarget(
const Eigen::Isometry3d& end_effector_pose,
const std::string& end_effector_link =
"");
562 bool setPoseTarget(
const geometry_msgs::msg::Pose& target,
const std::string& end_effector_link =
"");
571 bool setPoseTarget(
const geometry_msgs::msg::PoseStamped& target,
const std::string& end_effector_link =
"");
591 bool setPoseTargets(
const EigenSTL::vector_Isometry3d& end_effector_pose,
const std::string& end_effector_link =
"");
611 bool setPoseTargets(
const std::vector<geometry_msgs::msg::Pose>& target,
const std::string& end_effector_link =
"");
631 bool setPoseTargets(
const std::vector<geometry_msgs::msg::PoseStamped>& target,
632 const std::string& end_effector_link =
"");
635 void setPoseReferenceFrame(
const std::string& pose_reference_frame);
640 bool setEndEffectorLink(
const std::string& end_effector_link);
644 bool setEndEffector(
const std::string& eef_name);
647 void clearPoseTarget(
const std::string& end_effector_link =
"");
650 void clearPoseTargets();
658 const geometry_msgs::msg::PoseStamped& getPoseTarget(
const std::string& end_effector_link =
"")
const;
665 const std::vector<geometry_msgs::msg::PoseStamped>& getPoseTargets(
const std::string& end_effector_link =
"")
const;
672 const std::string& getEndEffectorLink()
const;
679 const std::string& getEndEffector()
const;
683 const std::string& getPoseReferenceFrame()
const;
701 rclcpp_action::Client<moveit_msgs::action::MoveGroup>& getMoveGroupClient()
const;
721 const std::vector<std::string>& controllers = std::vector<std::string>());
730 const std::vector<std::string>& controllers = std::vector<std::string>());
739 const std::vector<std::string>& controllers = std::vector<std::string>());
748 const std::vector<std::string>& controllers = std::vector<std::string>());
759 double computeCartesianPath(
const std::vector<geometry_msgs::msg::Pose>& waypoints,
double eef_step,
760 double jump_threshold, moveit_msgs::msg::RobotTrajectory& trajectory,
761 bool avoid_collisions =
true, moveit_msgs::msg::MoveItErrorCodes* error_code =
nullptr);
775 double computeCartesianPath(
const std::vector<geometry_msgs::msg::Pose>& waypoints,
double eef_step,
776 double jump_threshold, moveit_msgs::msg::RobotTrajectory& trajectory,
777 const moveit_msgs::msg::Constraints& path_constraints,
bool avoid_collisions =
true,
778 moveit_msgs::msg::MoveItErrorCodes* error_code =
nullptr);
784 void allowReplanning(
bool flag);
787 void setReplanAttempts(int32_t attempts);
790 void setReplanDelay(
double delay);
794 void allowLooking(
bool flag);
797 void setLookAroundAttempts(int32_t attempts);
816 bool attachObject(
const std::string&
object,
const std::string& link =
"");
826 bool attachObject(
const std::string&
object,
const std::string& link,
const std::vector<std::string>& touch_links);
833 bool detachObject(
const std::string&
name =
"");
847 bool startStateMonitor(
double wait = 1.0);
850 std::vector<double> getCurrentJointValues()
const;
853 moveit::core::RobotStatePtr getCurrentState(
double wait = 1)
const;
858 geometry_msgs::msg::PoseStamped getCurrentPose(
const std::string& end_effector_link =
"")
const;
863 std::vector<double> getCurrentRPY(
const std::string& end_effector_link =
"")
const;
866 std::vector<double> getRandomJointValues()
const;
871 geometry_msgs::msg::PoseStamped getRandomPose(
const std::string& end_effector_link =
"")
const;
884 void rememberJointValues(
const std::string&
name);
890 void rememberJointValues(
const std::string&
name,
const std::vector<double>& values);
895 return remembered_joint_values_;
899 void forgetJointValues(
const std::string&
name);
909 void setConstraintsDatabase(
const std::string& host,
unsigned int port);
912 std::vector<std::string> getKnownConstraints()
const;
917 moveit_msgs::msg::Constraints getPathConstraints()
const;
922 bool setPathConstraints(
const std::string& constraint);
927 void setPathConstraints(
const moveit_msgs::msg::Constraints& constraint);
931 void clearPathConstraints();
933 moveit_msgs::msg::TrajectoryConstraints getTrajectoryConstraints()
const;
934 void setTrajectoryConstraints(
const moveit_msgs::msg::TrajectoryConstraints& constraint);
935 void clearTrajectoryConstraints();
944 std::map<std::string, std::vector<double> > remembered_joint_values_;
945 class MoveGroupInterfaceImpl;
946 MoveGroupInterfaceImpl* impl_;
947 rclcpp::Logger logger_;
a wrapper around moveit_msgs::MoveItErrorCodes to make it easier to return an error code message from...
Representation of a robot's state. This includes position, velocity, acceleration and effort.
Client class to conveniently use the ROS interfaces provided by the move_group node.
static const std::string ROBOT_DESCRIPTION
Default ROS parameter name from where to read the robot's URDF. Set to 'robot_description'.
MOVEIT_STRUCT_FORWARD(Plan)
MoveGroupInterface(const MoveGroupInterface &)=delete
This class owns unique resources (e.g. action clients, threads) and its not very meaningful to copy....
MoveGroupInterface & operator=(const MoveGroupInterface &)=delete
const std::map< std::string, std::vector< double > > & getRememberedJointValues() const
Get the currently remembered map of names to joint values.
rclcpp::Node::SharedPtr getNodeHandle()
Get the ROS node handle of this instance operates on.
MOVEIT_CLASS_FORWARD(MoveGroupInterface)
bool setStartState(std::shared_ptr< moveit_cpp::PlanningComponent > &planning_component, std::optional< std::string > configuration_name, std::optional< moveit::core::RobotState > robot_state)
planning_interface::MotionPlanResponse plan(std::shared_ptr< moveit_cpp::PlanningComponent > &planning_component, std::shared_ptr< moveit_cpp::PlanningComponent::PlanRequestParameters > &single_plan_parameters, std::shared_ptr< moveit_cpp::PlanningComponent::MultiPipelinePlanRequestParameters > &multi_plan_parameters, std::shared_ptr< planning_scene::PlanningScene > &planning_scene, std::optional< const moveit::planning_pipeline_interfaces::SolutionSelectionFunction > solution_selection_function, std::optional< moveit::planning_pipeline_interfaces::StoppingCriterionFunction > stopping_criterion_callback)
Main namespace for MoveIt.
This namespace includes the base class for MoveIt planners.
moveit_msgs::msg::MotionPlanRequest MotionPlanRequest
Specification of options to use when constructing the MoveGroupInterface class.
std::string move_group_namespace
The namespace for the move group node.
Options(std::string group_name, std::string desc=ROBOT_DESCRIPTION, std::string move_group_namespace="")
std::string robot_description
The robot description parameter name (if different from default)
moveit::core::RobotModelConstPtr robot_model
Optionally, an instance of the RobotModel to use can be also specified.
std::string group_name
The group to construct the class instance for.
The representation of a motion plan (as ROS messasges)
moveit_msgs::msg::RobotTrajectory trajectory
The trajectory of the robot (may not contain joints that are the same as for the start_state_)
double planning_time
The amount of time it took to generate the plan.
moveit_msgs::msg::RobotState start_state
The full starting state used for planning.