move_group_interface.cpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2014, SRI International
5  * Copyright (c) 2013, Ioan A. Sucan
6  * Copyright (c) 2012, Willow Garage, Inc.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *********************************************************************/
36 
37 /* Author: Ioan Sucan, Sachin Chitta */
38 
39 #include <stdexcept>
40 #include <sstream>
41 #include <memory>
53 #include <moveit_msgs/PickupAction.h>
54 #include <moveit_msgs/ExecuteTrajectoryAction.h>
55 #include <moveit_msgs/PlaceAction.h>
56 #include <moveit_msgs/ExecuteKnownTrajectory.h>
57 #include <moveit_msgs/QueryPlannerInterfaces.h>
58 #include <moveit_msgs/GetCartesianPath.h>
59 #include <moveit_msgs/GraspPlanning.h>
60 #include <moveit_msgs/GetPlannerParams.h>
61 #include <moveit_msgs/SetPlannerParams.h>
62 
63 #include <std_msgs/String.h>
64 #include <geometry_msgs/TransformStamped.h>
65 #include <tf2/utils.h>
66 #include <tf2_eigen/tf2_eigen.h>
68 #include <ros/console.h>
69 #include <ros/ros.h>
70 
71 namespace moveit
72 {
73 namespace planning_interface
74 {
75 const std::string MoveGroupInterface::ROBOT_DESCRIPTION =
76  "robot_description"; // name of the robot description (a param name, so it can be changed externally)
77 
78 const std::string GRASP_PLANNING_SERVICE_NAME = "plan_grasps"; // name of the service that can be used to plan grasps
79 
80 const std::string LOGNAME = "move_group_interface";
81 
82 namespace
83 {
84 enum ActiveTargetType
85 {
86  JOINT,
87  POSE,
88  POSITION,
89  ORIENTATION
90 };
91 }
92 
93 class MoveGroupInterface::MoveGroupInterfaceImpl
94 {
95  friend MoveGroupInterface;
96 
97 public:
98  MoveGroupInterfaceImpl(const Options& opt, const std::shared_ptr<tf2_ros::Buffer>& tf_buffer,
99  const ros::WallDuration& wait_for_servers)
101  {
102  robot_model_ = opt.robot_model_ ? opt.robot_model_ : getSharedRobotModel(opt.robot_description_);
103  if (!getRobotModel())
104  {
105  std::string error = "Unable to construct robot model. Please make sure all needed information is on the "
106  "parameter server.";
108  throw std::runtime_error(error);
109  }
110 
111  if (!getRobotModel()->hasJointModelGroup(opt.group_name_))
112  {
113  std::string error = "Group '" + opt.group_name_ + "' was not found.";
115  throw std::runtime_error(error);
116  }
117 
118  joint_model_group_ = getRobotModel()->getJointModelGroup(opt.group_name_);
119 
121  joint_state_target_ = std::make_shared<moveit::core::RobotState>(getRobotModel());
122  joint_state_target_->setToDefaultValues();
123  active_target_ = JOINT;
124  can_look_ = false;
126  can_replan_ = false;
127  replan_delay_ = 2.0;
128  replan_attempts_ = 1;
131  max_cartesian_speed_ = 0.0;
132 
133  std::string desc = opt.robot_description_.length() ? opt.robot_description_ : ROBOT_DESCRIPTION;
134 
135  std::string kinematics_desc = desc + "_kinematics/";
136  node_handle_.param<double>(kinematics_desc + opt.group_name_ + "/goal_joint_tolerance", goal_joint_tolerance_,
138  node_handle_.param<double>(kinematics_desc + opt.group_name_ + "/goal_position_tolerance", goal_position_tolerance_,
140  node_handle_.param<double>(kinematics_desc + opt.group_name_ + "/goal_orientation_tolerance",
142 
143  std::string planning_desc = desc + "_planning/";
144  node_handle_.param<double>(planning_desc + "default_velocity_scaling_factor", max_velocity_scaling_factor_, 0.1);
145  node_handle_.param<double>(planning_desc + "default_acceleration_scaling_factor", max_acceleration_scaling_factor_,
146  0.1);
148 
151  pose_reference_frame_ = getRobotModel()->getModelFrame();
152 
155  attached_object_publisher_ = node_handle_.advertise<moveit_msgs::AttachedCollisionObject>(
157 
159 
160  ros::WallTime timeout_for_servers = ros::WallTime::now() + wait_for_servers;
161  if (wait_for_servers == ros::WallDuration())
162  timeout_for_servers = ros::WallTime(); // wait for ever
163  double allotted_time = wait_for_servers.toSec();
164 
165  move_action_client_ = std::make_unique<actionlib::SimpleActionClient<moveit_msgs::MoveGroupAction>>(
167  waitForAction(move_action_client_, move_group::MOVE_ACTION, timeout_for_servers, allotted_time);
168 
169  pick_action_client_ = std::make_unique<actionlib::SimpleActionClient<moveit_msgs::PickupAction>>(
171  waitForAction(pick_action_client_, move_group::PICKUP_ACTION, timeout_for_servers, allotted_time);
172 
173  place_action_client_ = std::make_unique<actionlib::SimpleActionClient<moveit_msgs::PlaceAction>>(
175  waitForAction(place_action_client_, move_group::PLACE_ACTION, timeout_for_servers, allotted_time);
176 
177  execute_action_client_ = std::make_unique<actionlib::SimpleActionClient<moveit_msgs::ExecuteTrajectoryAction>>(
179  waitForAction(execute_action_client_, move_group::EXECUTE_ACTION_NAME, timeout_for_servers, allotted_time);
180 
182  node_handle_.serviceClient<moveit_msgs::QueryPlannerInterfaces>(move_group::QUERY_PLANNERS_SERVICE_NAME);
187 
190 
192 
193  ROS_INFO_STREAM_NAMED(LOGNAME, "Ready to take commands for planning group " << opt.group_name_ << ".");
194  }
195 
196  template <typename T>
197  void waitForAction(const T& action, const std::string& name, const ros::WallTime& timeout, double allotted_time) const
198  {
199  ROS_DEBUG_NAMED(LOGNAME, "Waiting for move_group action server (%s)...", name.c_str());
200 
201  // wait for the server (and spin as needed)
202  if (timeout == ros::WallTime()) // wait forever
203  {
204  while (node_handle_.ok() && !action->isServerConnected())
205  {
206  ros::WallDuration(0.001).sleep();
207  // explicit ros::spinOnce on the callback queue used by NodeHandle that manages the action client
209  if (queue)
210  {
211  queue->callAvailable();
212  }
213  else // in case of nodelets and specific callback queue implementations
214  {
215  ROS_WARN_ONCE_NAMED(LOGNAME, "Non-default CallbackQueue: Waiting for external queue "
216  "handling.");
217  }
218  }
219  }
220  else // wait with timeout
221  {
222  while (node_handle_.ok() && !action->isServerConnected() && timeout > ros::WallTime::now())
223  {
224  ros::WallDuration(0.001).sleep();
225  // explicit ros::spinOnce on the callback queue used by NodeHandle that manages the action client
227  if (queue)
228  {
229  queue->callAvailable();
230  }
231  else // in case of nodelets and specific callback queue implementations
232  {
233  ROS_WARN_ONCE_NAMED(LOGNAME, "Non-default CallbackQueue: Waiting for external queue "
234  "handling.");
235  }
236  }
237  }
238 
239  if (!action->isServerConnected())
240  {
241  std::stringstream error;
242  error << "Unable to connect to move_group action server '" << name << "' within allotted time (" << allotted_time
243  << "s)";
244  throw std::runtime_error(error.str());
245  }
246  else
247  {
248  ROS_DEBUG_NAMED(LOGNAME, "Connected to '%s'", name.c_str());
249  }
250  }
251 
253  {
255  constraints_init_thread_->join();
256  }
257 
258  const std::shared_ptr<tf2_ros::Buffer>& getTF() const
259  {
260  return tf_buffer_;
261  }
262 
263  const Options& getOptions() const
264  {
265  return opt_;
266  }
267 
268  const moveit::core::RobotModelConstPtr& getRobotModel() const
269  {
270  return robot_model_;
271  }
272 
274  {
275  return joint_model_group_;
276  }
277 
279  {
280  return *move_action_client_;
281  }
282 
283  bool getInterfaceDescription(moveit_msgs::PlannerInterfaceDescription& desc)
284  {
285  moveit_msgs::QueryPlannerInterfaces::Request req;
286  moveit_msgs::QueryPlannerInterfaces::Response res;
287  if (query_service_.call(req, res))
288  if (!res.planner_interfaces.empty())
289  {
290  desc = res.planner_interfaces.front();
291  return true;
292  }
293  return false;
294  }
295 
296  bool getInterfaceDescriptions(std::vector<moveit_msgs::PlannerInterfaceDescription>& desc)
297  {
298  moveit_msgs::QueryPlannerInterfaces::Request req;
299  moveit_msgs::QueryPlannerInterfaces::Response res;
300  if (query_service_.call(req, res))
301  if (!res.planner_interfaces.empty())
302  {
303  desc = res.planner_interfaces;
304  return true;
305  }
306  return false;
307  }
308 
309  std::map<std::string, std::string> getPlannerParams(const std::string& planner_id, const std::string& group = "")
310  {
311  moveit_msgs::GetPlannerParams::Request req;
312  moveit_msgs::GetPlannerParams::Response res;
313  req.planner_config = planner_id;
314  req.group = group;
315  std::map<std::string, std::string> result;
316  if (get_params_service_.call(req, res))
317  {
318  for (unsigned int i = 0, end = res.params.keys.size(); i < end; ++i)
319  result[res.params.keys[i]] = res.params.values[i];
320  }
321  return result;
322  }
323 
324  void setPlannerParams(const std::string& planner_id, const std::string& group,
325  const std::map<std::string, std::string>& params, bool replace = false)
326  {
327  moveit_msgs::SetPlannerParams::Request req;
328  moveit_msgs::SetPlannerParams::Response res;
329  req.planner_config = planner_id;
330  req.group = group;
331  req.replace = replace;
332  for (const std::pair<const std::string, std::string>& param : params)
333  {
334  req.params.keys.push_back(param.first);
335  req.params.values.push_back(param.second);
336  }
337  set_params_service_.call(req, res);
338  }
339 
340  std::string getDefaultPlanningPipelineId() const
341  {
342  std::string default_planning_pipeline;
343  node_handle_.getParam("move_group/default_planning_pipeline", default_planning_pipeline);
344  return default_planning_pipeline;
345  }
346 
347  void setPlanningPipelineId(const std::string& pipeline_id)
348  {
349  if (pipeline_id != planning_pipeline_id_)
350  {
351  planning_pipeline_id_ = pipeline_id;
352 
353  // Reset planner_id if planning pipeline changed
354  planner_id_ = "";
355  }
356  }
357 
358  const std::string& getPlanningPipelineId() const
359  {
360  return planning_pipeline_id_;
361  }
362 
363  std::string getDefaultPlannerId(const std::string& group) const
364  {
365  // Check what planning pipeline config should be used
366  std::string pipeline_id = getDefaultPlanningPipelineId();
367  if (!planning_pipeline_id_.empty())
368  pipeline_id = planning_pipeline_id_;
369 
370  std::stringstream param_name;
371  param_name << "move_group";
372  if (!pipeline_id.empty())
373  param_name << "/planning_pipelines/" << pipeline_id;
374  if (!group.empty())
375  param_name << "/" << group;
376  param_name << "/default_planner_config";
377 
378  std::string default_planner_config;
379  node_handle_.getParam(param_name.str(), default_planner_config);
380  return default_planner_config;
381  }
382 
383  void setPlannerId(const std::string& planner_id)
384  {
385  planner_id_ = planner_id;
386  }
387 
388  const std::string& getPlannerId() const
389  {
390  return planner_id_;
391  }
392 
393  void setNumPlanningAttempts(unsigned int num_planning_attempts)
394  {
395  num_planning_attempts_ = num_planning_attempts;
396  }
397 
398  void setMaxVelocityScalingFactor(double value)
399  {
400  setMaxScalingFactor(max_velocity_scaling_factor_, value, "velocity_scaling_factor", 0.1);
401  }
402 
403  void setMaxAccelerationScalingFactor(double value)
404  {
405  setMaxScalingFactor(max_acceleration_scaling_factor_, value, "acceleration_scaling_factor", 0.1);
406  }
407 
408  void setMaxScalingFactor(double& variable, const double target_value, const char* factor_name, double fallback_value)
409  {
410  if (target_value > 1.0)
411  {
412  ROS_WARN_NAMED(LOGNAME, "Limiting max_%s (%.2f) to 1.0.", factor_name, target_value);
413  variable = 1.0;
414  }
415  else if (target_value <= 0.0)
416  {
417  node_handle_.param<double>(std::string("robot_description_planning/default_") + factor_name, variable,
418  fallback_value);
419  if (target_value < 0.0)
420  {
421  ROS_WARN_NAMED(LOGNAME, "max_%s < 0.0! Setting to default: %.2f.", factor_name, variable);
422  }
423  }
424  else
425  {
426  variable = target_value;
427  }
428  }
429 
430  void limitMaxCartesianLinkSpeed(const double max_speed, const std::string& link_name)
431  {
432  cartesian_speed_limited_link_ = link_name;
433  max_cartesian_speed_ = max_speed;
434  }
435 
437  {
439  max_cartesian_speed_ = 0.0;
440  }
441 
443  {
444  return *joint_state_target_;
445  }
446 
448  {
449  return *joint_state_target_;
450  }
451 
452  void setStartState(const moveit_msgs::RobotState& start_state)
453  {
454  considered_start_state_ = start_state;
455  }
456 
457  void setStartState(const moveit::core::RobotState& start_state)
458  {
459  considered_start_state_ = moveit_msgs::RobotState();
461  }
462 
464  {
465  // set message to empty diff
466  considered_start_state_ = moveit_msgs::RobotState();
467  considered_start_state_.is_diff = true;
468  }
469 
470  moveit::core::RobotStatePtr getStartState()
471  {
472  moveit::core::RobotStatePtr s;
475  return s;
476  }
477 
478  bool setJointValueTarget(const geometry_msgs::Pose& eef_pose, const std::string& end_effector_link,
479  const std::string& frame, bool approx)
480  {
481  const std::string& eef = end_effector_link.empty() ? getEndEffectorLink() : end_effector_link;
482  // this only works if we have an end-effector
483  if (!eef.empty())
484  {
485  // first we set the goal to be the same as the start state
486  moveit::core::RobotStatePtr c = getStartState();
487  if (c)
488  {
489  setTargetType(JOINT);
490  c->enforceBounds();
491  getTargetRobotState() = *c;
492  if (!getTargetRobotState().satisfiesBounds(getGoalJointTolerance()))
493  return false;
494  }
495  else
496  return false;
497 
498  // we may need to do approximate IK
501 
502  // if no frame transforms are needed, call IK directly
503  if (frame.empty() || moveit::core::Transforms::sameFrame(frame, getRobotModel()->getModelFrame()))
504  return getTargetRobotState().setFromIK(getJointModelGroup(), eef_pose, eef, 0.0,
506  else
507  {
508  // transform the pose into the model frame, then do IK
509  bool frame_found;
510  const Eigen::Isometry3d& t = getTargetRobotState().getFrameTransform(frame, &frame_found);
511  if (frame_found)
512  {
513  Eigen::Isometry3d p;
514  tf2::fromMsg(eef_pose, p);
515  return getTargetRobotState().setFromIK(getJointModelGroup(), t * p, eef, 0.0,
517  }
518  else
519  {
520  ROS_ERROR_NAMED(LOGNAME, "Unable to transform from frame '%s' to frame '%s'", frame.c_str(),
521  getRobotModel()->getModelFrame().c_str());
522  return false;
523  }
524  }
525  }
526  else
527  return false;
528  }
529 
530  void setEndEffectorLink(const std::string& end_effector)
531  {
532  end_effector_link_ = end_effector;
533  }
534 
535  void clearPoseTarget(const std::string& end_effector_link)
536  {
537  pose_targets_.erase(end_effector_link);
538  }
539 
540  void clearPoseTargets()
541  {
542  pose_targets_.clear();
543  }
544 
545  const std::string& getEndEffectorLink() const
546  {
547  return end_effector_link_;
548  }
549 
550  const std::string& getEndEffector() const
551  {
552  if (!end_effector_link_.empty())
553  {
554  const std::vector<std::string>& possible_eefs =
555  getRobotModel()->getJointModelGroup(opt_.group_name_)->getAttachedEndEffectorNames();
556  for (const std::string& possible_eef : possible_eefs)
557  if (getRobotModel()->getEndEffector(possible_eef)->hasLinkModel(end_effector_link_))
558  return possible_eef;
559  }
560  static std::string empty;
561  return empty;
562  }
563 
564  bool setPoseTargets(const std::vector<geometry_msgs::PoseStamped>& poses, const std::string& end_effector_link)
565  {
566  const std::string& eef = end_effector_link.empty() ? end_effector_link_ : end_effector_link;
567  if (eef.empty())
568  {
569  ROS_ERROR_NAMED(LOGNAME, "No end-effector to set the pose for");
570  return false;
571  }
572  else
573  {
574  pose_targets_[eef] = poses;
575  // make sure we don't store an actual stamp, since that will become stale can potentially cause tf errors
576  std::vector<geometry_msgs::PoseStamped>& stored_poses = pose_targets_[eef];
577  for (geometry_msgs::PoseStamped& stored_pose : stored_poses)
578  stored_pose.header.stamp = ros::Time(0);
579  }
580  return true;
581  }
582 
583  bool hasPoseTarget(const std::string& end_effector_link) const
584  {
585  const std::string& eef = end_effector_link.empty() ? end_effector_link_ : end_effector_link;
586  return pose_targets_.find(eef) != pose_targets_.end();
587  }
588 
589  const geometry_msgs::PoseStamped& getPoseTarget(const std::string& end_effector_link) const
590  {
591  const std::string& eef = end_effector_link.empty() ? end_effector_link_ : end_effector_link;
592 
593  // if multiple pose targets are set, return the first one
594  std::map<std::string, std::vector<geometry_msgs::PoseStamped>>::const_iterator jt = pose_targets_.find(eef);
595  if (jt != pose_targets_.end())
596  if (!jt->second.empty())
597  return jt->second.at(0);
598 
599  // or return an error
600  static const geometry_msgs::PoseStamped UNKNOWN;
601  ROS_ERROR_NAMED(LOGNAME, "Pose for end-effector '%s' not known.", eef.c_str());
602  return UNKNOWN;
603  }
604 
605  const std::vector<geometry_msgs::PoseStamped>& getPoseTargets(const std::string& end_effector_link) const
606  {
607  const std::string& eef = end_effector_link.empty() ? end_effector_link_ : end_effector_link;
608 
609  std::map<std::string, std::vector<geometry_msgs::PoseStamped>>::const_iterator jt = pose_targets_.find(eef);
610  if (jt != pose_targets_.end())
611  if (!jt->second.empty())
612  return jt->second;
613 
614  // or return an error
615  static const std::vector<geometry_msgs::PoseStamped> EMPTY;
616  ROS_ERROR_NAMED(LOGNAME, "Poses for end-effector '%s' are not known.", eef.c_str());
617  return EMPTY;
618  }
619 
620  void setPoseReferenceFrame(const std::string& pose_reference_frame)
621  {
622  pose_reference_frame_ = pose_reference_frame;
623  }
624 
625  void setSupportSurfaceName(const std::string& support_surface)
626  {
627  support_surface_ = support_surface;
628  }
629 
630  const std::string& getPoseReferenceFrame() const
631  {
633  }
634 
635  void setTargetType(ActiveTargetType type)
636  {
637  active_target_ = type;
638  }
639 
640  ActiveTargetType getTargetType() const
641  {
642  return active_target_;
643  }
644 
645  bool startStateMonitor(double wait)
646  {
648  {
649  ROS_ERROR_NAMED(LOGNAME, "Unable to monitor current robot state");
650  return false;
651  }
652 
653  // if needed, start the monitor and wait up to 1 second for a full robot state
654  if (!current_state_monitor_->isActive())
655  current_state_monitor_->startStateMonitor();
656 
657  current_state_monitor_->waitForCompleteState(opt_.group_name_, wait);
658  return true;
659  }
660 
661  bool getCurrentState(moveit::core::RobotStatePtr& current_state, double wait_seconds = 1.0)
662  {
664  {
665  ROS_ERROR_NAMED(LOGNAME, "Unable to get current robot state");
666  return false;
667  }
668 
669  // if needed, start the monitor and wait up to 1 second for a full robot state
670  if (!current_state_monitor_->isActive())
671  current_state_monitor_->startStateMonitor();
672 
673  if (!current_state_monitor_->waitForCurrentState(ros::Time::now(), wait_seconds))
674  {
675  ROS_ERROR_NAMED(LOGNAME, "Failed to fetch current robot state");
676  return false;
677  }
678 
679  current_state = current_state_monitor_->getCurrentState();
680  return true;
681  }
682 
684  std::vector<moveit_msgs::PlaceLocation>
685  posesToPlaceLocations(const std::vector<geometry_msgs::PoseStamped>& poses) const
686  {
687  std::vector<moveit_msgs::PlaceLocation> locations;
688  for (const geometry_msgs::PoseStamped& pose : poses)
689  {
690  moveit_msgs::PlaceLocation location;
691  location.pre_place_approach.direction.vector.z = -1.0;
692  location.post_place_retreat.direction.vector.x = -1.0;
693  location.pre_place_approach.direction.header.frame_id = getRobotModel()->getModelFrame();
694  location.post_place_retreat.direction.header.frame_id = end_effector_link_;
695 
696  location.pre_place_approach.min_distance = 0.1;
697  location.pre_place_approach.desired_distance = 0.2;
698  location.post_place_retreat.min_distance = 0.0;
699  location.post_place_retreat.desired_distance = 0.2;
700  // location.post_place_posture is filled by the pick&place lib with the getDetachPosture from the AttachedBody
701 
702  location.place_pose = pose;
703  locations.push_back(location);
704  }
705  ROS_DEBUG_NAMED(LOGNAME, "Move group interface has %u place locations", (unsigned int)locations.size());
706  return locations;
707  }
708 
709  moveit::core::MoveItErrorCode place(const moveit_msgs::PlaceGoal& goal)
710  {
712  {
713  ROS_ERROR_STREAM_NAMED(LOGNAME, "place action client not found");
714  return moveit::core::MoveItErrorCode::FAILURE;
715  }
716  if (!place_action_client_->isServerConnected())
717  {
718  ROS_WARN_STREAM_NAMED(LOGNAME, "place action server not connected");
719  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
720  }
721 
722  place_action_client_->sendGoal(goal);
723  ROS_DEBUG_NAMED(LOGNAME, "Sent place goal with %d locations", (int)goal.place_locations.size());
724  if (!place_action_client_->waitForResult())
725  {
726  ROS_INFO_STREAM_NAMED(LOGNAME, "Place action returned early");
727  }
729  {
730  return place_action_client_->getResult()->error_code;
731  }
732  else
733  {
734  ROS_WARN_STREAM_NAMED(LOGNAME, "Fail: " << place_action_client_->getState().toString() << ": "
735  << place_action_client_->getState().getText());
736  return place_action_client_->getResult()->error_code;
737  }
738  }
739 
740  moveit::core::MoveItErrorCode pick(const moveit_msgs::PickupGoal& goal)
741  {
742  if (!pick_action_client_)
743  {
744  ROS_ERROR_STREAM_NAMED(LOGNAME, "pick action client not found");
745  return moveit::core::MoveItErrorCode::FAILURE;
746  }
747  if (!pick_action_client_->isServerConnected())
748  {
749  ROS_WARN_STREAM_NAMED(LOGNAME, "pick action server not connected");
750  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
751  }
752 
753  pick_action_client_->sendGoal(goal);
754  if (!pick_action_client_->waitForResult())
755  {
756  ROS_INFO_STREAM_NAMED(LOGNAME, "Pickup action returned early");
757  }
759  {
760  return pick_action_client_->getResult()->error_code;
761  }
762  else
763  {
764  ROS_WARN_STREAM_NAMED(LOGNAME, "Fail: " << pick_action_client_->getState().toString() << ": "
765  << pick_action_client_->getState().getText());
766  return pick_action_client_->getResult()->error_code;
767  }
768  }
769 
770  moveit::core::MoveItErrorCode planGraspsAndPick(const std::string& object, bool plan_only = false)
771  {
772  if (object.empty())
773  {
774  return planGraspsAndPick(moveit_msgs::CollisionObject());
775  }
776 
778  std::map<std::string, moveit_msgs::CollisionObject> objects = psi.getObjects(std::vector<std::string>(1, object));
779 
780  if (objects.empty())
781  {
783  "Asked for grasps for the object '" << object << "', but the object could not be found");
784  return moveit::core::MoveItErrorCode::INVALID_OBJECT_NAME;
785  }
786 
787  return planGraspsAndPick(objects[object], plan_only);
788  }
789 
790  moveit::core::MoveItErrorCode planGraspsAndPick(const moveit_msgs::CollisionObject& object, bool plan_only = false)
791  {
793  {
794  ROS_ERROR_STREAM_NAMED(LOGNAME, "Grasp planning service '"
796  << "' is not available."
797  " This has to be implemented and started separately.");
798  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
799  }
800 
801  moveit_msgs::GraspPlanning::Request request;
802  moveit_msgs::GraspPlanning::Response response;
803 
804  request.group_name = opt_.group_name_;
805  request.target = object;
806  request.support_surfaces.push_back(support_surface_);
807 
808  ROS_DEBUG_NAMED(LOGNAME, "Calling grasp planner...");
809  if (!plan_grasps_service_.call(request, response) ||
810  response.error_code.val != moveit_msgs::MoveItErrorCodes::SUCCESS)
811  {
812  ROS_ERROR_NAMED(LOGNAME, "Grasp planning failed. Unable to pick.");
813  return moveit::core::MoveItErrorCode::FAILURE;
814  }
815 
816  return pick(constructPickupGoal(object.id, std::move(response.grasps), plan_only));
817  }
818 
820  {
821  if (!move_action_client_)
822  {
823  ROS_ERROR_STREAM_NAMED(LOGNAME, "move action client not found");
824  return moveit::core::MoveItErrorCode::FAILURE;
825  }
826  if (!move_action_client_->isServerConnected())
827  {
828  ROS_WARN_STREAM_NAMED(LOGNAME, "move action server not connected");
829  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
830  }
831 
832  moveit_msgs::MoveGroupGoal goal;
833  constructGoal(goal);
834  goal.planning_options.plan_only = true;
835  goal.planning_options.look_around = false;
836  goal.planning_options.replan = false;
837  goal.planning_options.planning_scene_diff.is_diff = true;
838  goal.planning_options.planning_scene_diff.robot_state.is_diff = true;
839 
840  move_action_client_->sendGoal(goal);
841  if (!move_action_client_->waitForResult())
842  {
843  ROS_INFO_STREAM_NAMED(LOGNAME, "MoveGroup action returned early");
844  }
846  {
847  plan.trajectory_ = move_action_client_->getResult()->planned_trajectory;
848  plan.start_state_ = move_action_client_->getResult()->trajectory_start;
849  plan.planning_time_ = move_action_client_->getResult()->planning_time;
850  return move_action_client_->getResult()->error_code;
851  }
852  else
853  {
854  ROS_WARN_STREAM_NAMED(LOGNAME, "Fail: " << move_action_client_->getState().toString() << ": "
855  << move_action_client_->getState().getText());
856  return move_action_client_->getResult()->error_code;
857  }
858  }
859 
861  {
862  if (!move_action_client_)
863  {
864  ROS_ERROR_STREAM_NAMED(LOGNAME, "move action client not found");
865  return moveit::core::MoveItErrorCode::FAILURE;
866  }
867  if (!move_action_client_->isServerConnected())
868  {
869  ROS_WARN_STREAM_NAMED(LOGNAME, "move action server not connected");
870  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
871  }
872 
873  moveit_msgs::MoveGroupGoal goal;
874  constructGoal(goal);
875  goal.planning_options.plan_only = false;
876  goal.planning_options.look_around = can_look_;
877  goal.planning_options.replan = can_replan_;
878  goal.planning_options.replan_delay = replan_delay_;
879  goal.planning_options.planning_scene_diff.is_diff = true;
880  goal.planning_options.planning_scene_diff.robot_state.is_diff = true;
881 
882  move_action_client_->sendGoal(goal);
883  if (!wait)
884  {
885  return moveit::core::MoveItErrorCode::SUCCESS;
886  }
887 
888  if (!move_action_client_->waitForResult())
889  {
890  ROS_INFO_STREAM_NAMED(LOGNAME, "MoveGroup action returned early");
891  }
892 
894  {
895  return move_action_client_->getResult()->error_code;
896  }
897  else
898  {
899  ROS_INFO_STREAM_NAMED(LOGNAME, move_action_client_->getState().toString()
900  << ": " << move_action_client_->getState().getText());
901  return move_action_client_->getResult()->error_code;
902  }
903  }
904 
905  moveit::core::MoveItErrorCode execute(const moveit_msgs::RobotTrajectory& trajectory, bool wait)
906  {
908  {
909  ROS_ERROR_STREAM_NAMED(LOGNAME, "execute action client not found");
910  return moveit::core::MoveItErrorCode::FAILURE;
911  }
912  if (!execute_action_client_->isServerConnected())
913  {
914  ROS_WARN_STREAM_NAMED(LOGNAME, "execute action server not connected");
915  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
916  }
917 
918  moveit_msgs::ExecuteTrajectoryGoal goal;
919  goal.trajectory = trajectory;
920 
921  execute_action_client_->sendGoal(goal);
922  if (!wait)
923  {
924  return moveit::core::MoveItErrorCode::SUCCESS;
925  }
926 
927  if (!execute_action_client_->waitForResult())
928  {
929  ROS_INFO_STREAM_NAMED(LOGNAME, "ExecuteTrajectory action returned early");
930  }
931 
933  {
934  return execute_action_client_->getResult()->error_code;
935  }
936  else
937  {
939  << ": " << execute_action_client_->getState().getText());
940  return execute_action_client_->getResult()->error_code;
941  }
942  }
943 
944  double computeCartesianPath(const std::vector<geometry_msgs::Pose>& waypoints, double step,
945  moveit_msgs::RobotTrajectory& msg, const moveit_msgs::Constraints& path_constraints,
946  bool avoid_collisions, moveit_msgs::MoveItErrorCodes& error_code)
947  {
948  moveit_msgs::GetCartesianPath::Request req;
949  moveit_msgs::GetCartesianPath::Response res;
950 
951  req.start_state = considered_start_state_;
952  req.group_name = opt_.group_name_;
953  req.header.frame_id = getPoseReferenceFrame();
954  req.header.stamp = ros::Time::now();
955  req.waypoints = waypoints;
956  req.max_step = step;
957  req.path_constraints = path_constraints;
958  req.avoid_collisions = avoid_collisions;
959  req.link_name = getEndEffectorLink();
960  req.cartesian_speed_limited_link = cartesian_speed_limited_link_;
961  req.max_cartesian_speed = max_cartesian_speed_;
962 
963  if (cartesian_path_service_.call(req, res))
964  {
965  error_code = res.error_code;
966  if (res.error_code.val == moveit_msgs::MoveItErrorCodes::SUCCESS)
967  {
968  msg = res.solution;
969  return res.fraction;
970  }
971  else
972  return -1.0;
973  }
974  else
975  {
976  error_code.val = error_code.FAILURE;
977  return -1.0;
978  }
979  }
980 
981  void stop()
982  {
984  {
985  std_msgs::String event;
986  event.data = "stop";
988  }
989  }
990 
991  bool attachObject(const std::string& object, const std::string& link, const std::vector<std::string>& touch_links)
992  {
993  std::string l = link.empty() ? getEndEffectorLink() : link;
994  if (l.empty())
995  {
996  const std::vector<std::string>& links = joint_model_group_->getLinkModelNames();
997  if (!links.empty())
998  l = links[0];
999  }
1000  if (l.empty())
1001  {
1002  ROS_ERROR_NAMED(LOGNAME, "No known link to attach object '%s' to", object.c_str());
1003  return false;
1004  }
1005  moveit_msgs::AttachedCollisionObject aco;
1006  aco.object.id = object;
1007  aco.link_name.swap(l);
1008  if (touch_links.empty())
1009  aco.touch_links.push_back(aco.link_name);
1010  else
1011  aco.touch_links = touch_links;
1012  aco.object.operation = moveit_msgs::CollisionObject::ADD;
1014  return true;
1015  }
1016 
1017  bool detachObject(const std::string& name)
1018  {
1019  moveit_msgs::AttachedCollisionObject aco;
1020  // if name is a link
1021  if (!name.empty() && joint_model_group_->hasLinkModel(name))
1022  aco.link_name = name;
1023  else
1024  aco.object.id = name;
1025  aco.object.operation = moveit_msgs::CollisionObject::REMOVE;
1026  if (aco.link_name.empty() && aco.object.id.empty())
1027  {
1028  // we only want to detach objects for this group
1029  const std::vector<std::string>& lnames = joint_model_group_->getLinkModelNames();
1030  for (const std::string& lname : lnames)
1031  {
1032  aco.link_name = lname;
1034  }
1035  }
1036  else
1038  return true;
1039  }
1040 
1041  double getGoalPositionTolerance() const
1042  {
1043  return goal_position_tolerance_;
1044  }
1045 
1046  double getGoalOrientationTolerance() const
1047  {
1049  }
1050 
1051  double getGoalJointTolerance() const
1052  {
1053  return goal_joint_tolerance_;
1054  }
1055 
1056  void setGoalJointTolerance(double tolerance)
1057  {
1059  }
1060 
1061  void setGoalPositionTolerance(double tolerance)
1062  {
1064  }
1065 
1066  void setGoalOrientationTolerance(double tolerance)
1067  {
1069  }
1070 
1071  void setPlanningTime(double seconds)
1072  {
1073  if (seconds > 0.0)
1075  }
1076 
1077  double getPlanningTime() const
1078  {
1079  return allowed_planning_time_;
1080  }
1081 
1082  void constructMotionPlanRequest(moveit_msgs::MotionPlanRequest& request) const
1083  {
1084  request.group_name = opt_.group_name_;
1085  request.num_planning_attempts = num_planning_attempts_;
1086  request.max_velocity_scaling_factor = max_velocity_scaling_factor_;
1087  request.max_acceleration_scaling_factor = max_acceleration_scaling_factor_;
1088  request.cartesian_speed_limited_link = cartesian_speed_limited_link_;
1089  request.max_cartesian_speed = max_cartesian_speed_;
1090  request.allowed_planning_time = allowed_planning_time_;
1091  request.pipeline_id = planning_pipeline_id_;
1092  request.planner_id = planner_id_;
1093  request.workspace_parameters = workspace_parameters_;
1094  request.start_state = considered_start_state_;
1095 
1096  if (active_target_ == JOINT)
1097  {
1098  request.goal_constraints.resize(1);
1099  request.goal_constraints[0] = kinematic_constraints::constructGoalConstraints(
1101  }
1102  else if (active_target_ == POSE || active_target_ == POSITION || active_target_ == ORIENTATION)
1103  {
1104  // find out how many goals are specified
1105  std::size_t goal_count = 0;
1106  for (const auto& pose_target : pose_targets_)
1107  goal_count = std::max(goal_count, pose_target.second.size());
1108 
1109  // start filling the goals;
1110  // each end effector has a number of possible poses (K) as valid goals
1111  // but there could be multiple end effectors specified, so we want each end effector
1112  // to reach the goal that corresponds to the goals of the other end effectors
1113  request.goal_constraints.resize(goal_count);
1115  for (const auto& pose_target : pose_targets_)
1116  {
1117  for (std::size_t i = 0; i < pose_target.second.size(); ++i)
1118  {
1120  pose_target.first, pose_target.second[i], goal_position_tolerance_, goal_orientation_tolerance_);
1121  if (active_target_ == ORIENTATION)
1122  c.position_constraints.clear();
1123  if (active_target_ == POSITION)
1124  c.orientation_constraints.clear();
1125  request.goal_constraints[i] = kinematic_constraints::mergeConstraints(request.goal_constraints[i], c);
1126  }
1127  }
1128  }
1129  else
1130  ROS_ERROR_NAMED(LOGNAME, "Unable to construct MotionPlanRequest representation");
1131 
1132  if (path_constraints_)
1133  request.path_constraints = *path_constraints_;
1135  request.trajectory_constraints = *trajectory_constraints_;
1136  }
1137 
1138  void constructGoal(moveit_msgs::MoveGroupGoal& goal) const
1139  {
1140  constructMotionPlanRequest(goal.request);
1141  }
1142 
1143  moveit_msgs::PickupGoal constructPickupGoal(const std::string& object, std::vector<moveit_msgs::Grasp>&& grasps,
1144  bool plan_only = false) const
1145  {
1146  moveit_msgs::PickupGoal goal;
1147  goal.target_name = object;
1148  goal.group_name = opt_.group_name_;
1149  goal.end_effector = getEndEffector();
1150  goal.support_surface_name = support_surface_;
1151  goal.possible_grasps = std::move(grasps);
1152  if (!support_surface_.empty())
1153  goal.allow_gripper_support_collision = true;
1154 
1155  if (path_constraints_)
1156  goal.path_constraints = *path_constraints_;
1157 
1158  goal.planner_id = planner_id_;
1159  goal.allowed_planning_time = allowed_planning_time_;
1160 
1161  goal.planning_options.plan_only = plan_only;
1162  goal.planning_options.look_around = can_look_;
1163  goal.planning_options.replan = can_replan_;
1164  goal.planning_options.replan_delay = replan_delay_;
1165  goal.planning_options.planning_scene_diff.is_diff = true;
1166  goal.planning_options.planning_scene_diff.robot_state.is_diff = true;
1167  return goal;
1168  }
1169 
1170  moveit_msgs::PlaceGoal constructPlaceGoal(const std::string& object,
1171  std::vector<moveit_msgs::PlaceLocation>&& locations,
1172  bool plan_only = false) const
1173  {
1174  moveit_msgs::PlaceGoal goal;
1175  goal.group_name = opt_.group_name_;
1176  goal.attached_object_name = object;
1177  goal.support_surface_name = support_surface_;
1178  goal.place_locations = std::move(locations);
1179  if (!support_surface_.empty())
1180  goal.allow_gripper_support_collision = true;
1181 
1182  if (path_constraints_)
1183  goal.path_constraints = *path_constraints_;
1184 
1185  goal.planner_id = planner_id_;
1186  goal.allowed_planning_time = allowed_planning_time_;
1187 
1188  goal.planning_options.plan_only = plan_only;
1189  goal.planning_options.look_around = can_look_;
1190  goal.planning_options.replan = can_replan_;
1191  goal.planning_options.replan_delay = replan_delay_;
1192  goal.planning_options.planning_scene_diff.is_diff = true;
1193  goal.planning_options.planning_scene_diff.robot_state.is_diff = true;
1194  return goal;
1195  }
1196 
1197  void setPathConstraints(const moveit_msgs::Constraints& constraint)
1198  {
1199  path_constraints_ = std::make_unique<moveit_msgs::Constraints>(constraint);
1200  }
1201 
1202  bool setPathConstraints(const std::string& constraint)
1203  {
1205  {
1207  if (constraints_storage_->getConstraints(msg_m, constraint, robot_model_->getName(), opt_.group_name_))
1208  {
1209  path_constraints_ = std::make_unique<moveit_msgs::Constraints>(static_cast<moveit_msgs::Constraints>(*msg_m));
1210  return true;
1211  }
1212  else
1213  return false;
1214  }
1215  else
1216  return false;
1217  }
1218 
1219  void clearPathConstraints()
1220  {
1221  path_constraints_.reset();
1222  }
1223 
1224  void setTrajectoryConstraints(const moveit_msgs::TrajectoryConstraints& constraint)
1225  {
1226  trajectory_constraints_ = std::make_unique<moveit_msgs::TrajectoryConstraints>(constraint);
1227  }
1228 
1230  {
1231  trajectory_constraints_.reset();
1232  }
1233 
1234  std::vector<std::string> getKnownConstraints() const
1235  {
1237  {
1238  static ros::WallDuration d(0.01);
1239  d.sleep();
1240  }
1241 
1242  std::vector<std::string> c;
1244  constraints_storage_->getKnownConstraints(c, robot_model_->getName(), opt_.group_name_);
1245 
1246  return c;
1247  }
1248 
1249  moveit_msgs::Constraints getPathConstraints() const
1250  {
1251  if (path_constraints_)
1252  return *path_constraints_;
1253  else
1254  return moveit_msgs::Constraints();
1255  }
1256 
1257  moveit_msgs::TrajectoryConstraints getTrajectoryConstraints() const
1258  {
1260  return *trajectory_constraints_;
1261  else
1262  return moveit_msgs::TrajectoryConstraints();
1263  }
1264 
1265  void initializeConstraintsStorage(const std::string& host, unsigned int port)
1266  {
1269  constraints_init_thread_->join();
1271  std::make_unique<boost::thread>([this, host, port] { initializeConstraintsStorageThread(host, port); });
1272  }
1273 
1274  void setWorkspace(double minx, double miny, double minz, double maxx, double maxy, double maxz)
1275  {
1276  workspace_parameters_.header.frame_id = getRobotModel()->getModelFrame();
1277  workspace_parameters_.header.stamp = ros::Time::now();
1278  workspace_parameters_.min_corner.x = minx;
1279  workspace_parameters_.min_corner.y = miny;
1280  workspace_parameters_.min_corner.z = minz;
1281  workspace_parameters_.max_corner.x = maxx;
1282  workspace_parameters_.max_corner.y = maxy;
1283  workspace_parameters_.max_corner.z = maxz;
1284  }
1285 
1286 private:
1287  void initializeConstraintsStorageThread(const std::string& host, unsigned int port)
1288  {
1289  // Set up db
1290  try
1291  {
1293  conn->setParams(host, port);
1294  if (conn->connect())
1295  {
1296  constraints_storage_ = std::make_unique<moveit_warehouse::ConstraintsStorage>(conn);
1297  }
1298  }
1299  catch (std::exception& ex)
1300  {
1301  ROS_ERROR_NAMED(LOGNAME, "%s", ex.what());
1302  }
1303  initializing_constraints_ = false;
1304  }
1305 
1306  Options opt_;
1308  std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
1309  moveit::core::RobotModelConstPtr robot_model_;
1310  planning_scene_monitor::CurrentStateMonitorPtr current_state_monitor_;
1311  std::unique_ptr<actionlib::SimpleActionClient<moveit_msgs::MoveGroupAction>> move_action_client_;
1312  std::unique_ptr<actionlib::SimpleActionClient<moveit_msgs::ExecuteTrajectoryAction>> execute_action_client_;
1313  std::unique_ptr<actionlib::SimpleActionClient<moveit_msgs::PickupAction>> pick_action_client_;
1314  std::unique_ptr<actionlib::SimpleActionClient<moveit_msgs::PlaceAction>> place_action_client_;
1315 
1316  // general planning params
1317  moveit_msgs::RobotState considered_start_state_;
1318  moveit_msgs::WorkspaceParameters workspace_parameters_;
1319  double allowed_planning_time_;
1320  std::string planning_pipeline_id_;
1321  std::string planner_id_;
1322  unsigned int num_planning_attempts_;
1326  double max_cartesian_speed_;
1327  double goal_joint_tolerance_;
1328  double goal_position_tolerance_;
1330  bool can_look_;
1332  bool can_replan_;
1334  double replan_delay_;
1335 
1336  // joint state goal
1337  moveit::core::RobotStatePtr joint_state_target_;
1339 
1340  // pose goal;
1341  // for each link we have a set of possible goal locations;
1342  std::map<std::string, std::vector<geometry_msgs::PoseStamped>> pose_targets_;
1343 
1344  // common properties for goals
1345  ActiveTargetType active_target_;
1346  std::unique_ptr<moveit_msgs::Constraints> path_constraints_;
1347  std::unique_ptr<moveit_msgs::TrajectoryConstraints> trajectory_constraints_;
1348  std::string end_effector_link_;
1349  std::string pose_reference_frame_;
1350  std::string support_surface_;
1351 
1352  // ROS communication
1360  std::unique_ptr<moveit_warehouse::ConstraintsStorage> constraints_storage_;
1361  std::unique_ptr<boost::thread> constraints_init_thread_;
1363 };
1364 
1365 MoveGroupInterface::MoveGroupInterface(const std::string& group_name, const std::shared_ptr<tf2_ros::Buffer>& tf_buffer,
1366  const ros::WallDuration& wait_for_servers)
1367 {
1368  if (!ros::ok())
1369  throw std::runtime_error("ROS does not seem to be running");
1370  impl_ = new MoveGroupInterfaceImpl(Options(group_name), tf_buffer ? tf_buffer : getSharedTF(), wait_for_servers);
1371 }
1372 
1373 MoveGroupInterface::MoveGroupInterface(const std::string& group, const std::shared_ptr<tf2_ros::Buffer>& tf_buffer,
1374  const ros::Duration& wait_for_servers)
1375  : MoveGroupInterface(group, tf_buffer, ros::WallDuration(wait_for_servers.toSec()))
1379 MoveGroupInterface::MoveGroupInterface(const Options& opt, const std::shared_ptr<tf2_ros::Buffer>& tf_buffer,
1380  const ros::WallDuration& wait_for_servers)
1382  impl_ = new MoveGroupInterfaceImpl(opt, tf_buffer ? tf_buffer : getSharedTF(), wait_for_servers);
1383 }
1384 
1386  const std::shared_ptr<tf2_ros::Buffer>& tf_buffer,
1387  const ros::Duration& wait_for_servers)
1388  : MoveGroupInterface(opt, tf_buffer, ros::WallDuration(wait_for_servers.toSec()))
1394  delete impl_;
1398  : remembered_joint_values_(std::move(other.remembered_joint_values_)), impl_(other.impl_)
1400  other.impl_ = nullptr;
1404 {
1405  if (this != &other)
1406  {
1407  delete impl_;
1408  impl_ = other.impl_;
1409  remembered_joint_values_ = std::move(other.remembered_joint_values_);
1410  other.impl_ = nullptr;
1411  }
1412 
1413  return *this;
1416 const std::string& MoveGroupInterface::getName() const
1419 }
1420 
1421 const std::vector<std::string>& MoveGroupInterface::getNamedTargets() const
1423  // The pointer returned by getJointModelGroup is guaranteed by the class
1424  // constructor to always be non-null
1428 moveit::core::RobotModelConstPtr MoveGroupInterface::getRobotModel() const
1431 }
1432 
1434 {
1435  return impl_->getOptions().node_handle_;
1436 }
1437 
1438 bool MoveGroupInterface::getInterfaceDescription(moveit_msgs::PlannerInterfaceDescription& desc) const
1439 {
1440  return impl_->getInterfaceDescription(desc);
1442 
1443 bool MoveGroupInterface::getInterfaceDescriptions(std::vector<moveit_msgs::PlannerInterfaceDescription>& desc) const
1444 {
1445  return impl_->getInterfaceDescriptions(desc);
1446 }
1448 std::map<std::string, std::string> MoveGroupInterface::getPlannerParams(const std::string& planner_id,
1449  const std::string& group) const
1450 {
1451  return impl_->getPlannerParams(planner_id, group);
1452 }
1454 void MoveGroupInterface::setPlannerParams(const std::string& planner_id, const std::string& group,
1455  const std::map<std::string, std::string>& params, bool replace)
1456 {
1457  impl_->setPlannerParams(planner_id, group, params, replace);
1458 }
1459 
1461 {
1463 }
1464 
1465 void MoveGroupInterface::setPlanningPipelineId(const std::string& pipeline_id)
1466 {
1467  impl_->setPlanningPipelineId(pipeline_id);
1468 }
1469 
1470 const std::string& MoveGroupInterface::getPlanningPipelineId() const
1472  return impl_->getPlanningPipelineId();
1473 }
1474 
1475 std::string MoveGroupInterface::getDefaultPlannerId(const std::string& group) const
1476 {
1477  return impl_->getDefaultPlannerId(group);
1478 }
1479 
1480 void MoveGroupInterface::setPlannerId(const std::string& planner_id)
1481 {
1482  impl_->setPlannerId(planner_id);
1483 }
1485 const std::string& MoveGroupInterface::getPlannerId() const
1486 {
1487  return impl_->getPlannerId();
1488 }
1490 void MoveGroupInterface::setNumPlanningAttempts(unsigned int num_planning_attempts)
1491 {
1492  impl_->setNumPlanningAttempts(num_planning_attempts);
1493 }
1494 
1495 void MoveGroupInterface::setMaxVelocityScalingFactor(double max_velocity_scaling_factor)
1497  impl_->setMaxVelocityScalingFactor(max_velocity_scaling_factor);
1498 }
1499 
1500 void MoveGroupInterface::setMaxAccelerationScalingFactor(double max_acceleration_scaling_factor)
1502  impl_->setMaxAccelerationScalingFactor(max_acceleration_scaling_factor);
1503 }
1504 
1505 void MoveGroupInterface::limitMaxCartesianLinkSpeed(const double max_speed, const std::string& link_name)
1507  impl_->limitMaxCartesianLinkSpeed(max_speed, link_name);
1508 }
1509 
1513 }
1514 
1517  return impl_->move(false);
1518 }
1519 
1521 {
1523 }
1524 
1526 {
1527  return impl_->move(true);
1529 
1531 {
1532  return impl_->execute(plan.trajectory_, false);
1534 
1535 moveit::core::MoveItErrorCode MoveGroupInterface::asyncExecute(const moveit_msgs::RobotTrajectory& trajectory)
1536 {
1537  return impl_->execute(trajectory, false);
1539 
1541 {
1542  return impl_->execute(plan.trajectory_, true);
1544 
1545 moveit::core::MoveItErrorCode MoveGroupInterface::execute(const moveit_msgs::RobotTrajectory& trajectory)
1546 {
1547  return impl_->execute(trajectory, true);
1549 
1551 {
1552  return impl_->plan(plan);
1554 
1555 moveit_msgs::PickupGoal MoveGroupInterface::constructPickupGoal(const std::string& object,
1556  std::vector<moveit_msgs::Grasp> grasps,
1557  bool plan_only = false) const
1559  return impl_->constructPickupGoal(object, std::move(grasps), plan_only);
1560 }
1561 
1562 moveit_msgs::PlaceGoal MoveGroupInterface::constructPlaceGoal(const std::string& object,
1563  std::vector<moveit_msgs::PlaceLocation> locations,
1564  bool plan_only = false) const
1565 {
1566  return impl_->constructPlaceGoal(object, std::move(locations), plan_only);
1567 }
1569 std::vector<moveit_msgs::PlaceLocation>
1570 MoveGroupInterface::posesToPlaceLocations(const std::vector<geometry_msgs::PoseStamped>& poses) const
1571 {
1572  return impl_->posesToPlaceLocations(poses);
1574 
1575 moveit::core::MoveItErrorCode MoveGroupInterface::pick(const moveit_msgs::PickupGoal& goal)
1576 {
1577  return impl_->pick(goal);
1579 
1580 moveit::core::MoveItErrorCode MoveGroupInterface::planGraspsAndPick(const std::string& object, bool plan_only)
1581 {
1582  return impl_->planGraspsAndPick(object, plan_only);
1584 
1585 moveit::core::MoveItErrorCode MoveGroupInterface::planGraspsAndPick(const moveit_msgs::CollisionObject& object,
1586  bool plan_only)
1587 {
1588  return impl_->planGraspsAndPick(object, plan_only);
1589 }
1590 
1591 moveit::core::MoveItErrorCode MoveGroupInterface::place(const moveit_msgs::PlaceGoal& goal)
1592 {
1593  return impl_->place(goal);
1594 }
1595 
1596 double MoveGroupInterface::computeCartesianPath(const std::vector<geometry_msgs::Pose>& waypoints, double eef_step,
1597  moveit_msgs::RobotTrajectory& trajectory, bool avoid_collisions,
1598  moveit_msgs::MoveItErrorCodes* error_code)
1599 {
1600  return computeCartesianPath(waypoints, eef_step, trajectory, moveit_msgs::Constraints(), avoid_collisions, error_code);
1601 }
1602 
1603 double MoveGroupInterface::computeCartesianPath(const std::vector<geometry_msgs::Pose>& waypoints, double eef_step,
1604  moveit_msgs::RobotTrajectory& trajectory,
1605  const moveit_msgs::Constraints& path_constraints, bool avoid_collisions,
1606  moveit_msgs::MoveItErrorCodes* error_code)
1607 {
1608  moveit_msgs::MoveItErrorCodes err_tmp;
1609  moveit_msgs::MoveItErrorCodes& err = error_code ? *error_code : err_tmp;
1610  return impl_->computeCartesianPath(waypoints, eef_step, trajectory, path_constraints, avoid_collisions, err);
1611 }
1612 
1614 {
1615  impl_->stop();
1616 }
1617 
1618 void MoveGroupInterface::setStartState(const moveit_msgs::RobotState& start_state)
1619 {
1620  impl_->setStartState(start_state);
1621 }
1622 
1624 {
1625  impl_->setStartState(start_state);
1626 }
1627 
1629 {
1631 }
1632 
1634 {
1636  impl_->setTargetType(JOINT);
1637 }
1639 const std::vector<std::string>& MoveGroupInterface::getVariableNames() const
1640 {
1642 }
1644 const std::vector<std::string>& MoveGroupInterface::getLinkNames() const
1645 {
1647 }
1649 std::map<std::string, double> MoveGroupInterface::getNamedTargetValues(const std::string& name) const
1650 {
1651  std::map<std::string, std::vector<double>>::const_iterator it = remembered_joint_values_.find(name);
1652  std::map<std::string, double> positions;
1654  if (it != remembered_joint_values_.cend())
1655  {
1656  std::vector<std::string> names = impl_->getJointModelGroup()->getVariableNames();
1657  for (size_t x = 0; x < names.size(); ++x)
1658  {
1659  positions[names[x]] = it->second[x];
1660  }
1661  }
1662  else
1663  {
1665  }
1666  return positions;
1667 }
1668 
1669 bool MoveGroupInterface::setNamedTarget(const std::string& name)
1670 {
1671  std::map<std::string, std::vector<double>>::const_iterator it = remembered_joint_values_.find(name);
1672  if (it != remembered_joint_values_.end())
1673  {
1674  return setJointValueTarget(it->second);
1675  }
1676  else
1677  {
1679  {
1680  impl_->setTargetType(JOINT);
1681  return true;
1682  }
1683  ROS_ERROR_NAMED(LOGNAME, "The requested named target '%s' does not exist", name.c_str());
1684  return false;
1685  }
1687 
1688 void MoveGroupInterface::getJointValueTarget(std::vector<double>& group_variable_values) const
1689 {
1692 
1693 bool MoveGroupInterface::setJointValueTarget(const std::vector<double>& joint_values)
1694 {
1695  auto const n_group_joints = impl_->getJointModelGroup()->getVariableCount();
1696  if (joint_values.size() != n_group_joints)
1697  {
1698  ROS_DEBUG_STREAM_NAMED(LOGNAME, "Provided joint value list has length " << joint_values.size() << " but group "
1700  << " has " << n_group_joints << " joints");
1701  return false;
1702  }
1703  impl_->setTargetType(JOINT);
1706 }
1708 bool MoveGroupInterface::setJointValueTarget(const std::map<std::string, double>& variable_values)
1709 {
1710  const auto& allowed = impl_->getJointModelGroup()->getVariableNames();
1711  for (const auto& pair : variable_values)
1712  {
1713  if (std::find(allowed.begin(), allowed.end(), pair.first) == allowed.end())
1714  {
1715  ROS_ERROR_STREAM("joint variable " << pair.first << " is not part of group "
1716  << impl_->getJointModelGroup()->getName());
1717  return false;
1718  }
1719  }
1720 
1721  impl_->setTargetType(JOINT);
1722  impl_->getTargetRobotState().setVariablePositions(variable_values);
1724 }
1725 
1726 bool MoveGroupInterface::setJointValueTarget(const std::vector<std::string>& variable_names,
1727  const std::vector<double>& variable_values)
1728 {
1729  if (variable_names.size() != variable_values.size())
1730  {
1731  ROS_ERROR_STREAM("sizes of name and position arrays do not match");
1732  return false;
1733  }
1734  const auto& allowed = impl_->getJointModelGroup()->getVariableNames();
1735  for (const auto& variable_name : variable_names)
1736  {
1737  if (std::find(allowed.begin(), allowed.end(), variable_name) == allowed.end())
1738  {
1739  ROS_ERROR_STREAM("joint variable " << variable_name << " is not part of group "
1740  << impl_->getJointModelGroup()->getName());
1741  return false;
1742  }
1743  }
1744 
1745  impl_->setTargetType(JOINT);
1746  impl_->getTargetRobotState().setVariablePositions(variable_names, variable_values);
1748 }
1749 
1751 {
1752  impl_->setTargetType(JOINT);
1753  impl_->getTargetRobotState() = rstate;
1755 }
1757 bool MoveGroupInterface::setJointValueTarget(const std::string& joint_name, double value)
1758 {
1759  std::vector<double> values(1, value);
1760  return setJointValueTarget(joint_name, values);
1762 
1763 bool MoveGroupInterface::setJointValueTarget(const std::string& joint_name, const std::vector<double>& values)
1764 {
1765  impl_->setTargetType(JOINT);
1766  const moveit::core::JointModel* jm = impl_->getJointModelGroup()->getJointModel(joint_name);
1767  if (jm && jm->getVariableCount() == values.size())
1768  {
1771  }
1772 
1773  ROS_ERROR_STREAM("joint " << joint_name << " is not part of group " << impl_->getJointModelGroup()->getName());
1774  return false;
1775 }
1777 bool MoveGroupInterface::setJointValueTarget(const sensor_msgs::JointState& state)
1778 {
1779  return setJointValueTarget(state.name, state.position);
1780 }
1781 
1782 bool MoveGroupInterface::setJointValueTarget(const geometry_msgs::Pose& eef_pose, const std::string& end_effector_link)
1783 {
1784  return impl_->setJointValueTarget(eef_pose, end_effector_link, "", false);
1785 }
1786 
1787 bool MoveGroupInterface::setJointValueTarget(const geometry_msgs::PoseStamped& eef_pose,
1788  const std::string& end_effector_link)
1789 {
1790  return impl_->setJointValueTarget(eef_pose.pose, end_effector_link, eef_pose.header.frame_id, false);
1791 }
1792 
1793 bool MoveGroupInterface::setJointValueTarget(const Eigen::Isometry3d& eef_pose, const std::string& end_effector_link)
1795  geometry_msgs::Pose msg = tf2::toMsg(eef_pose);
1796  return setJointValueTarget(msg, end_effector_link);
1797 }
1798 
1799 bool MoveGroupInterface::setApproximateJointValueTarget(const geometry_msgs::Pose& eef_pose,
1800  const std::string& end_effector_link)
1801 {
1802  return impl_->setJointValueTarget(eef_pose, end_effector_link, "", true);
1803 }
1804 
1805 bool MoveGroupInterface::setApproximateJointValueTarget(const geometry_msgs::PoseStamped& eef_pose,
1806  const std::string& end_effector_link)
1807 {
1808  return impl_->setJointValueTarget(eef_pose.pose, end_effector_link, eef_pose.header.frame_id, true);
1809 }
1810 
1811 bool MoveGroupInterface::setApproximateJointValueTarget(const Eigen::Isometry3d& eef_pose,
1812  const std::string& end_effector_link)
1813 {
1814  geometry_msgs::Pose msg = tf2::toMsg(eef_pose);
1815  return setApproximateJointValueTarget(msg, end_effector_link);
1816 }
1817 
1819 {
1820  return impl_->getTargetRobotState();
1821 }
1822 
1824 {
1826 }
1827 
1828 const std::string& MoveGroupInterface::getEndEffectorLink() const
1829 {
1830  return impl_->getEndEffectorLink();
1832 
1833 const std::string& MoveGroupInterface::getEndEffector() const
1834 {
1835  return impl_->getEndEffector();
1836 }
1837 
1838 bool MoveGroupInterface::setEndEffectorLink(const std::string& link_name)
1839 {
1840  if (impl_->getEndEffectorLink().empty() || link_name.empty())
1841  return false;
1842  impl_->setEndEffectorLink(link_name);
1843  impl_->setTargetType(POSE);
1844  return true;
1846 
1847 bool MoveGroupInterface::setEndEffector(const std::string& eef_name)
1848 {
1849  const moveit::core::JointModelGroup* jmg = impl_->getRobotModel()->getEndEffector(eef_name);
1850  if (jmg)
1851  return setEndEffectorLink(jmg->getEndEffectorParentGroup().second);
1852  return false;
1853 }
1854 
1855 void MoveGroupInterface::clearPoseTarget(const std::string& end_effector_link)
1856 {
1857  impl_->clearPoseTarget(end_effector_link);
1858 }
1859 
1863 }
1864 
1865 bool MoveGroupInterface::setPoseTarget(const Eigen::Isometry3d& pose, const std::string& end_effector_link)
1866 {
1867  std::vector<geometry_msgs::PoseStamped> pose_msg(1);
1868  pose_msg[0].pose = tf2::toMsg(pose);
1869  pose_msg[0].header.frame_id = getPoseReferenceFrame();
1870  pose_msg[0].header.stamp = ros::Time::now();
1871  return setPoseTargets(pose_msg, end_effector_link);
1872 }
1874 bool MoveGroupInterface::setPoseTarget(const geometry_msgs::Pose& target, const std::string& end_effector_link)
1875 {
1876  std::vector<geometry_msgs::PoseStamped> pose_msg(1);
1877  pose_msg[0].pose = target;
1878  pose_msg[0].header.frame_id = getPoseReferenceFrame();
1879  pose_msg[0].header.stamp = ros::Time::now();
1880  return setPoseTargets(pose_msg, end_effector_link);
1881 }
1882 
1883 bool MoveGroupInterface::setPoseTarget(const geometry_msgs::PoseStamped& target, const std::string& end_effector_link)
1884 {
1885  std::vector<geometry_msgs::PoseStamped> targets(1, target);
1886  return setPoseTargets(targets, end_effector_link);
1887 }
1888 
1889 bool MoveGroupInterface::setPoseTargets(const EigenSTL::vector_Isometry3d& target, const std::string& end_effector_link)
1890 {
1891  std::vector<geometry_msgs::PoseStamped> pose_out(target.size());
1892  ros::Time tm = ros::Time::now();
1893  const std::string& frame_id = getPoseReferenceFrame();
1894  for (std::size_t i = 0; i < target.size(); ++i)
1895  {
1896  pose_out[i].pose = tf2::toMsg(target[i]);
1897  pose_out[i].header.stamp = tm;
1898  pose_out[i].header.frame_id = frame_id;
1899  }
1900  return setPoseTargets(pose_out, end_effector_link);
1902 
1903 bool MoveGroupInterface::setPoseTargets(const std::vector<geometry_msgs::Pose>& target,
1904  const std::string& end_effector_link)
1905 {
1906  std::vector<geometry_msgs::PoseStamped> target_stamped(target.size());
1907  ros::Time tm = ros::Time::now();
1908  const std::string& frame_id = getPoseReferenceFrame();
1909  for (std::size_t i = 0; i < target.size(); ++i)
1910  {
1911  target_stamped[i].pose = target[i];
1912  target_stamped[i].header.stamp = tm;
1913  target_stamped[i].header.frame_id = frame_id;
1914  }
1915  return setPoseTargets(target_stamped, end_effector_link);
1916 }
1917 
1918 bool MoveGroupInterface::setPoseTargets(const std::vector<geometry_msgs::PoseStamped>& target,
1919  const std::string& end_effector_link)
1920 {
1921  if (target.empty())
1922  {
1923  ROS_ERROR_NAMED(LOGNAME, "No pose specified as goal target");
1924  return false;
1925  }
1926  else
1927  {
1929  return impl_->setPoseTargets(target, end_effector_link);
1930  }
1931 }
1932 
1933 const geometry_msgs::PoseStamped& MoveGroupInterface::getPoseTarget(const std::string& end_effector_link) const
1934 {
1935  return impl_->getPoseTarget(end_effector_link);
1936 }
1937 
1938 const std::vector<geometry_msgs::PoseStamped>&
1939 MoveGroupInterface::getPoseTargets(const std::string& end_effector_link) const
1940 {
1941  return impl_->getPoseTargets(end_effector_link);
1943 
1944 namespace
1945 {
1946 inline void transformPose(const tf2_ros::Buffer& tf_buffer, const std::string& desired_frame,
1947  geometry_msgs::PoseStamped& target)
1948 {
1949  if (desired_frame != target.header.frame_id)
1950  {
1951  geometry_msgs::PoseStamped target_in(target);
1952  tf_buffer.transform(target_in, target, desired_frame);
1953  // we leave the stamp to ros::Time(0) on purpose
1954  target.header.stamp = ros::Time(0);
1955  }
1956 }
1957 } // namespace
1958 
1959 bool MoveGroupInterface::setPositionTarget(double x, double y, double z, const std::string& end_effector_link)
1960 {
1961  geometry_msgs::PoseStamped target;
1962  if (impl_->hasPoseTarget(end_effector_link))
1963  {
1964  target = getPoseTarget(end_effector_link);
1965  transformPose(*impl_->getTF(), impl_->getPoseReferenceFrame(), target);
1966  }
1967  else
1968  {
1969  target.pose.orientation.x = 0.0;
1970  target.pose.orientation.y = 0.0;
1971  target.pose.orientation.z = 0.0;
1972  target.pose.orientation.w = 1.0;
1973  target.header.frame_id = impl_->getPoseReferenceFrame();
1974  }
1975 
1976  target.pose.position.x = x;
1977  target.pose.position.y = y;
1978  target.pose.position.z = z;
1979  bool result = setPoseTarget(target, end_effector_link);
1980  impl_->setTargetType(POSITION);
1981  return result;
1982 }
1983 
1984 bool MoveGroupInterface::setRPYTarget(double r, double p, double y, const std::string& end_effector_link)
1985 {
1986  geometry_msgs::PoseStamped target;
1987  if (impl_->hasPoseTarget(end_effector_link))
1988  {
1989  target = getPoseTarget(end_effector_link);
1990  transformPose(*impl_->getTF(), impl_->getPoseReferenceFrame(), target);
1991  }
1992  else
1993  {
1994  target.pose.position.x = 0.0;
1995  target.pose.position.y = 0.0;
1996  target.pose.position.z = 0.0;
1997  target.header.frame_id = impl_->getPoseReferenceFrame();
1998  }
2000  q.setRPY(r, p, y);
2001  target.pose.orientation = tf2::toMsg(q);
2002  bool result = setPoseTarget(target, end_effector_link);
2003  impl_->setTargetType(ORIENTATION);
2004  return result;
2005 }
2006 
2007 bool MoveGroupInterface::setOrientationTarget(double x, double y, double z, double w,
2008  const std::string& end_effector_link)
2009 {
2010  geometry_msgs::PoseStamped target;
2011  if (impl_->hasPoseTarget(end_effector_link))
2012  {
2013  target = getPoseTarget(end_effector_link);
2014  transformPose(*impl_->getTF(), impl_->getPoseReferenceFrame(), target);
2015  }
2016  else
2017  {
2018  target.pose.position.x = 0.0;
2019  target.pose.position.y = 0.0;
2020  target.pose.position.z = 0.0;
2021  target.header.frame_id = impl_->getPoseReferenceFrame();
2022  }
2023 
2024  target.pose.orientation.x = x;
2025  target.pose.orientation.y = y;
2026  target.pose.orientation.z = z;
2027  target.pose.orientation.w = w;
2028  bool result = setPoseTarget(target, end_effector_link);
2029  impl_->setTargetType(ORIENTATION);
2030  return result;
2031 }
2032 
2033 void MoveGroupInterface::setPoseReferenceFrame(const std::string& pose_reference_frame)
2034 {
2035  impl_->setPoseReferenceFrame(pose_reference_frame);
2036 }
2037 
2038 const std::string& MoveGroupInterface::getPoseReferenceFrame() const
2039 {
2040  return impl_->getPoseReferenceFrame();
2041 }
2042 
2044 {
2045  return impl_->getGoalJointTolerance();
2046 }
2047 
2049 {
2050  return impl_->getGoalPositionTolerance();
2051 }
2054 {
2056 }
2057 
2058 void MoveGroupInterface::setGoalTolerance(double tolerance)
2059 {
2060  setGoalJointTolerance(tolerance);
2061  setGoalPositionTolerance(tolerance);
2062  setGoalOrientationTolerance(tolerance);
2063 }
2064 
2065 void MoveGroupInterface::setGoalJointTolerance(double tolerance)
2066 {
2067  impl_->setGoalJointTolerance(tolerance);
2068 }
2069 
2070 void MoveGroupInterface::setGoalPositionTolerance(double tolerance)
2071 {
2072  impl_->setGoalPositionTolerance(tolerance);
2073 }
2074 
2076 {
2078 }
2079 
2080 void MoveGroupInterface::rememberJointValues(const std::string& name)
2081 {
2083 }
2084 
2085 bool MoveGroupInterface::startStateMonitor(double wait)
2086 {
2087  return impl_->startStateMonitor(wait);
2088 }
2089 
2090 std::vector<double> MoveGroupInterface::getCurrentJointValues() const
2091 {
2092  moveit::core::RobotStatePtr current_state;
2093  std::vector<double> values;
2094  if (impl_->getCurrentState(current_state))
2095  current_state->copyJointGroupPositions(getName(), values);
2096  return values;
2097 }
2098 
2099 std::vector<double> MoveGroupInterface::getRandomJointValues() const
2100 {
2101  std::vector<double> r;
2103  return r;
2104 }
2105 
2106 geometry_msgs::PoseStamped MoveGroupInterface::getRandomPose(const std::string& end_effector_link) const
2107 {
2108  const std::string& eef = end_effector_link.empty() ? getEndEffectorLink() : end_effector_link;
2109  Eigen::Isometry3d pose;
2110  pose.setIdentity();
2111  if (eef.empty())
2112  ROS_ERROR_NAMED(LOGNAME, "No end-effector specified");
2113  else
2114  {
2115  moveit::core::RobotStatePtr current_state;
2116  if (impl_->getCurrentState(current_state))
2117  {
2118  current_state->setToRandomPositions(impl_->getJointModelGroup());
2119  const moveit::core::LinkModel* lm = current_state->getLinkModel(eef);
2120  if (lm)
2121  pose = current_state->getGlobalLinkTransform(lm);
2122  }
2123  }
2124  geometry_msgs::PoseStamped pose_msg;
2125  pose_msg.header.stamp = ros::Time::now();
2126  pose_msg.header.frame_id = impl_->getRobotModel()->getModelFrame();
2127  pose_msg.pose = tf2::toMsg(pose);
2128  return pose_msg;
2129 }
2130 
2131 geometry_msgs::PoseStamped MoveGroupInterface::getCurrentPose(const std::string& end_effector_link) const
2132 {
2133  const std::string& eef = end_effector_link.empty() ? getEndEffectorLink() : end_effector_link;
2134  Eigen::Isometry3d pose;
2135  pose.setIdentity();
2136  if (eef.empty())
2137  ROS_ERROR_NAMED(LOGNAME, "No end-effector specified");
2138  else
2139  {
2140  moveit::core::RobotStatePtr current_state;
2141  if (impl_->getCurrentState(current_state))
2142  {
2143  const moveit::core::LinkModel* lm = current_state->getLinkModel(eef);
2144  if (lm)
2145  pose = current_state->getGlobalLinkTransform(lm);
2146  }
2147  }
2148  geometry_msgs::PoseStamped pose_msg;
2149  pose_msg.header.stamp = ros::Time::now();
2150  pose_msg.header.frame_id = impl_->getRobotModel()->getModelFrame();
2151  pose_msg.pose = tf2::toMsg(pose);
2152  return pose_msg;
2154 
2155 std::vector<double> MoveGroupInterface::getCurrentRPY(const std::string& end_effector_link) const
2156 {
2157  std::vector<double> result;
2158  const std::string& eef = end_effector_link.empty() ? getEndEffectorLink() : end_effector_link;
2159  if (eef.empty())
2160  ROS_ERROR_NAMED(LOGNAME, "No end-effector specified");
2161  else
2162  {
2163  moveit::core::RobotStatePtr current_state;
2164  if (impl_->getCurrentState(current_state))
2165  {
2166  const moveit::core::LinkModel* lm = current_state->getLinkModel(eef);
2167  if (lm)
2168  {
2169  result.resize(3);
2170  geometry_msgs::TransformStamped tfs = tf2::eigenToTransform(current_state->getGlobalLinkTransform(lm));
2171  double pitch, roll, yaw;
2172  tf2::getEulerYPR<geometry_msgs::Quaternion>(tfs.transform.rotation, yaw, pitch, roll);
2173  result[0] = roll;
2174  result[1] = pitch;
2175  result[2] = yaw;
2176  }
2177  }
2178  }
2179  return result;
2180 }
2181 
2182 const std::vector<std::string>& MoveGroupInterface::getActiveJoints() const
2183 {
2185 }
2186 
2187 const std::vector<std::string>& MoveGroupInterface::getJoints() const
2188 {
2190 }
2191 
2192 unsigned int MoveGroupInterface::getVariableCount() const
2193 {
2195 }
2196 
2197 moveit::core::RobotStatePtr MoveGroupInterface::getCurrentState(double wait) const
2198 {
2199  moveit::core::RobotStatePtr current_state;
2200  impl_->getCurrentState(current_state, wait);
2201  return current_state;
2202 }
2203 
2204 void MoveGroupInterface::rememberJointValues(const std::string& name, const std::vector<double>& values)
2205 {
2207 }
2208 
2209 void MoveGroupInterface::forgetJointValues(const std::string& name)
2210 {
2211  remembered_joint_values_.erase(name);
2212 }
2213 
2214 void MoveGroupInterface::allowLooking(bool flag)
2215 {
2216  impl_->can_look_ = flag;
2217  ROS_DEBUG_NAMED(LOGNAME, "Looking around: %s", flag ? "yes" : "no");
2218 }
2219 
2220 void MoveGroupInterface::setLookAroundAttempts(int32_t attempts)
2221 {
2222  if (attempts < 0)
2223  {
2224  ROS_ERROR_NAMED(LOGNAME, "Tried to set negative number of look-around attempts");
2225  }
2226  else
2227  {
2228  ROS_DEBUG_STREAM_NAMED(LOGNAME, "Look around attempts: " << attempts);
2229  impl_->look_around_attempts_ = attempts;
2230  }
2231 }
2232 
2234 {
2235  impl_->can_replan_ = flag;
2236  ROS_DEBUG_NAMED(LOGNAME, "Replanning: %s", flag ? "yes" : "no");
2237 }
2238 
2239 void MoveGroupInterface::setReplanAttempts(int32_t attempts)
2240 {
2241  if (attempts < 0)
2242  {
2243  ROS_ERROR_NAMED(LOGNAME, "Tried to set negative number of replan attempts");
2244  }
2245  else
2246  {
2247  ROS_DEBUG_STREAM_NAMED(LOGNAME, "Replan Attempts: " << attempts);
2248  impl_->replan_attempts_ = attempts;
2249  }
2251 
2252 void MoveGroupInterface::setReplanDelay(double delay)
2253 {
2254  if (delay < 0.0)
2255  {
2256  ROS_ERROR_NAMED(LOGNAME, "Tried to set negative replan delay");
2257  }
2258  else
2259  {
2260  ROS_DEBUG_STREAM_NAMED(LOGNAME, "Replan Delay: " << delay);
2261  impl_->replan_delay_ = delay;
2262  }
2263 }
2264 
2265 std::vector<std::string> MoveGroupInterface::getKnownConstraints() const
2266 {
2267  return impl_->getKnownConstraints();
2268 }
2269 
2270 moveit_msgs::Constraints MoveGroupInterface::getPathConstraints() const
2271 {
2273 }
2274 
2275 bool MoveGroupInterface::setPathConstraints(const std::string& constraint)
2276 {
2277  return impl_->setPathConstraints(constraint);
2278 }
2279 
2280 void MoveGroupInterface::setPathConstraints(const moveit_msgs::Constraints& constraint)
2281 {
2283 }
2284 
2286 {
2289 
2290 moveit_msgs::TrajectoryConstraints MoveGroupInterface::getTrajectoryConstraints() const
2291 {
2292  return impl_->getTrajectoryConstraints();
2293 }
2294 
2295 void MoveGroupInterface::setTrajectoryConstraints(const moveit_msgs::TrajectoryConstraints& constraint)
2296 {
2297  impl_->setTrajectoryConstraints(constraint);
2298 }
2299 
2303 }
2304 
2305 void MoveGroupInterface::setConstraintsDatabase(const std::string& host, unsigned int port)
2306 {
2308 }
2309 
2310 void MoveGroupInterface::setWorkspace(double minx, double miny, double minz, double maxx, double maxy, double maxz)
2311 {
2312  impl_->setWorkspace(minx, miny, minz, maxx, maxy, maxz);
2313 }
2314 
2316 void MoveGroupInterface::setPlanningTime(double seconds)
2317 {
2318  impl_->setPlanningTime(seconds);
2319 }
2323 {
2324  return impl_->getPlanningTime();
2325 }
2326 
2327 void MoveGroupInterface::setSupportSurfaceName(const std::string& name)
2328 {
2330 }
2331 
2332 const std::string& MoveGroupInterface::getPlanningFrame() const
2334  return impl_->getRobotModel()->getModelFrame();
2335 }
2336 
2337 const std::vector<std::string>& MoveGroupInterface::getJointModelGroupNames() const
2339  return impl_->getRobotModel()->getJointModelGroupNames();
2340 }
2341 
2342 bool MoveGroupInterface::attachObject(const std::string& object, const std::string& link)
2344  return attachObject(object, link, std::vector<std::string>());
2345 }
2346 
2347 bool MoveGroupInterface::attachObject(const std::string& object, const std::string& link,
2348  const std::vector<std::string>& touch_links)
2349 {
2350  return impl_->attachObject(object, link, touch_links);
2351 }
2352 
2353 bool MoveGroupInterface::detachObject(const std::string& name)
2354 {
2355  return impl_->detachObject(name);
2356 }
2357 
2358 void MoveGroupInterface::constructMotionPlanRequest(moveit_msgs::MotionPlanRequest& goal_out)
2359 {
2360  impl_->constructMotionPlanRequest(goal_out);
2361 }
2362 
2363 } // namespace planning_interface
2364 } // namespace moveit
moveit::core::JointModelGroup::hasLinkModel
bool hasLinkModel(const std::string &link) const
int32_t
int32_t
moveit::core::LinkModel
response
const std::string response
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setJointValueTarget
bool setJointValueTarget(const geometry_msgs::Pose &eef_pose, const std::string &end_effector_link, const std::string &frame, bool approx)
Definition: move_group_interface.cpp:546
moveit::planning_interface::MoveGroupInterface::getEndEffector
const std::string & getEndEffector() const
Get the current end-effector name. This returns the value set by setEndEffector() (or indirectly by s...
Definition: move_group_interface.cpp:1901
moveit::planning_interface::MoveGroupInterface::setStartState
void setStartState(const moveit_msgs::RobotState &start_state)
If a different start state should be considered instead of the current state of the robot,...
Definition: move_group_interface.cpp:1686
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::planGraspsAndPick
moveit::core::MoveItErrorCode planGraspsAndPick(const std::string &object, bool plan_only=false)
Definition: move_group_interface.cpp:838
moveit::planning_interface::MoveGroupInterface::getPlannerParams
std::map< std::string, std::string > getPlannerParams(const std::string &planner_id, const std::string &group="") const
Get the planner parameters for given group and planner_id.
Definition: move_group_interface.cpp:1516
moveit::core::GroupStateValidityCallbackFn
boost::function< bool(RobotState *robot_state, const JointModelGroup *joint_group, const double *joint_group_variable_values)> GroupStateValidityCallbackFn
moveit::planning_interface::MoveGroupInterface::setPoseTarget
bool setPoseTarget(const Eigen::Isometry3d &end_effector_pose, const std::string &end_effector_link="")
Set the goal pose of the end-effector end_effector_link.
Definition: move_group_interface.cpp:1933
ros::WallDuration::sleep
bool sleep() const
moveit::core::JointModelGroup::getJointModel
const JointModel * getJointModel(const std::string &joint) const
moveit::planning_interface::MoveGroupInterface::setJointValueTarget
bool setJointValueTarget(const std::vector< double > &group_variable_values)
Set the JointValueTarget and use it for future planning requests.
Definition: move_group_interface.cpp:1761
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::max_acceleration_scaling_factor_
double max_acceleration_scaling_factor_
Definition: move_group_interface.cpp:1392
moveit::core::RobotState::setJointPositions
void setJointPositions(const std::string &joint_name, const double *position)
moveit::planning_interface::MoveGroupInterface::getKnownConstraints
std::vector< std::string > getKnownConstraints() const
Get the names of the known constraints as read from the Mongo database, if a connection was achieved.
Definition: move_group_interface.cpp:2333
moveit::planning_interface::MoveGroupInterface::getDefaultPlanningPipelineId
std::string getDefaultPlanningPipelineId() const
Definition: move_group_interface.cpp:1528
moveit::planning_interface::MoveGroupInterface::getTrajectoryConstraints
moveit_msgs::TrajectoryConstraints getTrajectoryConstraints() const
Definition: move_group_interface.cpp:2358
moveit::core::RobotState::setVariablePositions
void setVariablePositions(const double *position)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPlanningTime
void setPlanningTime(double seconds)
Definition: move_group_interface.cpp:1139
EigenSTL::vector_Isometry3d
std::vector< Eigen::Isometry3d, Eigen::aligned_allocator< Eigen::Isometry3d > > vector_Isometry3d
kinematics::KinematicsQueryOptions::return_approximate_solution
bool return_approximate_solution
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::max_cartesian_speed_
double max_cartesian_speed_
Definition: move_group_interface.cpp:1394
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getTargetRobotState
moveit::core::RobotState & getTargetRobotState()
Definition: move_group_interface.cpp:510
moveit::planning_interface::MoveGroupInterface::getJoints
const std::vector< std::string > & getJoints() const
Get names of all the joints in this group.
Definition: move_group_interface.cpp:2255
ros::Publisher
moveit::planning_interface::MoveGroupInterface::getMoveGroupClient
actionlib::SimpleActionClient< moveit_msgs::MoveGroupAction > & getMoveGroupClient() const
Get the move_group action client used by the MoveGroupInterface. The client can be used for querying ...
Definition: move_group_interface.cpp:1588
moveit::planning_interface::MoveGroupInterface::startStateMonitor
bool startStateMonitor(double wait=1.0)
When reasoning about the current state of a robot, a CurrentStateMonitor instance is automatically co...
Definition: move_group_interface.cpp:2153
moveit::core::JointModel::getVariableCount
std::size_t getVariableCount() const
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::hasPoseTarget
bool hasPoseTarget(const std::string &end_effector_link) const
Definition: move_group_interface.cpp:651
moveit::planning_interface::MoveGroupInterface::setGoalOrientationTolerance
void setGoalOrientationTolerance(double tolerance)
Set the orientation tolerance that is used for reaching the goal when moving to a pose.
Definition: move_group_interface.cpp:2143
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::waitForAction
void waitForAction(const T &action, const std::string &name, const ros::WallTime &timeout, double allotted_time) const
Definition: move_group_interface.cpp:265
moveit::planning_interface::MoveGroupInterface::setOrientationTarget
bool setOrientationTarget(double x, double y, double z, double w, const std::string &end_effector_link="")
Set the goal orientation of the end-effector end_effector_link to be the quaternion (x,...
Definition: move_group_interface.cpp:2075
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl
Definition: move_group_interface.cpp:161
ROS_ERROR_STREAM
#define ROS_ERROR_STREAM(args)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::opt_
Options opt_
Definition: move_group_interface.cpp:1374
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::MoveGroupInterfaceImpl
MoveGroupInterfaceImpl(const Options &opt, const std::shared_ptr< tf2_ros::Buffer > &tf_buffer, const ros::WallDuration &wait_for_servers)
Definition: move_group_interface.cpp:166
boost::shared_ptr
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::startStateMonitor
bool startStateMonitor(double wait)
Definition: move_group_interface.cpp:713
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::clearTrajectoryConstraints
void clearTrajectoryConstraints()
Definition: move_group_interface.cpp:1297
moveit::planning_interface::MoveGroupInterface::setStartStateToCurrentState
void setStartStateToCurrentState()
Set the starting state for planning to be that reported by the robot's joint state publication.
Definition: move_group_interface.cpp:1696
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::get_params_service_
ros::ServiceClient get_params_service_
Definition: move_group_interface.cpp:1424
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPoseTarget
const geometry_msgs::PoseStamped & getPoseTarget(const std::string &end_effector_link) const
Definition: move_group_interface.cpp:657
moveit::planning_interface::MoveGroupInterface::getCurrentState
moveit::core::RobotStatePtr getCurrentState(double wait=1) const
Get the current state of the robot within the duration specified by wait.
Definition: move_group_interface.cpp:2265
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPlanningPipelineId
const std::string & getPlanningPipelineId() const
Definition: move_group_interface.cpp:426
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::plan
moveit::core::MoveItErrorCode plan(Plan &plan)
Definition: move_group_interface.cpp:887
moveit::core::JointModelGroup::getActiveJointModelNames
const std::vector< std::string > & getActiveJointModelNames() const
moveit::planning_interface::MoveGroupInterface
Client class to conveniently use the ROS interfaces provided by the move_group node.
Definition: move_group_interface.h:139
ros::ServiceClient::exists
bool exists()
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getTF
const std::shared_ptr< tf2_ros::Buffer > & getTF() const
Definition: move_group_interface.cpp:326
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getGoalOrientationTolerance
double getGoalOrientationTolerance() const
Definition: move_group_interface.cpp:1114
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setStartState
void setStartState(const moveit_msgs::RobotState &start_state)
Definition: move_group_interface.cpp:520
tf2_eigen.h
tf2::fromMsg
void fromMsg(const A &, B &b)
moveit::planning_interface::MoveGroupInterface::allowReplanning
void allowReplanning(bool flag)
Specify whether the robot is allowed to replan if it detects changes in the environment.
Definition: move_group_interface.cpp:2301
utils.h
ROS_DEBUG_STREAM_NAMED
#define ROS_DEBUG_STREAM_NAMED(name, args)
s
XmlRpcServer s
ros
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getGoalJointTolerance
double getGoalJointTolerance() const
Definition: move_group_interface.cpp:1119
ros::NodeHandle::getParam
bool getParam(const std::string &key, bool &b) const
moveit::planning_interface::MoveGroupInterface::getVariableCount
unsigned int getVariableCount() const
Get the number of variables used to describe the state of this group. This is larger or equal to the ...
Definition: move_group_interface.cpp:2260
y
y
ros.h
moveit::planning_interface::MoveGroupInterface::ROBOT_DESCRIPTION
static const std::string ROBOT_DESCRIPTION
Default ROS parameter name from where to read the robot's URDF. Set to 'robot_description'.
Definition: move_group_interface.h:161
moveit::planning_interface::GRASP_PLANNING_SERVICE_NAME
const std::string GRASP_PLANNING_SERVICE_NAME
Definition: move_group_interface.cpp:146
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::workspace_parameters_
moveit_msgs::WorkspaceParameters workspace_parameters_
Definition: move_group_interface.cpp:1386
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPathConstraints
moveit_msgs::Constraints getPathConstraints() const
Definition: move_group_interface.cpp:1317
moveit::planning_interface::LOGNAME
const std::string LOGNAME
Definition: move_group_interface.cpp:148
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPoseTargets
const std::vector< geometry_msgs::PoseStamped > & getPoseTargets(const std::string &end_effector_link) const
Definition: move_group_interface.cpp:673
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::execute
moveit::core::MoveItErrorCode execute(const moveit_msgs::RobotTrajectory &trajectory, bool wait)
Definition: move_group_interface.cpp:973
moveit::planning_interface::MoveGroupInterface::asyncExecute
moveit::core::MoveItErrorCode asyncExecute(const Plan &plan)
Given a plan, execute it without waiting for completion.
Definition: move_group_interface.cpp:1598
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPlanningPipelineId
void setPlanningPipelineId(const std::string &pipeline_id)
Definition: move_group_interface.cpp:415
constraints_storage.h
moveit::planning_interface::MoveGroupInterface::forgetJointValues
void forgetJointValues(const std::string &name)
Forget the joint values remembered under name.
Definition: move_group_interface.cpp:2277
r
r
moveit::planning_interface::MoveGroupInterface::getPlanningFrame
const std::string & getPlanningFrame() const
Get the name of the frame in which the robot is planning.
Definition: move_group_interface.cpp:2400
moveit::planning_interface::MoveGroupInterface::setLookAroundAttempts
void setLookAroundAttempts(int32_t attempts)
How often is the system allowed to move the camera to update environment model when looking.
Definition: move_group_interface.cpp:2288
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::clearPathConstraints
void clearPathConstraints()
Definition: move_group_interface.cpp:1287
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::robot_model_
moveit::core::RobotModelConstPtr robot_model_
Definition: move_group_interface.cpp:1377
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::stop
void stop()
Definition: move_group_interface.cpp:1049
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::plan_grasps_service_
ros::ServiceClient plan_grasps_service_
Definition: move_group_interface.cpp:1427
ros::NodeHandle::serviceClient
ServiceClient serviceClient(const std::string &service_name, bool persistent=false, const M_string &header_values=M_string())
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::replan_attempts_
int32_t replan_attempts_
Definition: move_group_interface.cpp:1401
moveit::planning_interface::MoveGroupInterface::setPlannerId
void setPlannerId(const std::string &planner_id)
Specify a planner to be used for further planning.
Definition: move_group_interface.cpp:1548
moveit::planning_interface::MoveGroupInterface::setGoalJointTolerance
void setGoalJointTolerance(double tolerance)
Set the joint tolerance (for each joint) that is used for reaching the goal when moving to a joint va...
Definition: move_group_interface.cpp:2133
moveit::planning_interface::MoveGroupInterface::getCurrentRPY
std::vector< double > getCurrentRPY(const std::string &end_effector_link="") const
Get the roll-pitch-yaw (XYZ) for the end-effector end_effector_link. If end_effector_link is empty (t...
Definition: move_group_interface.cpp:2223
moveit::planning_interface::MoveGroupInterface::getJointModelGroupNames
const std::vector< std::string > & getJointModelGroupNames() const
Get the available planning group names.
Definition: move_group_interface.cpp:2405
kinematic_constraints::constructGoalConstraints
moveit_msgs::Constraints constructGoalConstraints(const moveit::core::RobotState &state, const moveit::core::JointModelGroup *jmg, double tolerance=std::numeric_limits< double >::epsilon())
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::joint_model_group_
const moveit::core::JointModelGroup * joint_model_group_
Definition: move_group_interface.cpp:1406
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getOptions
const Options & getOptions() const
Definition: move_group_interface.cpp:331
moveit::planning_interface::PlanningSceneInterface
Definition: planning_scene_interface.h:116
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::can_look_
bool can_look_
Definition: move_group_interface.cpp:1398
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPathConstraints
void setPathConstraints(const moveit_msgs::Constraints &constraint)
Definition: move_group_interface.cpp:1265
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::cartesian_path_service_
ros::ServiceClient cartesian_path_service_
Definition: move_group_interface.cpp:1426
ROS_WARN_ONCE_NAMED
#define ROS_WARN_ONCE_NAMED(name,...)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getGoalPositionTolerance
double getGoalPositionTolerance() const
Definition: move_group_interface.cpp:1109
moveit::planning_interface::MoveGroupInterface::setReplanDelay
void setReplanDelay(double delay)
Sleep this duration between replanning attempts (in walltime seconds)
Definition: move_group_interface.cpp:2320
moveit::planning_interface::MoveGroupInterface::asyncMove
moveit::core::MoveItErrorCode asyncMove()
Plan and execute a trajectory that takes the group of joints declared in the constructor to the speci...
Definition: move_group_interface.cpp:1583
ROS_ERROR_NAMED
#define ROS_ERROR_NAMED(name,...)
moveit::core::RobotState
moveit::core::RobotState::copyJointGroupPositions
void copyJointGroupPositions(const std::string &joint_group_name, std::vector< double > &gstate) const
moveit::planning_interface::MoveGroupInterface::setRandomTarget
void setRandomTarget()
Set the joint state goal to a random joint configuration.
Definition: move_group_interface.cpp:1701
moveit::core::RobotState::setFromIK
bool setFromIK(const JointModelGroup *group, const geometry_msgs::Pose &pose, double timeout=0.0, const GroupStateValidityCallbackFn &constraint=GroupStateValidityCallbackFn(), const kinematics::KinematicsQueryOptions &options=kinematics::KinematicsQueryOptions())
moveit::core::RobotState::setToRandomPositions
void setToRandomPositions()
step
unsigned int step
moveit::planning_interface::MoveGroupInterface::getCurrentJointValues
std::vector< double > getCurrentJointValues() const
Get the current joint values for the joints planned for by this instance (see getJoints())
Definition: move_group_interface.cpp:2158
moveit::planning_interface::MoveGroupInterface::setPlanningTime
void setPlanningTime(double seconds)
Specify the maximum amount of time to use when planning.
Definition: move_group_interface.cpp:2384
moveit::planning_interface::MoveGroupInterface::clearPathConstraints
void clearPathConstraints()
Specify that no path constraints are to be used. This removes any path constraints set in previous ca...
Definition: move_group_interface.cpp:2353
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::constraints_init_thread_
std::unique_ptr< boost::thread > constraints_init_thread_
Definition: move_group_interface.cpp:1429
moveit::planning_interface::MoveGroupInterface::getEndEffectorLink
const std::string & getEndEffectorLink() const
Get the current end-effector link. This returns the value set by setEndEffectorLink() (or indirectly ...
Definition: move_group_interface.cpp:1896
moveit::planning_interface::MoveGroupInterface::planGraspsAndPick
moveit::core::MoveItErrorCode planGraspsAndPick(const std::string &object="", bool plan_only=false)
Pick up an object.
Definition: move_group_interface.cpp:1648
moveit::planning_interface::MoveGroupInterface::clearPoseTargets
void clearPoseTargets()
Forget any poses specified for all end-effectors.
Definition: move_group_interface.cpp:1928
moveit::planning_interface::MoveGroupInterface::DEFAULT_GOAL_POSITION_TOLERANCE
static constexpr double DEFAULT_GOAL_POSITION_TOLERANCE
Default goal position tolerance (0.1mm) if not specified with {robot description name}_kinematics/{jo...
Definition: move_group_interface.h:148
moveit::planning_interface::MoveGroupInterface::getPoseTargets
const std::vector< geometry_msgs::PoseStamped > & getPoseTargets(const std::string &end_effector_link="") const
Definition: move_group_interface.cpp:2007
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setEndEffectorLink
void setEndEffectorLink(const std::string &end_effector)
Definition: move_group_interface.cpp:598
ros::Publisher::publish
void publish(const boost::shared_ptr< M > &message) const
moveit::planning_interface::MoveGroupInterface::move
moveit::core::MoveItErrorCode move()
Plan and execute a trajectory that takes the group of joints declared in the constructor to the speci...
Definition: move_group_interface.cpp:1593
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getEndEffector
const std::string & getEndEffector() const
Definition: move_group_interface.cpp:618
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
moveit::planning_interface::MoveGroupInterface::getTargetRobotState
const moveit::core::RobotState & getTargetRobotState() const
Definition: move_group_interface.cpp:1891
moveit::planning_interface::MoveGroupInterface::rememberJointValues
void rememberJointValues(const std::string &name)
Remember the current joint values (of the robot being monitored) under name. These can be used by set...
Definition: move_group_interface.cpp:2148
ros::ok
ROSCPP_DECL bool ok()
moveit::planning_interface::MoveGroupInterface::DEFAULT_GOAL_ORIENTATION_TOLERANCE
static constexpr double DEFAULT_GOAL_ORIENTATION_TOLERANCE
Default goal orientation tolerance (~0.1deg) if not specified with {robot description name}_kinematic...
Definition: move_group_interface.h:152
moveit::planning_interface::MoveGroupInterface::setPlannerParams
void setPlannerParams(const std::string &planner_id, const std::string &group, const std::map< std::string, std::string > &params, bool bReplace=false)
Set the planner parameters for given group and planner_id.
Definition: move_group_interface.cpp:1522
moveit::planning_interface::MoveGroupInterface::Options
Specification of options to use when constructing the MoveGroupInterface class.
Definition: move_group_interface.h:164
moveit::planning_interface::MoveGroupInterface::setGoalPositionTolerance
void setGoalPositionTolerance(double tolerance)
Set the position tolerance that is used for reaching the goal when moving to a pose.
Definition: move_group_interface.cpp:2138
moveit::planning_interface::MoveGroupInterface::remembered_joint_values_
std::map< std::string, std::vector< double > > remembered_joint_values_
Definition: move_group_interface.h:1129
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::move
moveit::core::MoveItErrorCode move(bool wait)
Definition: move_group_interface.cpp:928
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::trajectory_event_publisher_
ros::Publisher trajectory_event_publisher_
Definition: move_group_interface.cpp:1421
tf2::eigenToTransform
geometry_msgs::TransformStamped eigenToTransform(const Eigen::Affine3d &T)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setMaxScalingFactor
void setMaxScalingFactor(double &variable, const double target_value, const char *factor_name, double fallback_value)
Definition: move_group_interface.cpp:476
moveit::planning_interface::MoveGroupInterface::limitMaxCartesianLinkSpeed
void limitMaxCartesianLinkSpeed(const double max_speed, const std::string &link_name="")
Limit the maximum Cartesian speed for a given link. The unit of the speed is meter per second and mus...
Definition: move_group_interface.cpp:1573
moveit::planning_interface::getSharedTF
std::shared_ptr< tf2_ros::Buffer > getSharedTF()
Definition: common_objects.cpp:99
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::pick_action_client_
std::unique_ptr< actionlib::SimpleActionClient< moveit_msgs::PickupAction > > pick_action_client_
Definition: move_group_interface.cpp:1381
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::~MoveGroupInterfaceImpl
~MoveGroupInterfaceImpl()
Definition: move_group_interface.cpp:320
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setGoalPositionTolerance
void setGoalPositionTolerance(double tolerance)
Definition: move_group_interface.cpp:1129
moveit::planning_interface::MoveGroupInterface::allowLooking
void allowLooking(bool flag)
Specify whether the robot is allowed to look around before moving if it determines it should (default...
Definition: move_group_interface.cpp:2282
moveit::planning_interface::MoveGroupInterface::setReplanAttempts
void setReplanAttempts(int32_t attempts)
Maximum number of replanning attempts.
Definition: move_group_interface.cpp:2307
moveit::planning_interface::MoveGroupInterface::getDefaultPlannerId
std::string getDefaultPlannerId(const std::string &group="") const
Get the default planner of the current planning pipeline for the given group (or the pipeline's defau...
Definition: move_group_interface.cpp:1543
move_group::QUERY_PLANNERS_SERVICE_NAME
static const std::string QUERY_PLANNERS_SERVICE_NAME
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getTrajectoryConstraints
moveit_msgs::TrajectoryConstraints getTrajectoryConstraints() const
Definition: move_group_interface.cpp:1325
moveit::core::JointModelGroup::getVariableNames
const std::vector< std::string > & getVariableNames() const
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setTrajectoryConstraints
void setTrajectoryConstraints(const moveit_msgs::TrajectoryConstraints &constraint)
Definition: move_group_interface.cpp:1292
moveit::core::RobotState::getRandomNumberGenerator
random_numbers::RandomNumberGenerator & getRandomNumberGenerator()
actionlib::SimpleActionClient
moveit::core::JointModelGroup::getName
const std::string & getName() const
move_group::MOVE_ACTION
static const std::string MOVE_ACTION
console.h
moveit::planning_interface::MoveGroupInterface::getPoseReferenceFrame
const std::string & getPoseReferenceFrame() const
Get the reference frame set by setPoseReferenceFrame(). By default this is the reference frame of the...
Definition: move_group_interface.cpp:2106
moveit::planning_interface::MoveGroupInterface::setConstraintsDatabase
void setConstraintsDatabase(const std::string &host, unsigned int port)
Specify where the database server that holds known constraints resides.
Definition: move_group_interface.cpp:2373
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::pose_targets_
std::map< std::string, std::vector< geometry_msgs::PoseStamped > > pose_targets_
Definition: move_group_interface.cpp:1410
moveit::core::JointModelGroup::getVariableDefaultPositions
bool getVariableDefaultPositions(const std::string &name, std::map< std::string, double > &values) const
moveit::planning_interface::MoveGroupInterface::setPoseReferenceFrame
void setPoseReferenceFrame(const std::string &pose_reference_frame)
Specify which reference frame to assume for poses specified without a reference frame.
Definition: move_group_interface.cpp:2101
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getDefaultPlannerId
std::string getDefaultPlannerId(const std::string &group) const
Definition: move_group_interface.cpp:431
moveit_warehouse::loadDatabase
warehouse_ros::DatabaseConnection::Ptr loadDatabase()
res
res
move_group::SET_PLANNER_PARAMS_SERVICE_NAME
static const std::string SET_PLANNER_PARAMS_SERVICE_NAME
moveit::planning_interface::MoveGroupInterface::getRobotModel
moveit::core::RobotModelConstPtr getRobotModel() const
Get the RobotModel object.
Definition: move_group_interface.cpp:1496
moveit::planning_interface::MoveGroupInterface::place
moveit::core::MoveItErrorCode place(const std::string &object, bool plan_only=false)
Place an object somewhere safe in the world (a safe location will be detected)
Definition: move_group_interface.h:963
moveit::planning_interface::MoveGroupInterface::getRandomPose
geometry_msgs::PoseStamped getRandomPose(const std::string &end_effector_link="") const
Get a random reachable pose for the end-effector end_effector_link. If end_effector_link is empty (th...
Definition: move_group_interface.cpp:2174
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::clearPoseTargets
void clearPoseTargets()
Definition: move_group_interface.cpp:608
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::end_effector_link_
std::string end_effector_link_
Definition: move_group_interface.cpp:1416
moveit::core::MoveItErrorCode
ros::CallbackQueue
moveit::planning_interface::MoveGroupInterface::getNodeHandle
const ros::NodeHandle & getNodeHandle() const
Get the ROS node handle of this instance operates on.
Definition: move_group_interface.cpp:1501
ROS_FATAL_STREAM_NAMED
#define ROS_FATAL_STREAM_NAMED(name, args)
moveit::planning_interface::MoveGroupInterface::~MoveGroupInterface
~MoveGroupInterface()
Definition: move_group_interface.cpp:1460
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::look_around_attempts_
int32_t look_around_attempts_
Definition: move_group_interface.cpp:1399
capability_names.h
ROS_DEBUG_NAMED
#define ROS_DEBUG_NAMED(name,...)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getCurrentState
bool getCurrentState(moveit::core::RobotStatePtr &current_state, double wait_seconds=1.0)
Definition: move_group_interface.cpp:729
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::constructGoal
void constructGoal(moveit_msgs::MoveGroupGoal &goal) const
Definition: move_group_interface.cpp:1206
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::place
moveit::core::MoveItErrorCode place(const moveit_msgs::PlaceGoal &goal)
Definition: move_group_interface.cpp:777
planning_scene_monitor.h
moveit::planning_interface::MoveGroupInterface::setMaxVelocityScalingFactor
void setMaxVelocityScalingFactor(double max_velocity_scaling_factor)
Set a scaling factor for optionally reducing the maximum joint velocity. Allowed values are in (0,...
Definition: move_group_interface.cpp:1563
c
c
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::num_planning_attempts_
unsigned int num_planning_attempts_
Definition: move_group_interface.cpp:1390
ros::WallTime::now
static WallTime now()
moveit::planning_interface::MoveGroupInterface::plan
moveit::core::MoveItErrorCode plan(Plan &plan)
Compute a motion plan that takes the group declared in the constructor from the current state to the ...
Definition: move_group_interface.cpp:1618
ROS_ERROR_STREAM_NAMED
#define ROS_ERROR_STREAM_NAMED(name, args)
moveit::planning_interface::MoveGroupInterface::getName
const std::string & getName() const
Get the name of the group this instance operates on.
Definition: move_group_interface.cpp:1484
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::planning_pipeline_id_
std::string planning_pipeline_id_
Definition: move_group_interface.cpp:1388
moveit::core::JointModelGroup::getJointModelNames
const std::vector< std::string > & getJointModelNames() const
trajectory_execution_manager.h
moveit::planning_interface::MoveGroupInterface::computeCartesianPath
double computeCartesianPath(const std::vector< geometry_msgs::Pose > &waypoints, double eef_step, double, moveit_msgs::RobotTrajectory &trajectory, bool avoid_collisions=true, moveit_msgs::MoveItErrorCodes *error_code=nullptr)
Compute a Cartesian path that follows specified waypoints with a step size of at most eef_step meters...
Definition: move_group_interface.h:849
moveit::planning_interface::MoveGroupInterface::setMaxAccelerationScalingFactor
void setMaxAccelerationScalingFactor(double max_acceleration_scaling_factor)
Set a scaling factor for optionally reducing the maximum joint acceleration. Allowed values are in (0...
Definition: move_group_interface.cpp:1568
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getKnownConstraints
std::vector< std::string > getKnownConstraints() const
Definition: move_group_interface.cpp:1302
moveit::planning_interface::MoveGroupInterface::Options::node_handle_
ros::NodeHandle node_handle_
Definition: move_group_interface.h:181
moveit::core::RobotState::setToDefaultValues
void setToDefaultValues()
kinematic_constraints::mergeConstraints
moveit_msgs::Constraints mergeConstraints(const moveit_msgs::Constraints &first, const moveit_msgs::Constraints &second)
moveit::planning_interface::MoveGroupInterface::setGoalTolerance
void setGoalTolerance(double tolerance)
Set the tolerance that is used for reaching the goal. For joint state goals, this will be distance fo...
Definition: move_group_interface.cpp:2126
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getJointModelGroup
const moveit::core::JointModelGroup * getJointModelGroup() const
Definition: move_group_interface.cpp:341
moveit::planning_interface::MoveGroupInterface::setApproximateJointValueTarget
bool setApproximateJointValueTarget(const geometry_msgs::Pose &eef_pose, const std::string &end_effector_link="")
Set the joint state goal for a particular joint by computing IK.
Definition: move_group_interface.cpp:1867
moveit::planning_interface::MoveGroupInterface::setEndEffectorLink
bool setEndEffectorLink(const std::string &end_effector_link)
Specify the parent link of the end-effector. This end_effector_link will be used in calls to pose tar...
Definition: move_group_interface.cpp:1906
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setMaxAccelerationScalingFactor
void setMaxAccelerationScalingFactor(double value)
Definition: move_group_interface.cpp:471
moveit::planning_interface::MoveGroupInterface::setPlanningPipelineId
void setPlanningPipelineId(const std::string &pipeline_id)
Specify a planning pipeline to be used for further planning.
Definition: move_group_interface.cpp:1533
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setSupportSurfaceName
void setSupportSurfaceName(const std::string &support_surface)
Definition: move_group_interface.cpp:693
value
float value
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::tf_buffer_
std::shared_ptr< tf2_ros::Buffer > tf_buffer_
Definition: move_group_interface.cpp:1376
ros::ServiceClient
moveit::planning_interface::MoveGroupInterface::setRPYTarget
bool setRPYTarget(double roll, double pitch, double yaw, const std::string &end_effector_link="")
Set the goal orientation of the end-effector end_effector_link to be (roll,pitch,yaw) radians.
Definition: move_group_interface.cpp:2052
setup.d
d
Definition: setup.py:4
moveit::planning_interface::MoveGroupInterface::posesToPlaceLocations
std::vector< moveit_msgs::PlaceLocation > posesToPlaceLocations(const std::vector< geometry_msgs::PoseStamped > &poses) const
Convert a vector of PoseStamped to a vector of PlaceLocation.
Definition: move_group_interface.cpp:1638
x
x
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::move_action_client_
std::unique_ptr< actionlib::SimpleActionClient< moveit_msgs::MoveGroupAction > > move_action_client_
Definition: move_group_interface.cpp:1379
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::path_constraints_
std::unique_ptr< moveit_msgs::Constraints > path_constraints_
Definition: move_group_interface.cpp:1414
moveit::planning_interface::MoveGroupInterface::DEFAULT_ALLOWED_PLANNING_TIME
static constexpr double DEFAULT_ALLOWED_PLANNING_TIME
Default allowed planning time (seconds)
Definition: move_group_interface.h:155
ros::NodeHandle::getCallbackQueue
CallbackQueueInterface * getCallbackQueue() const
tf2_ros::Buffer
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::pose_reference_frame_
std::string pose_reference_frame_
Definition: move_group_interface.cpp:1417
actionlib::SimpleClientGoalState::SUCCEEDED
SUCCEEDED
moveit::core::JointModelGroup::getVariableRandomPositions
void getVariableRandomPositions(random_numbers::RandomNumberGenerator &rng, double *values) const
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::trajectory_constraints_
std::unique_ptr< moveit_msgs::TrajectoryConstraints > trajectory_constraints_
Definition: move_group_interface.cpp:1415
moveit::core::JointModelGroup::getDefaultStateNames
const std::vector< std::string > & getDefaultStateNames() const
moveit::planning_interface::MoveGroupInterface::setTrajectoryConstraints
void setTrajectoryConstraints(const moveit_msgs::TrajectoryConstraints &constraint)
Definition: move_group_interface.cpp:2363
moveit::planning_interface::MoveGroupInterface::setPathConstraints
bool setPathConstraints(const std::string &constraint)
Specify a set of path constraints to use. The constraints are looked up by name from the Mongo databa...
Definition: move_group_interface.cpp:2343
moveit::planning_interface::MoveGroupInterface::stop
void stop()
Stop any trajectory execution, if one is active.
Definition: move_group_interface.cpp:1681
trajectory_execution_manager::TrajectoryExecutionManager::EXECUTION_EVENT_TOPIC
static const std::string EXECUTION_EVENT_TOPIC
name
name
ros::WallTime
q
q
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::clearMaxCartesianLinkSpeed
void clearMaxCartesianLinkSpeed()
Definition: move_group_interface.cpp:504
moveit::planning_interface::MoveGroupInterface::getPoseTarget
const geometry_msgs::PoseStamped & getPoseTarget(const std::string &end_effector_link="") const
Definition: move_group_interface.cpp:2001
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPlannerParams
void setPlannerParams(const std::string &planner_id, const std::string &group, const std::map< std::string, std::string > &params, bool replace=false)
Definition: move_group_interface.cpp:392
moveit::planning_interface::MoveGroupInterface::DEFAULT_GOAL_JOINT_TOLERANCE
static constexpr double DEFAULT_GOAL_JOINT_TOLERANCE
Default goal joint tolerance (0.1mm) if not specified with {robot description name}_kinematics/{joint...
Definition: move_group_interface.h:144
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::limitMaxCartesianLinkSpeed
void limitMaxCartesianLinkSpeed(const double max_speed, const std::string &link_name)
Definition: move_group_interface.cpp:498
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::active_target_
ActiveTargetType active_target_
Definition: move_group_interface.cpp:1413
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getStartState
moveit::core::RobotStatePtr getStartState()
Definition: move_group_interface.cpp:538
moveit::planning_interface::MoveGroupInterface::execute
moveit::core::MoveItErrorCode execute(const Plan &plan)
Given a plan, execute it while waiting for completion.
Definition: move_group_interface.cpp:1608
planning_scene_interface.h
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getTargetRobotState
const moveit::core::RobotState & getTargetRobotState() const
Definition: move_group_interface.cpp:515
moveit::planning_interface::MoveGroupInterface::getGoalJointTolerance
double getGoalJointTolerance() const
Get the tolerance that is used for reaching a joint goal. This is distance for each joint in configur...
Definition: move_group_interface.cpp:2111
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::joint_state_target_
moveit::core::RobotStatePtr joint_state_target_
Definition: move_group_interface.cpp:1405
moveit::planning_interface::MoveGroupInterface::clearMaxCartesianLinkSpeed
void clearMaxCartesianLinkSpeed()
Clear maximum Cartesian speed of the end effector.
Definition: move_group_interface.cpp:1578
moveit::core::Transforms::sameFrame
static bool sameFrame(const std::string &frame1, const std::string &frame2)
ROS_WARN_STREAM_NAMED
#define ROS_WARN_STREAM_NAMED(name, args)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setStartStateToCurrentState
void setStartStateToCurrentState()
Definition: move_group_interface.cpp:531
common_objects.h
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::initializeConstraintsStorage
void initializeConstraintsStorage(const std::string &host, unsigned int port)
Definition: move_group_interface.cpp:1333
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setTargetType
void setTargetType(ActiveTargetType type)
Definition: move_group_interface.cpp:703
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setGoalJointTolerance
void setGoalJointTolerance(double tolerance)
Definition: move_group_interface.cpp:1124
moveit::core::JointModelGroup::getLinkModelNames
const std::vector< std::string > & getLinkModelNames() const
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getDefaultPlanningPipelineId
std::string getDefaultPlanningPipelineId() const
Definition: move_group_interface.cpp:408
moveit::planning_interface::MoveGroupInterface::getRandomJointValues
std::vector< double > getRandomJointValues() const
Get random joint values for the joints planned for by this instance (see getJoints())
Definition: move_group_interface.cpp:2167
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::considered_start_state_
moveit_msgs::RobotState considered_start_state_
Definition: move_group_interface.cpp:1385
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::initializing_constraints_
bool initializing_constraints_
Definition: move_group_interface.cpp:1430
transform_listener.h
moveit::planning_interface::MoveGroupInterface::getPlannerId
const std::string & getPlannerId() const
Get the current planner_id.
Definition: move_group_interface.cpp:1553
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::constraints_storage_
std::unique_ptr< moveit_warehouse::ConstraintsStorage > constraints_storage_
Definition: move_group_interface.cpp:1428
moveit::planning_interface::MoveGroupInterface::getJointValueTarget
const moveit::core::RobotState & getJointValueTarget() const
Get the currently set joint state goal, replaced by private getTargetRobotState()
Definition: move_group_interface.cpp:1886
moveit::planning_interface::getSharedStateMonitor
planning_scene_monitor::CurrentStateMonitorPtr getSharedStateMonitor(const moveit::core::RobotModelConstPtr &robot_model, const std::shared_ptr< tf2_ros::Buffer > &tf_buffer)
getSharedStateMonitor is a simpler version of getSharedStateMonitor(const moveit::core::RobotModelCon...
Definition: common_objects.cpp:134
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPlannerId
const std::string & getPlannerId() const
Definition: move_group_interface.cpp:456
ros::NodeHandle::ok
bool ok() const
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getTargetType
ActiveTargetType getTargetType() const
Definition: move_group_interface.cpp:708
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::constructMotionPlanRequest
void constructMotionPlanRequest(moveit_msgs::MotionPlanRequest &request) const
Definition: move_group_interface.cpp:1150
moveit::planning_interface::MoveGroupInterface::operator=
MoveGroupInterface & operator=(const MoveGroupInterface &)=delete
moveit::planning_interface::MoveGroupInterface::clearTrajectoryConstraints
void clearTrajectoryConstraints()
Definition: move_group_interface.cpp:2368
moveit::core::RobotState::getFrameTransform
const Eigen::Isometry3d & getFrameTransform(const std::string &frame_id, bool *frame_found=nullptr)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setMaxVelocityScalingFactor
void setMaxVelocityScalingFactor(double value)
Definition: move_group_interface.cpp:466
moveit::planning_interface::MoveGroupInterface::constructPlaceGoal
moveit_msgs::PlaceGoal constructPlaceGoal(const std::string &object, std::vector< moveit_msgs::PlaceLocation > locations, bool plan_only) const
Build a PlaceGoal for an object named object and store it in goal_out.
Definition: move_group_interface.cpp:1630
moveit::planning_interface::MoveGroupInterface::getPlanningPipelineId
const std::string & getPlanningPipelineId() const
Get the current planning_pipeline_id.
Definition: move_group_interface.cpp:1538
tf2_ros::BufferInterface::transform
B & transform(const A &in, B &out, const std::string &target_frame, const ros::Time &target_time, const std::string &fixed_frame, ros::Duration timeout=ros::Duration(0.0)) const
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getInterfaceDescriptions
bool getInterfaceDescriptions(std::vector< moveit_msgs::PlannerInterfaceDescription > &desc)
Definition: move_group_interface.cpp:364
ros::Time
moveit
values
std::vector< double > values
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::can_replan_
bool can_replan_
Definition: move_group_interface.cpp:1400
moveit::planning_interface::MoveGroupInterface::getNamedTargets
const std::vector< std::string > & getNamedTargets() const
Get the names of the named robot states available as targets, both either remembered states or defaul...
Definition: move_group_interface.cpp:1489
moveit::planning_interface::MoveGroupInterface::getInterfaceDescriptions
bool getInterfaceDescriptions(std::vector< moveit_msgs::PlannerInterfaceDescription > &desc) const
Get the descriptions of all planning plugins loaded by the action server.
Definition: move_group_interface.cpp:1511
moveit::planning_interface::MoveGroupInterface::setSupportSurfaceName
void setSupportSurfaceName(const std::string &name)
For pick/place operations, the name of the support surface is used to specify the fact that attached ...
Definition: move_group_interface.cpp:2395
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::goal_joint_tolerance_
double goal_joint_tolerance_
Definition: move_group_interface.cpp:1395
current_state_monitor.h
kinematics::KinematicsQueryOptions
moveit::planning_interface::PlanningSceneInterface::getObjects
std::map< std::string, moveit_msgs::CollisionObject > getObjects(const std::vector< std::string > &object_ids=std::vector< std::string >())
Get the objects identified by the given object ids list. If no ids are provided, return all the known...
Definition: planning_scene_interface/src/planning_scene_interface.cpp:484
tf_buffer
tf2_ros::Buffer * tf_buffer
moveit::planning_interface::MoveGroupInterface::clearPoseTarget
void clearPoseTarget(const std::string &end_effector_link="")
Forget pose(s) specified for end_effector_link.
Definition: move_group_interface.cpp:1923
moveit::planning_interface::MoveGroupInterface::setNumPlanningAttempts
void setNumPlanningAttempts(unsigned int num_planning_attempts)
Set the number of times the motion plan is to be computed from scratch before the shortest solution i...
Definition: move_group_interface.cpp:1558
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::constructPlaceGoal
moveit_msgs::PlaceGoal constructPlaceGoal(const std::string &object, std::vector< moveit_msgs::PlaceLocation > &&locations, bool plan_only=false) const
Definition: move_group_interface.cpp:1238
moveit::planning_interface::MoveGroupInterface::getVariableNames
const std::vector< std::string > & getVariableNames() const
Get names of degrees of freedom in this group.
Definition: move_group_interface.cpp:1707
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::goal_orientation_tolerance_
double goal_orientation_tolerance_
Definition: move_group_interface.cpp:1397
moveit::planning_interface::MoveGroupInterface::pick
moveit::core::MoveItErrorCode pick(const std::string &object, bool plan_only=false)
Pick up an object.
Definition: move_group_interface.h:928
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPlannerParams
std::map< std::string, std::string > getPlannerParams(const std::string &planner_id, const std::string &group="")
Definition: move_group_interface.cpp:377
moveit::core::RobotState::satisfiesBounds
bool satisfiesBounds(double margin=0.0) const
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::query_service_
ros::ServiceClient query_service_
Definition: move_group_interface.cpp:1423
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::detachObject
bool detachObject(const std::string &name)
Definition: move_group_interface.cpp:1085
move_group_interface.h
moveit::planning_interface::getSharedRobotModel
moveit::core::RobotModelConstPtr getSharedRobotModel(const std::string &robot_description)
Definition: common_objects.cpp:116
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::replan_delay_
double replan_delay_
Definition: move_group_interface.cpp:1402
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPlannerId
void setPlannerId(const std::string &planner_id)
Definition: move_group_interface.cpp:451
planning_interface
move_group::EXECUTE_ACTION_NAME
static const std::string EXECUTE_ACTION_NAME
moveit::planning_interface::MoveGroupInterface::setPositionTarget
bool setPositionTarget(double x, double y, double z, const std::string &end_effector_link="")
Set the goal position of the end-effector end_effector_link to be (x, y, z).
Definition: move_group_interface.cpp:2027
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::constructPickupGoal
moveit_msgs::PickupGoal constructPickupGoal(const std::string &object, std::vector< moveit_msgs::Grasp > &&grasps, bool plan_only=false) const
Definition: move_group_interface.cpp:1211
approx
bool approx(S x, S y)
moveit::planning_interface::MoveGroupInterface::getInterfaceDescription
bool getInterfaceDescription(moveit_msgs::PlannerInterfaceDescription &desc) const
Get the description of the default planning plugin loaded by the action server.
Definition: move_group_interface.cpp:1506
ros::ServiceClient::call
bool call(const MReq &req, MRes &resp, const std::string &service_md5sum)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getRobotModel
const moveit::core::RobotModelConstPtr & getRobotModel() const
Definition: move_group_interface.cpp:336
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getInterfaceDescription
bool getInterfaceDescription(moveit_msgs::PlannerInterfaceDescription &desc)
Definition: move_group_interface.cpp:351
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPoseTargets
bool setPoseTargets(const std::vector< geometry_msgs::PoseStamped > &poses, const std::string &end_effector_link)
Definition: move_group_interface.cpp:632
moveit::core::JointModelGroup::isChain
bool isChain() const
ROS_WARN_NAMED
#define ROS_WARN_NAMED(name,...)
moveit::core::JointModelGroup
ros::NodeHandle::param
T param(const std::string &param_name, const T &default_val) const
tf2::Quaternion
tolerance
S tolerance()
ROS_INFO_STREAM_NAMED
#define ROS_INFO_STREAM_NAMED(name, args)
moveit::planning_interface::MoveGroupInterface::attachObject
bool attachObject(const std::string &object, const std::string &link="")
Given the name of an object in the planning scene, make the object attached to a link of the robot....
Definition: move_group_interface.cpp:2410
moveit::planning_interface::MoveGroupInterface::setWorkspace
void setWorkspace(double minx, double miny, double minz, double maxx, double maxy, double maxz)
Specify the workspace bounding box. The box is specified in the planning frame (i....
Definition: move_group_interface.cpp:2378
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::attached_object_publisher_
ros::Publisher attached_object_publisher_
Definition: move_group_interface.cpp:1422
move_group::PICKUP_ACTION
static const std::string PICKUP_ACTION
tf2::toMsg
B toMsg(const A &a)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::current_state_monitor_
planning_scene_monitor::CurrentStateMonitorPtr current_state_monitor_
Definition: move_group_interface.cpp:1378
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getEndEffectorLink
const std::string & getEndEffectorLink() const
Definition: move_group_interface.cpp:613
moveit::planning_interface::MoveGroupInterface::impl_
MoveGroupInterfaceImpl * impl_
Definition: move_group_interface.h:1130
param
T param(const std::string &param_name, const T &default_val)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::goal_position_tolerance_
double goal_position_tolerance_
Definition: move_group_interface.cpp:1396
conversions.h
moveit::planning_interface::MoveGroupInterface::getPathConstraints
moveit_msgs::Constraints getPathConstraints() const
Get the actual set of constraints in use with this MoveGroupInterface.
Definition: move_group_interface.cpp:2338
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setGoalOrientationTolerance
void setGoalOrientationTolerance(double tolerance)
Definition: move_group_interface.cpp:1134
moveit::planning_interface::MoveGroupInterface::getPlanningTime
double getPlanningTime() const
Get the number of seconds set by setPlanningTime()
Definition: move_group_interface.cpp:2390
moveit::planning_interface::MoveGroupInterface::MoveGroupInterface
MoveGroupInterface(const Options &opt, const std::shared_ptr< tf2_ros::Buffer > &tf_buffer=std::shared_ptr< tf2_ros::Buffer >(), const ros::WallDuration &wait_for_servers=ros::WallDuration())
Construct a MoveGroupInterface instance call using a specified set of options opt.
Definition: move_group_interface.cpp:1447
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::cartesian_speed_limited_link_
std::string cartesian_speed_limited_link_
Definition: move_group_interface.cpp:1393
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::execute_action_client_
std::unique_ptr< actionlib::SimpleActionClient< moveit_msgs::ExecuteTrajectoryAction > > execute_action_client_
Definition: move_group_interface.cpp:1380
moveit::planning_interface::MoveGroupInterface::DEFAULT_NUM_PLANNING_ATTEMPTS
static constexpr int DEFAULT_NUM_PLANNING_ATTEMPTS
Default number of planning attempts.
Definition: move_group_interface.h:158
moveit::planning_interface::MoveGroupInterface::getActiveJoints
const std::vector< std::string > & getActiveJoints() const
Get names of joints with an active (actuated) DOF in this group.
Definition: move_group_interface.cpp:2250
moveit::planning_interface::MoveGroupInterface::getLinkNames
const std::vector< std::string > & getLinkNames() const
Get vector of names of links available in move group.
Definition: move_group_interface.cpp:1712
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::MoveGroupInterface
friend MoveGroupInterface
Definition: move_group_interface.cpp:163
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::place_action_client_
std::unique_ptr< actionlib::SimpleActionClient< moveit_msgs::PlaceAction > > place_action_client_
Definition: move_group_interface.cpp:1382
DurationBase< WallDuration >::toSec
double toSec() const
moveit::planning_interface::MoveGroupInterface::setPoseTargets
bool setPoseTargets(const EigenSTL::vector_Isometry3d &end_effector_pose, const std::string &end_effector_link="")
Set goal poses for end_effector_link.
Definition: move_group_interface.cpp:1957
moveit::planning_interface::MoveGroupInterface::setNamedTarget
bool setNamedTarget(const std::string &name)
Set the current joint values to be ones previously remembered by rememberJointValues() or,...
Definition: move_group_interface.cpp:1737
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setWorkspace
void setWorkspace(double minx, double miny, double minz, double maxx, double maxy, double maxz)
Definition: move_group_interface.cpp:1342
moveit::core::JointModelGroup::getVariableCount
unsigned int getVariableCount() const
move_group::CARTESIAN_PATH_SERVICE_NAME
static const std::string CARTESIAN_PATH_SERVICE_NAME
moveit::planning_interface::MoveGroupInterface::getGoalOrientationTolerance
double getGoalOrientationTolerance() const
Get the tolerance that is used for reaching an orientation goal. This is the tolerance for roll,...
Definition: move_group_interface.cpp:2121
ros::WallDuration
moveit::core::RobotState::setJointGroupPositions
void setJointGroupPositions(const std::string &joint_group_name, const double *gstate)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::posesToPlaceLocations
std::vector< moveit_msgs::PlaceLocation > posesToPlaceLocations(const std::vector< geometry_msgs::PoseStamped > &poses) const
Convert a vector of PoseStamped to a vector of PlaceLocation.
Definition: move_group_interface.cpp:753
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::max_velocity_scaling_factor_
double max_velocity_scaling_factor_
Definition: move_group_interface.cpp:1391
seconds
FCL_EXPORT double seconds(const duration &d)
moveit::core::JointModelGroup::getEndEffectorParentGroup
const std::pair< std::string, std::string > & getEndEffectorParentGroup() const
move_group::GET_PLANNER_PARAMS_SERVICE_NAME
static const std::string GET_PLANNER_PARAMS_SERVICE_NAME
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::initializeConstraintsStorageThread
void initializeConstraintsStorageThread(const std::string &host, unsigned int port)
Definition: move_group_interface.cpp:1355
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::clearPoseTarget
void clearPoseTarget(const std::string &end_effector_link)
Definition: move_group_interface.cpp:603
moveit::planning_interface::MoveGroupInterface::getNamedTargetValues
std::map< std::string, double > getNamedTargetValues(const std::string &name) const
Get the joint angles for targets specified by name.
Definition: move_group_interface.cpp:1717
t
dictionary t
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPlanningTime
double getPlanningTime() const
Definition: move_group_interface.cpp:1145
moveit::planning_interface::MoveGroupInterface::constructMotionPlanRequest
void constructMotionPlanRequest(moveit_msgs::MotionPlanRequest &request)
Build the MotionPlanRequest that would be sent to the move_group action with plan() or move() and sto...
Definition: move_group_interface.cpp:2426
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::attachObject
bool attachObject(const std::string &object, const std::string &link, const std::vector< std::string > &touch_links)
Definition: move_group_interface.cpp:1059
ros::Duration
moveit::planning_interface::MoveGroupInterface::getCurrentPose
geometry_msgs::PoseStamped getCurrentPose(const std::string &end_effector_link="") const
Get the pose for the end-effector end_effector_link. If end_effector_link is empty (the default value...
Definition: move_group_interface.cpp:2199
z
double z
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getMoveGroupClient
actionlib::SimpleActionClient< moveit_msgs::MoveGroupAction > & getMoveGroupClient() const
Definition: move_group_interface.cpp:346
moveit::planning_interface::MoveGroupInterface::detachObject
bool detachObject(const std::string &name="")
Detach an object. name specifies the name of the object attached to this group, or the name of the li...
Definition: move_group_interface.cpp:2421
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::support_surface_
std::string support_surface_
Definition: move_group_interface.cpp:1418
moveit::planning_interface::MoveGroupInterface::setEndEffector
bool setEndEffector(const std::string &eef_name)
Specify the name of the end-effector to use. This is equivalent to setting the EndEffectorLink to the...
Definition: move_group_interface.cpp:1915
ros::CallbackQueue::callAvailable
void callAvailable()
moveit::core::robotStateToRobotStateMsg
void robotStateToRobotStateMsg(const RobotState &state, moveit_msgs::RobotState &robot_state, bool copy_attached_bodies=true)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::allowed_planning_time_
double allowed_planning_time_
Definition: move_group_interface.cpp:1387
moveit::core::JointModel
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setNumPlanningAttempts
void setNumPlanningAttempts(unsigned int num_planning_attempts)
Definition: move_group_interface.cpp:461
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::set_params_service_
ros::ServiceClient set_params_service_
Definition: move_group_interface.cpp:1425
moveit::planning_interface::MoveGroupInterface::Options::group_name_
std::string group_name_
The group to construct the class instance for.
Definition: move_group_interface.h:173
ros::NodeHandle
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::computeCartesianPath
double computeCartesianPath(const std::vector< geometry_msgs::Pose > &waypoints, double step, moveit_msgs::RobotTrajectory &msg, const moveit_msgs::Constraints &path_constraints, bool avoid_collisions, moveit_msgs::MoveItErrorCodes &error_code)
Definition: move_group_interface.cpp:1012
moveit::core::robotStateMsgToRobotState
bool robotStateMsgToRobotState(const moveit_msgs::RobotState &robot_state, RobotState &state, bool copy_attached_bodies=true)
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::pick
moveit::core::MoveItErrorCode pick(const moveit_msgs::PickupGoal &goal)
Definition: move_group_interface.cpp:808
moveit::planning_interface::MoveGroupInterface::constructPickupGoal
moveit_msgs::PickupGoal constructPickupGoal(const std::string &object, std::vector< moveit_msgs::Grasp > grasps, bool plan_only) const
Build a PickupGoal for an object named object and store it in goal_out.
Definition: move_group_interface.cpp:1623
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPoseReferenceFrame
void setPoseReferenceFrame(const std::string &pose_reference_frame)
Definition: move_group_interface.cpp:688
move_group::PLACE_ACTION
static const std::string PLACE_ACTION
ros::Time::now
static Time now()
planning_scene_monitor::PlanningSceneMonitor::DEFAULT_ATTACHED_COLLISION_OBJECT_TOPIC
static const std::string DEFAULT_ATTACHED_COLLISION_OBJECT_TOPIC
moveit::planning_interface::MoveGroupInterface::getGoalPositionTolerance
double getGoalPositionTolerance() const
Get the tolerance that is used for reaching a position goal. This is be the radius of a sphere where ...
Definition: move_group_interface.cpp:2116
test_cleanup.group
group
Definition: test_cleanup.py:8
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::node_handle_
ros::NodeHandle node_handle_
Definition: move_group_interface.cpp:1375
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::planner_id_
std::string planner_id_
Definition: move_group_interface.cpp:1389
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPoseReferenceFrame
const std::string & getPoseReferenceFrame() const
Definition: move_group_interface.cpp:698


planning_interface
Author(s): Ioan Sucan
autogenerated on Thu Nov 21 2024 03:25:11