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 
120  joint_state_target_ = std::make_shared<moveit::core::RobotState>(getRobotModel());
121  joint_state_target_->setToDefaultValues();
122  active_target_ = JOINT;
123  can_look_ = false;
125  can_replan_ = false;
126  replan_delay_ = 2.0;
127  replan_attempts_ = 1;
130  max_cartesian_speed_ = 0.0;
131 
132  std::string desc = opt.robot_description_.length() ? opt.robot_description_ : ROBOT_DESCRIPTION;
133 
134  std::string kinematics_desc = desc + "_kinematics/";
135  node_handle_.param<double>(kinematics_desc + opt.group_name_ + "/goal_joint_tolerance", goal_joint_tolerance_,
137  node_handle_.param<double>(kinematics_desc + opt.group_name_ + "/goal_position_tolerance", goal_position_tolerance_,
139  node_handle_.param<double>(kinematics_desc + opt.group_name_ + "/goal_orientation_tolerance",
141 
142  std::string planning_desc = desc + "_planning/";
143  node_handle_.param<double>(planning_desc + "default_velocity_scaling_factor", max_velocity_scaling_factor_, 0.1);
144  node_handle_.param<double>(planning_desc + "default_acceleration_scaling_factor", max_acceleration_scaling_factor_,
145  0.1);
147 
150  pose_reference_frame_ = getRobotModel()->getModelFrame();
151 
154  attached_object_publisher_ = node_handle_.advertise<moveit_msgs::AttachedCollisionObject>(
156 
158 
159  ros::WallTime timeout_for_servers = ros::WallTime::now() + wait_for_servers;
160  if (wait_for_servers == ros::WallDuration())
161  timeout_for_servers = ros::WallTime(); // wait for ever
162  double allotted_time = wait_for_servers.toSec();
163 
164  move_action_client_ = std::make_unique<actionlib::SimpleActionClient<moveit_msgs::MoveGroupAction>>(
166  waitForAction(move_action_client_, move_group::MOVE_ACTION, timeout_for_servers, allotted_time);
167 
168  pick_action_client_ = std::make_unique<actionlib::SimpleActionClient<moveit_msgs::PickupAction>>(
170  waitForAction(pick_action_client_, move_group::PICKUP_ACTION, timeout_for_servers, allotted_time);
171 
172  place_action_client_ = std::make_unique<actionlib::SimpleActionClient<moveit_msgs::PlaceAction>>(
174  waitForAction(place_action_client_, move_group::PLACE_ACTION, timeout_for_servers, allotted_time);
175 
176  execute_action_client_ = std::make_unique<actionlib::SimpleActionClient<moveit_msgs::ExecuteTrajectoryAction>>(
178  waitForAction(execute_action_client_, move_group::EXECUTE_ACTION_NAME, timeout_for_servers, allotted_time);
179 
181  node_handle_.serviceClient<moveit_msgs::QueryPlannerInterfaces>(move_group::QUERY_PLANNERS_SERVICE_NAME);
186 
189 
191 
192  ROS_INFO_STREAM_NAMED(LOGNAME, "Ready to take commands for planning group " << opt.group_name_ << ".");
193  }
194 
195  template <typename T>
196  void waitForAction(const T& action, const std::string& name, const ros::WallTime& timeout, double allotted_time) const
197  {
198  ROS_DEBUG_NAMED(LOGNAME, "Waiting for move_group action server (%s)...", name.c_str());
199 
200  // wait for the server (and spin as needed)
201  if (timeout == ros::WallTime()) // wait forever
202  {
203  while (node_handle_.ok() && !action->isServerConnected())
204  {
205  ros::WallDuration(0.001).sleep();
206  // explicit ros::spinOnce on the callback queue used by NodeHandle that manages the action client
208  if (queue)
209  {
210  queue->callAvailable();
211  }
212  else // in case of nodelets and specific callback queue implementations
213  {
214  ROS_WARN_ONCE_NAMED(LOGNAME, "Non-default CallbackQueue: Waiting for external queue "
215  "handling.");
216  }
217  }
218  }
219  else // wait with timeout
220  {
221  while (node_handle_.ok() && !action->isServerConnected() && timeout > ros::WallTime::now())
222  {
223  ros::WallDuration(0.001).sleep();
224  // explicit ros::spinOnce on the callback queue used by NodeHandle that manages the action client
226  if (queue)
227  {
228  queue->callAvailable();
229  }
230  else // in case of nodelets and specific callback queue implementations
231  {
232  ROS_WARN_ONCE_NAMED(LOGNAME, "Non-default CallbackQueue: Waiting for external queue "
233  "handling.");
234  }
235  }
236  }
237 
238  if (!action->isServerConnected())
239  {
240  std::stringstream error;
241  error << "Unable to connect to move_group action server '" << name << "' within allotted time (" << allotted_time
242  << "s)";
243  throw std::runtime_error(error.str());
244  }
245  else
246  {
247  ROS_DEBUG_NAMED(LOGNAME, "Connected to '%s'", name.c_str());
248  }
249  }
250 
252  {
254  constraints_init_thread_->join();
255  }
256 
257  const std::shared_ptr<tf2_ros::Buffer>& getTF() const
258  {
259  return tf_buffer_;
260  }
261 
262  const Options& getOptions() const
263  {
264  return opt_;
265  }
266 
267  const moveit::core::RobotModelConstPtr& getRobotModel() const
268  {
269  return robot_model_;
270  }
271 
273  {
274  return joint_model_group_;
275  }
276 
278  {
279  return *move_action_client_;
280  }
281 
282  bool getInterfaceDescription(moveit_msgs::PlannerInterfaceDescription& desc)
283  {
284  moveit_msgs::QueryPlannerInterfaces::Request req;
285  moveit_msgs::QueryPlannerInterfaces::Response res;
286  if (query_service_.call(req, res))
287  if (!res.planner_interfaces.empty())
288  {
289  desc = res.planner_interfaces.front();
290  return true;
291  }
292  return false;
293  }
294 
295  bool getInterfaceDescriptions(std::vector<moveit_msgs::PlannerInterfaceDescription>& desc)
296  {
297  moveit_msgs::QueryPlannerInterfaces::Request req;
298  moveit_msgs::QueryPlannerInterfaces::Response res;
299  if (query_service_.call(req, res))
300  if (!res.planner_interfaces.empty())
301  {
302  desc = res.planner_interfaces;
303  return true;
304  }
305  return false;
306  }
307 
308  std::map<std::string, std::string> getPlannerParams(const std::string& planner_id, const std::string& group = "")
309  {
310  moveit_msgs::GetPlannerParams::Request req;
311  moveit_msgs::GetPlannerParams::Response res;
312  req.planner_config = planner_id;
313  req.group = group;
314  std::map<std::string, std::string> result;
315  if (get_params_service_.call(req, res))
316  {
317  for (unsigned int i = 0, end = res.params.keys.size(); i < end; ++i)
318  result[res.params.keys[i]] = res.params.values[i];
319  }
320  return result;
321  }
322 
323  void setPlannerParams(const std::string& planner_id, const std::string& group,
324  const std::map<std::string, std::string>& params, bool replace = false)
325  {
326  moveit_msgs::SetPlannerParams::Request req;
327  moveit_msgs::SetPlannerParams::Response res;
328  req.planner_config = planner_id;
329  req.group = group;
330  req.replace = replace;
331  for (const std::pair<const std::string, std::string>& param : params)
332  {
333  req.params.keys.push_back(param.first);
334  req.params.values.push_back(param.second);
335  }
336  set_params_service_.call(req, res);
337  }
338 
339  std::string getDefaultPlanningPipelineId() const
340  {
341  std::string default_planning_pipeline;
342  node_handle_.getParam("move_group/default_planning_pipeline", default_planning_pipeline);
343  return default_planning_pipeline;
344  }
345 
346  void setPlanningPipelineId(const std::string& pipeline_id)
347  {
348  if (pipeline_id != planning_pipeline_id_)
349  {
350  planning_pipeline_id_ = pipeline_id;
351 
352  // Reset planner_id if planning pipeline changed
353  planner_id_ = "";
354  }
355  }
356 
357  const std::string& getPlanningPipelineId() const
358  {
359  return planning_pipeline_id_;
360  }
361 
362  std::string getDefaultPlannerId(const std::string& group) const
363  {
364  // Check what planning pipeline config should be used
365  std::string pipeline_id = getDefaultPlanningPipelineId();
366  if (!planning_pipeline_id_.empty())
367  pipeline_id = planning_pipeline_id_;
368 
369  std::stringstream param_name;
370  param_name << "move_group";
371  if (!pipeline_id.empty())
372  param_name << "/planning_pipelines/" << pipeline_id;
373  if (!group.empty())
374  param_name << "/" << group;
375  param_name << "/default_planner_config";
376 
377  std::string default_planner_config;
378  node_handle_.getParam(param_name.str(), default_planner_config);
379  return default_planner_config;
380  }
381 
382  void setPlannerId(const std::string& planner_id)
383  {
384  planner_id_ = planner_id;
385  }
386 
387  const std::string& getPlannerId() const
388  {
389  return planner_id_;
390  }
391 
392  void setNumPlanningAttempts(unsigned int num_planning_attempts)
393  {
394  num_planning_attempts_ = num_planning_attempts;
395  }
396 
397  void setMaxVelocityScalingFactor(double value)
398  {
399  setMaxScalingFactor(max_velocity_scaling_factor_, value, "velocity_scaling_factor", 0.1);
400  }
401 
402  void setMaxAccelerationScalingFactor(double value)
403  {
404  setMaxScalingFactor(max_acceleration_scaling_factor_, value, "acceleration_scaling_factor", 0.1);
405  }
406 
407  void setMaxScalingFactor(double& variable, const double target_value, const char* factor_name, double fallback_value)
408  {
409  if (target_value > 1.0)
410  {
411  ROS_WARN_NAMED(LOGNAME, "Limiting max_%s (%.2f) to 1.0.", factor_name, target_value);
412  variable = 1.0;
413  }
414  else if (target_value <= 0.0)
415  {
416  node_handle_.param<double>(std::string("robot_description_planning/default_") + factor_name, variable,
417  fallback_value);
418  if (target_value < 0.0)
419  {
420  ROS_WARN_NAMED(LOGNAME, "max_%s < 0.0! Setting to default: %.2f.", factor_name, variable);
421  }
422  }
423  else
424  {
425  variable = target_value;
426  }
427  }
428 
429  void limitMaxCartesianLinkSpeed(const double max_speed, const std::string& link_name)
430  {
431  cartesian_speed_limited_link_ = link_name;
432  max_cartesian_speed_ = max_speed;
433  }
434 
436  {
438  max_cartesian_speed_ = 0.0;
439  }
440 
442  {
443  return *joint_state_target_;
444  }
445 
447  {
448  return *joint_state_target_;
449  }
450 
451  void setStartState(const moveit::core::RobotState& start_state)
452  {
453  considered_start_state_ = std::make_shared<moveit::core::RobotState>(start_state);
454  }
455 
457  {
458  considered_start_state_.reset();
459  }
460 
461  moveit::core::RobotStatePtr getStartState()
462  {
465  else
466  {
467  moveit::core::RobotStatePtr s;
469  return s;
470  }
471  }
472 
473  bool setJointValueTarget(const geometry_msgs::Pose& eef_pose, const std::string& end_effector_link,
474  const std::string& frame, bool approx)
475  {
476  const std::string& eef = end_effector_link.empty() ? getEndEffectorLink() : end_effector_link;
477  // this only works if we have an end-effector
478  if (!eef.empty())
479  {
480  // first we set the goal to be the same as the start state
481  moveit::core::RobotStatePtr c = getStartState();
482  if (c)
483  {
484  setTargetType(JOINT);
485  c->enforceBounds();
486  getTargetRobotState() = *c;
487  if (!getTargetRobotState().satisfiesBounds(getGoalJointTolerance()))
488  return false;
489  }
490  else
491  return false;
492 
493  // we may need to do approximate IK
496 
497  // if no frame transforms are needed, call IK directly
498  if (frame.empty() || moveit::core::Transforms::sameFrame(frame, getRobotModel()->getModelFrame()))
499  return getTargetRobotState().setFromIK(getJointModelGroup(), eef_pose, eef, 0.0,
501  else
502  {
503  // transform the pose into the model frame, then do IK
504  bool frame_found;
505  const Eigen::Isometry3d& t = getTargetRobotState().getFrameTransform(frame, &frame_found);
506  if (frame_found)
507  {
508  Eigen::Isometry3d p;
509  tf2::fromMsg(eef_pose, p);
510  return getTargetRobotState().setFromIK(getJointModelGroup(), t * p, eef, 0.0,
512  }
513  else
514  {
515  ROS_ERROR_NAMED(LOGNAME, "Unable to transform from frame '%s' to frame '%s'", frame.c_str(),
516  getRobotModel()->getModelFrame().c_str());
517  return false;
518  }
519  }
520  }
521  else
522  return false;
523  }
524 
525  void setEndEffectorLink(const std::string& end_effector)
526  {
527  end_effector_link_ = end_effector;
528  }
529 
530  void clearPoseTarget(const std::string& end_effector_link)
531  {
532  pose_targets_.erase(end_effector_link);
533  }
534 
535  void clearPoseTargets()
536  {
537  pose_targets_.clear();
538  }
539 
540  const std::string& getEndEffectorLink() const
541  {
542  return end_effector_link_;
543  }
544 
545  const std::string& getEndEffector() const
546  {
547  if (!end_effector_link_.empty())
548  {
549  const std::vector<std::string>& possible_eefs =
550  getRobotModel()->getJointModelGroup(opt_.group_name_)->getAttachedEndEffectorNames();
551  for (const std::string& possible_eef : possible_eefs)
552  if (getRobotModel()->getEndEffector(possible_eef)->hasLinkModel(end_effector_link_))
553  return possible_eef;
554  }
555  static std::string empty;
556  return empty;
557  }
558 
559  bool setPoseTargets(const std::vector<geometry_msgs::PoseStamped>& poses, const std::string& end_effector_link)
560  {
561  const std::string& eef = end_effector_link.empty() ? end_effector_link_ : end_effector_link;
562  if (eef.empty())
563  {
564  ROS_ERROR_NAMED(LOGNAME, "No end-effector to set the pose for");
565  return false;
566  }
567  else
568  {
569  pose_targets_[eef] = poses;
570  // make sure we don't store an actual stamp, since that will become stale can potentially cause tf errors
571  std::vector<geometry_msgs::PoseStamped>& stored_poses = pose_targets_[eef];
572  for (geometry_msgs::PoseStamped& stored_pose : stored_poses)
573  stored_pose.header.stamp = ros::Time(0);
574  }
575  return true;
576  }
577 
578  bool hasPoseTarget(const std::string& end_effector_link) const
579  {
580  const std::string& eef = end_effector_link.empty() ? end_effector_link_ : end_effector_link;
581  return pose_targets_.find(eef) != pose_targets_.end();
582  }
583 
584  const geometry_msgs::PoseStamped& getPoseTarget(const std::string& end_effector_link) const
585  {
586  const std::string& eef = end_effector_link.empty() ? end_effector_link_ : end_effector_link;
587 
588  // if multiple pose targets are set, return the first one
589  std::map<std::string, std::vector<geometry_msgs::PoseStamped>>::const_iterator jt = pose_targets_.find(eef);
590  if (jt != pose_targets_.end())
591  if (!jt->second.empty())
592  return jt->second.at(0);
593 
594  // or return an error
595  static const geometry_msgs::PoseStamped UNKNOWN;
596  ROS_ERROR_NAMED(LOGNAME, "Pose for end-effector '%s' not known.", eef.c_str());
597  return UNKNOWN;
598  }
599 
600  const std::vector<geometry_msgs::PoseStamped>& getPoseTargets(const std::string& end_effector_link) const
601  {
602  const std::string& eef = end_effector_link.empty() ? end_effector_link_ : end_effector_link;
603 
604  std::map<std::string, std::vector<geometry_msgs::PoseStamped>>::const_iterator jt = pose_targets_.find(eef);
605  if (jt != pose_targets_.end())
606  if (!jt->second.empty())
607  return jt->second;
608 
609  // or return an error
610  static const std::vector<geometry_msgs::PoseStamped> EMPTY;
611  ROS_ERROR_NAMED(LOGNAME, "Poses for end-effector '%s' are not known.", eef.c_str());
612  return EMPTY;
613  }
614 
615  void setPoseReferenceFrame(const std::string& pose_reference_frame)
616  {
617  pose_reference_frame_ = pose_reference_frame;
618  }
619 
620  void setSupportSurfaceName(const std::string& support_surface)
621  {
622  support_surface_ = support_surface;
623  }
624 
625  const std::string& getPoseReferenceFrame() const
626  {
628  }
629 
630  void setTargetType(ActiveTargetType type)
631  {
632  active_target_ = type;
633  }
634 
635  ActiveTargetType getTargetType() const
636  {
637  return active_target_;
638  }
639 
640  bool startStateMonitor(double wait)
641  {
643  {
644  ROS_ERROR_NAMED(LOGNAME, "Unable to monitor current robot state");
645  return false;
646  }
647 
648  // if needed, start the monitor and wait up to 1 second for a full robot state
649  if (!current_state_monitor_->isActive())
650  current_state_monitor_->startStateMonitor();
651 
652  current_state_monitor_->waitForCompleteState(opt_.group_name_, wait);
653  return true;
654  }
655 
656  bool getCurrentState(moveit::core::RobotStatePtr& current_state, double wait_seconds = 1.0)
657  {
659  {
660  ROS_ERROR_NAMED(LOGNAME, "Unable to get current robot state");
661  return false;
662  }
663 
664  // if needed, start the monitor and wait up to 1 second for a full robot state
665  if (!current_state_monitor_->isActive())
666  current_state_monitor_->startStateMonitor();
667 
668  if (!current_state_monitor_->waitForCurrentState(ros::Time::now(), wait_seconds))
669  {
670  ROS_ERROR_NAMED(LOGNAME, "Failed to fetch current robot state");
671  return false;
672  }
673 
674  current_state = current_state_monitor_->getCurrentState();
675  return true;
676  }
677 
679  std::vector<moveit_msgs::PlaceLocation>
680  posesToPlaceLocations(const std::vector<geometry_msgs::PoseStamped>& poses) const
681  {
682  std::vector<moveit_msgs::PlaceLocation> locations;
683  for (const geometry_msgs::PoseStamped& pose : poses)
684  {
685  moveit_msgs::PlaceLocation location;
686  location.pre_place_approach.direction.vector.z = -1.0;
687  location.post_place_retreat.direction.vector.x = -1.0;
688  location.pre_place_approach.direction.header.frame_id = getRobotModel()->getModelFrame();
689  location.post_place_retreat.direction.header.frame_id = end_effector_link_;
690 
691  location.pre_place_approach.min_distance = 0.1;
692  location.pre_place_approach.desired_distance = 0.2;
693  location.post_place_retreat.min_distance = 0.0;
694  location.post_place_retreat.desired_distance = 0.2;
695  // location.post_place_posture is filled by the pick&place lib with the getDetachPosture from the AttachedBody
696 
697  location.place_pose = pose;
698  locations.push_back(location);
699  }
700  ROS_DEBUG_NAMED(LOGNAME, "Move group interface has %u place locations", (unsigned int)locations.size());
701  return locations;
702  }
703 
704  moveit::core::MoveItErrorCode place(const moveit_msgs::PlaceGoal& goal)
705  {
707  {
708  ROS_ERROR_STREAM_NAMED(LOGNAME, "place action client not found");
709  return moveit::core::MoveItErrorCode::FAILURE;
710  }
711  if (!place_action_client_->isServerConnected())
712  {
713  ROS_WARN_STREAM_NAMED(LOGNAME, "place action server not connected");
714  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
715  }
716 
717  place_action_client_->sendGoal(goal);
718  ROS_DEBUG_NAMED(LOGNAME, "Sent place goal with %d locations", (int)goal.place_locations.size());
719  if (!place_action_client_->waitForResult())
720  {
721  ROS_INFO_STREAM_NAMED(LOGNAME, "Place action returned early");
722  }
724  {
725  return place_action_client_->getResult()->error_code;
726  }
727  else
728  {
729  ROS_WARN_STREAM_NAMED(LOGNAME, "Fail: " << place_action_client_->getState().toString() << ": "
730  << place_action_client_->getState().getText());
731  return place_action_client_->getResult()->error_code;
732  }
733  }
734 
735  moveit::core::MoveItErrorCode pick(const moveit_msgs::PickupGoal& goal)
736  {
737  if (!pick_action_client_)
738  {
739  ROS_ERROR_STREAM_NAMED(LOGNAME, "pick action client not found");
740  return moveit::core::MoveItErrorCode::FAILURE;
741  }
742  if (!pick_action_client_->isServerConnected())
743  {
744  ROS_WARN_STREAM_NAMED(LOGNAME, "pick action server not connected");
745  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
746  }
747 
748  pick_action_client_->sendGoal(goal);
749  if (!pick_action_client_->waitForResult())
750  {
751  ROS_INFO_STREAM_NAMED(LOGNAME, "Pickup action returned early");
752  }
754  {
755  return pick_action_client_->getResult()->error_code;
756  }
757  else
758  {
759  ROS_WARN_STREAM_NAMED(LOGNAME, "Fail: " << pick_action_client_->getState().toString() << ": "
760  << pick_action_client_->getState().getText());
761  return pick_action_client_->getResult()->error_code;
762  }
763  }
764 
765  moveit::core::MoveItErrorCode planGraspsAndPick(const std::string& object, bool plan_only = false)
766  {
767  if (object.empty())
768  {
769  return planGraspsAndPick(moveit_msgs::CollisionObject());
770  }
771 
773  std::map<std::string, moveit_msgs::CollisionObject> objects = psi.getObjects(std::vector<std::string>(1, object));
774 
775  if (objects.empty())
776  {
778  "Asked for grasps for the object '" << object << "', but the object could not be found");
779  return moveit::core::MoveItErrorCode::INVALID_OBJECT_NAME;
780  }
781 
782  return planGraspsAndPick(objects[object], plan_only);
783  }
784 
785  moveit::core::MoveItErrorCode planGraspsAndPick(const moveit_msgs::CollisionObject& object, bool plan_only = false)
786  {
788  {
789  ROS_ERROR_STREAM_NAMED(LOGNAME, "Grasp planning service '"
791  << "' is not available."
792  " This has to be implemented and started separately.");
793  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
794  }
795 
796  moveit_msgs::GraspPlanning::Request request;
797  moveit_msgs::GraspPlanning::Response response;
798 
799  request.group_name = opt_.group_name_;
800  request.target = object;
801  request.support_surfaces.push_back(support_surface_);
802 
803  ROS_DEBUG_NAMED(LOGNAME, "Calling grasp planner...");
804  if (!plan_grasps_service_.call(request, response) ||
805  response.error_code.val != moveit_msgs::MoveItErrorCodes::SUCCESS)
806  {
807  ROS_ERROR_NAMED(LOGNAME, "Grasp planning failed. Unable to pick.");
808  return moveit::core::MoveItErrorCode::FAILURE;
809  }
810 
811  return pick(constructPickupGoal(object.id, std::move(response.grasps), plan_only));
812  }
813 
815  {
816  if (!move_action_client_)
817  {
818  ROS_ERROR_STREAM_NAMED(LOGNAME, "move action client not found");
819  return moveit::core::MoveItErrorCode::FAILURE;
820  }
821  if (!move_action_client_->isServerConnected())
822  {
823  ROS_WARN_STREAM_NAMED(LOGNAME, "move action server not connected");
824  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
825  }
826 
827  moveit_msgs::MoveGroupGoal goal;
828  constructGoal(goal);
829  goal.planning_options.plan_only = true;
830  goal.planning_options.look_around = false;
831  goal.planning_options.replan = false;
832  goal.planning_options.planning_scene_diff.is_diff = true;
833  goal.planning_options.planning_scene_diff.robot_state.is_diff = true;
834 
835  move_action_client_->sendGoal(goal);
836  if (!move_action_client_->waitForResult())
837  {
838  ROS_INFO_STREAM_NAMED(LOGNAME, "MoveGroup action returned early");
839  }
841  {
842  plan.trajectory_ = move_action_client_->getResult()->planned_trajectory;
843  plan.start_state_ = move_action_client_->getResult()->trajectory_start;
844  plan.planning_time_ = move_action_client_->getResult()->planning_time;
845  return move_action_client_->getResult()->error_code;
846  }
847  else
848  {
849  ROS_WARN_STREAM_NAMED(LOGNAME, "Fail: " << move_action_client_->getState().toString() << ": "
850  << move_action_client_->getState().getText());
851  return move_action_client_->getResult()->error_code;
852  }
853  }
854 
856  {
857  if (!move_action_client_)
858  {
859  ROS_ERROR_STREAM_NAMED(LOGNAME, "move action client not found");
860  return moveit::core::MoveItErrorCode::FAILURE;
861  }
862  if (!move_action_client_->isServerConnected())
863  {
864  ROS_WARN_STREAM_NAMED(LOGNAME, "move action server not connected");
865  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
866  }
867 
868  moveit_msgs::MoveGroupGoal goal;
869  constructGoal(goal);
870  goal.planning_options.plan_only = false;
871  goal.planning_options.look_around = can_look_;
872  goal.planning_options.replan = can_replan_;
873  goal.planning_options.replan_delay = replan_delay_;
874  goal.planning_options.planning_scene_diff.is_diff = true;
875  goal.planning_options.planning_scene_diff.robot_state.is_diff = true;
876 
877  move_action_client_->sendGoal(goal);
878  if (!wait)
879  {
880  return moveit::core::MoveItErrorCode::SUCCESS;
881  }
882 
883  if (!move_action_client_->waitForResult())
884  {
885  ROS_INFO_STREAM_NAMED(LOGNAME, "MoveGroup action returned early");
886  }
887 
889  {
890  return move_action_client_->getResult()->error_code;
891  }
892  else
893  {
894  ROS_INFO_STREAM_NAMED(LOGNAME, move_action_client_->getState().toString()
895  << ": " << move_action_client_->getState().getText());
896  return move_action_client_->getResult()->error_code;
897  }
898  }
899 
900  moveit::core::MoveItErrorCode execute(const moveit_msgs::RobotTrajectory& trajectory, bool wait)
901  {
903  {
904  ROS_ERROR_STREAM_NAMED(LOGNAME, "execute action client not found");
905  return moveit::core::MoveItErrorCode::FAILURE;
906  }
907  if (!execute_action_client_->isServerConnected())
908  {
909  ROS_WARN_STREAM_NAMED(LOGNAME, "execute action server not connected");
910  return moveit::core::MoveItErrorCode::COMMUNICATION_FAILURE;
911  }
912 
913  moveit_msgs::ExecuteTrajectoryGoal goal;
914  goal.trajectory = trajectory;
915 
916  execute_action_client_->sendGoal(goal);
917  if (!wait)
918  {
919  return moveit::core::MoveItErrorCode::SUCCESS;
920  }
921 
922  if (!execute_action_client_->waitForResult())
923  {
924  ROS_INFO_STREAM_NAMED(LOGNAME, "ExecuteTrajectory action returned early");
925  }
926 
928  {
929  return execute_action_client_->getResult()->error_code;
930  }
931  else
932  {
934  << ": " << execute_action_client_->getState().getText());
935  return execute_action_client_->getResult()->error_code;
936  }
937  }
938 
939  double computeCartesianPath(const std::vector<geometry_msgs::Pose>& waypoints, double step, double jump_threshold,
940  moveit_msgs::RobotTrajectory& msg, const moveit_msgs::Constraints& path_constraints,
941  bool avoid_collisions, moveit_msgs::MoveItErrorCodes& error_code)
942  {
943  moveit_msgs::GetCartesianPath::Request req;
944  moveit_msgs::GetCartesianPath::Response res;
945 
948  else
949  req.start_state.is_diff = true;
950 
951  req.group_name = opt_.group_name_;
952  req.header.frame_id = getPoseReferenceFrame();
953  req.header.stamp = ros::Time::now();
954  req.waypoints = waypoints;
955  req.max_step = step;
956  req.jump_threshold = jump_threshold;
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 
1097  else
1098  request.start_state.is_diff = true;
1099 
1100  if (active_target_ == JOINT)
1101  {
1102  request.goal_constraints.resize(1);
1103  request.goal_constraints[0] = kinematic_constraints::constructGoalConstraints(
1105  }
1106  else if (active_target_ == POSE || active_target_ == POSITION || active_target_ == ORIENTATION)
1107  {
1108  // find out how many goals are specified
1109  std::size_t goal_count = 0;
1110  for (const auto& pose_target : pose_targets_)
1111  goal_count = std::max(goal_count, pose_target.second.size());
1112 
1113  // start filling the goals;
1114  // each end effector has a number of possible poses (K) as valid goals
1115  // but there could be multiple end effectors specified, so we want each end effector
1116  // to reach the goal that corresponds to the goals of the other end effectors
1117  request.goal_constraints.resize(goal_count);
1118 
1119  for (const auto& pose_target : pose_targets_)
1120  {
1121  for (std::size_t i = 0; i < pose_target.second.size(); ++i)
1122  {
1123  moveit_msgs::Constraints c = kinematic_constraints::constructGoalConstraints(
1124  pose_target.first, pose_target.second[i], goal_position_tolerance_, goal_orientation_tolerance_);
1125  if (active_target_ == ORIENTATION)
1126  c.position_constraints.clear();
1127  if (active_target_ == POSITION)
1128  c.orientation_constraints.clear();
1129  request.goal_constraints[i] = kinematic_constraints::mergeConstraints(request.goal_constraints[i], c);
1130  }
1131  }
1132  }
1133  else
1134  ROS_ERROR_NAMED(LOGNAME, "Unable to construct MotionPlanRequest representation");
1135 
1136  if (path_constraints_)
1137  request.path_constraints = *path_constraints_;
1139  request.trajectory_constraints = *trajectory_constraints_;
1140  }
1141 
1142  void constructGoal(moveit_msgs::MoveGroupGoal& goal) const
1143  {
1144  constructMotionPlanRequest(goal.request);
1145  }
1146 
1147  moveit_msgs::PickupGoal constructPickupGoal(const std::string& object, std::vector<moveit_msgs::Grasp>&& grasps,
1148  bool plan_only = false) const
1149  {
1150  moveit_msgs::PickupGoal goal;
1151  goal.target_name = object;
1152  goal.group_name = opt_.group_name_;
1153  goal.end_effector = getEndEffector();
1154  goal.support_surface_name = support_surface_;
1155  goal.possible_grasps = std::move(grasps);
1156  if (!support_surface_.empty())
1157  goal.allow_gripper_support_collision = true;
1158 
1159  if (path_constraints_)
1160  goal.path_constraints = *path_constraints_;
1161 
1162  goal.planner_id = planner_id_;
1163  goal.allowed_planning_time = allowed_planning_time_;
1164 
1165  goal.planning_options.plan_only = plan_only;
1166  goal.planning_options.look_around = can_look_;
1167  goal.planning_options.replan = can_replan_;
1168  goal.planning_options.replan_delay = replan_delay_;
1169  goal.planning_options.planning_scene_diff.is_diff = true;
1170  goal.planning_options.planning_scene_diff.robot_state.is_diff = true;
1171  return goal;
1172  }
1173 
1174  moveit_msgs::PlaceGoal constructPlaceGoal(const std::string& object,
1175  std::vector<moveit_msgs::PlaceLocation>&& locations,
1176  bool plan_only = false) const
1177  {
1178  moveit_msgs::PlaceGoal goal;
1179  goal.group_name = opt_.group_name_;
1180  goal.attached_object_name = object;
1181  goal.support_surface_name = support_surface_;
1182  goal.place_locations = std::move(locations);
1183  if (!support_surface_.empty())
1184  goal.allow_gripper_support_collision = true;
1185 
1186  if (path_constraints_)
1187  goal.path_constraints = *path_constraints_;
1188 
1189  goal.planner_id = planner_id_;
1190  goal.allowed_planning_time = allowed_planning_time_;
1191 
1192  goal.planning_options.plan_only = plan_only;
1193  goal.planning_options.look_around = can_look_;
1194  goal.planning_options.replan = can_replan_;
1195  goal.planning_options.replan_delay = replan_delay_;
1196  goal.planning_options.planning_scene_diff.is_diff = true;
1197  goal.planning_options.planning_scene_diff.robot_state.is_diff = true;
1198  return goal;
1199  }
1200 
1201  void setPathConstraints(const moveit_msgs::Constraints& constraint)
1202  {
1203  path_constraints_ = std::make_unique<moveit_msgs::Constraints>(constraint);
1204  }
1205 
1206  bool setPathConstraints(const std::string& constraint)
1207  {
1209  {
1211  if (constraints_storage_->getConstraints(msg_m, constraint, robot_model_->getName(), opt_.group_name_))
1212  {
1213  path_constraints_ = std::make_unique<moveit_msgs::Constraints>(static_cast<moveit_msgs::Constraints>(*msg_m));
1214  return true;
1215  }
1216  else
1217  return false;
1218  }
1219  else
1220  return false;
1221  }
1222 
1223  void clearPathConstraints()
1224  {
1225  path_constraints_.reset();
1226  }
1227 
1228  void setTrajectoryConstraints(const moveit_msgs::TrajectoryConstraints& constraint)
1229  {
1230  trajectory_constraints_ = std::make_unique<moveit_msgs::TrajectoryConstraints>(constraint);
1231  }
1232 
1234  {
1235  trajectory_constraints_.reset();
1236  }
1237 
1238  std::vector<std::string> getKnownConstraints() const
1239  {
1241  {
1242  static ros::WallDuration d(0.01);
1243  d.sleep();
1244  }
1245 
1246  std::vector<std::string> c;
1248  constraints_storage_->getKnownConstraints(c, robot_model_->getName(), opt_.group_name_);
1249 
1250  return c;
1251  }
1252 
1253  moveit_msgs::Constraints getPathConstraints() const
1254  {
1255  if (path_constraints_)
1256  return *path_constraints_;
1257  else
1258  return moveit_msgs::Constraints();
1259  }
1260 
1261  moveit_msgs::TrajectoryConstraints getTrajectoryConstraints() const
1262  {
1264  return *trajectory_constraints_;
1265  else
1266  return moveit_msgs::TrajectoryConstraints();
1267  }
1268 
1269  void initializeConstraintsStorage(const std::string& host, unsigned int port)
1270  {
1273  constraints_init_thread_->join();
1275  std::make_unique<boost::thread>([this, host, port] { initializeConstraintsStorageThread(host, port); });
1276  }
1277 
1278  void setWorkspace(double minx, double miny, double minz, double maxx, double maxy, double maxz)
1279  {
1280  workspace_parameters_.header.frame_id = getRobotModel()->getModelFrame();
1281  workspace_parameters_.header.stamp = ros::Time::now();
1282  workspace_parameters_.min_corner.x = minx;
1283  workspace_parameters_.min_corner.y = miny;
1284  workspace_parameters_.min_corner.z = minz;
1285  workspace_parameters_.max_corner.x = maxx;
1286  workspace_parameters_.max_corner.y = maxy;
1287  workspace_parameters_.max_corner.z = maxz;
1288  }
1289 
1290 private:
1291  void initializeConstraintsStorageThread(const std::string& host, unsigned int port)
1292  {
1293  // Set up db
1294  try
1295  {
1297  conn->setParams(host, port);
1298  if (conn->connect())
1299  {
1300  constraints_storage_ = std::make_unique<moveit_warehouse::ConstraintsStorage>(conn);
1301  }
1302  }
1303  catch (std::exception& ex)
1304  {
1305  ROS_ERROR_NAMED(LOGNAME, "%s", ex.what());
1306  }
1307  initializing_constraints_ = false;
1308  }
1309 
1310  Options opt_;
1312  std::shared_ptr<tf2_ros::Buffer> tf_buffer_;
1313  moveit::core::RobotModelConstPtr robot_model_;
1314  planning_scene_monitor::CurrentStateMonitorPtr current_state_monitor_;
1315  std::unique_ptr<actionlib::SimpleActionClient<moveit_msgs::MoveGroupAction>> move_action_client_;
1316  std::unique_ptr<actionlib::SimpleActionClient<moveit_msgs::ExecuteTrajectoryAction>> execute_action_client_;
1317  std::unique_ptr<actionlib::SimpleActionClient<moveit_msgs::PickupAction>> pick_action_client_;
1318  std::unique_ptr<actionlib::SimpleActionClient<moveit_msgs::PlaceAction>> place_action_client_;
1319 
1320  // general planning params
1321  moveit::core::RobotStatePtr considered_start_state_;
1322  moveit_msgs::WorkspaceParameters workspace_parameters_;
1323  double allowed_planning_time_;
1324  std::string planning_pipeline_id_;
1325  std::string planner_id_;
1326  unsigned int num_planning_attempts_;
1330  double max_cartesian_speed_;
1331  double goal_joint_tolerance_;
1332  double goal_position_tolerance_;
1334  bool can_look_;
1336  bool can_replan_;
1338  double replan_delay_;
1339 
1340  // joint state goal
1341  moveit::core::RobotStatePtr joint_state_target_;
1343 
1344  // pose goal;
1345  // for each link we have a set of possible goal locations;
1346  std::map<std::string, std::vector<geometry_msgs::PoseStamped>> pose_targets_;
1347 
1348  // common properties for goals
1349  ActiveTargetType active_target_;
1350  std::unique_ptr<moveit_msgs::Constraints> path_constraints_;
1351  std::unique_ptr<moveit_msgs::TrajectoryConstraints> trajectory_constraints_;
1352  std::string end_effector_link_;
1353  std::string pose_reference_frame_;
1354  std::string support_surface_;
1355 
1356  // ROS communication
1364  std::unique_ptr<moveit_warehouse::ConstraintsStorage> constraints_storage_;
1365  std::unique_ptr<boost::thread> constraints_init_thread_;
1367 };
1368 
1369 MoveGroupInterface::MoveGroupInterface(const std::string& group_name, const std::shared_ptr<tf2_ros::Buffer>& tf_buffer,
1370  const ros::WallDuration& wait_for_servers)
1371 {
1372  if (!ros::ok())
1373  throw std::runtime_error("ROS does not seem to be running");
1374  impl_ = new MoveGroupInterfaceImpl(Options(group_name), tf_buffer ? tf_buffer : getSharedTF(), wait_for_servers);
1375 }
1376 
1377 MoveGroupInterface::MoveGroupInterface(const std::string& group, const std::shared_ptr<tf2_ros::Buffer>& tf_buffer,
1378  const ros::Duration& wait_for_servers)
1379  : MoveGroupInterface(group, tf_buffer, ros::WallDuration(wait_for_servers.toSec()))
1383 MoveGroupInterface::MoveGroupInterface(const Options& opt, const std::shared_ptr<tf2_ros::Buffer>& tf_buffer,
1384  const ros::WallDuration& wait_for_servers)
1386  impl_ = new MoveGroupInterfaceImpl(opt, tf_buffer ? tf_buffer : getSharedTF(), wait_for_servers);
1387 }
1388 
1390  const std::shared_ptr<tf2_ros::Buffer>& tf_buffer,
1391  const ros::Duration& wait_for_servers)
1392  : MoveGroupInterface(opt, tf_buffer, ros::WallDuration(wait_for_servers.toSec()))
1398  delete impl_;
1402  : remembered_joint_values_(std::move(other.remembered_joint_values_)), impl_(other.impl_)
1404  other.impl_ = nullptr;
1408 {
1409  if (this != &other)
1410  {
1411  delete impl_;
1412  impl_ = other.impl_;
1413  remembered_joint_values_ = std::move(other.remembered_joint_values_);
1414  other.impl_ = nullptr;
1415  }
1416 
1417  return *this;
1420 const std::string& MoveGroupInterface::getName() const
1423 }
1424 
1425 const std::vector<std::string>& MoveGroupInterface::getNamedTargets() const
1427  // The pointer returned by getJointModelGroup is guaranteed by the class
1428  // constructor to always be non-null
1432 moveit::core::RobotModelConstPtr MoveGroupInterface::getRobotModel() const
1435 }
1436 
1438 {
1439  return impl_->getOptions().node_handle_;
1440 }
1441 
1442 bool MoveGroupInterface::getInterfaceDescription(moveit_msgs::PlannerInterfaceDescription& desc) const
1443 {
1444  return impl_->getInterfaceDescription(desc);
1446 
1447 bool MoveGroupInterface::getInterfaceDescriptions(std::vector<moveit_msgs::PlannerInterfaceDescription>& desc) const
1448 {
1449  return impl_->getInterfaceDescriptions(desc);
1450 }
1452 std::map<std::string, std::string> MoveGroupInterface::getPlannerParams(const std::string& planner_id,
1453  const std::string& group) const
1454 {
1455  return impl_->getPlannerParams(planner_id, group);
1456 }
1458 void MoveGroupInterface::setPlannerParams(const std::string& planner_id, const std::string& group,
1459  const std::map<std::string, std::string>& params, bool replace)
1460 {
1461  impl_->setPlannerParams(planner_id, group, params, replace);
1462 }
1463 
1465 {
1467 }
1468 
1469 void MoveGroupInterface::setPlanningPipelineId(const std::string& pipeline_id)
1470 {
1471  impl_->setPlanningPipelineId(pipeline_id);
1472 }
1473 
1474 const std::string& MoveGroupInterface::getPlanningPipelineId() const
1476  return impl_->getPlanningPipelineId();
1477 }
1478 
1479 std::string MoveGroupInterface::getDefaultPlannerId(const std::string& group) const
1480 {
1481  return impl_->getDefaultPlannerId(group);
1482 }
1483 
1484 void MoveGroupInterface::setPlannerId(const std::string& planner_id)
1485 {
1486  impl_->setPlannerId(planner_id);
1487 }
1489 const std::string& MoveGroupInterface::getPlannerId() const
1490 {
1491  return impl_->getPlannerId();
1492 }
1494 void MoveGroupInterface::setNumPlanningAttempts(unsigned int num_planning_attempts)
1495 {
1496  impl_->setNumPlanningAttempts(num_planning_attempts);
1497 }
1498 
1499 void MoveGroupInterface::setMaxVelocityScalingFactor(double max_velocity_scaling_factor)
1501  impl_->setMaxVelocityScalingFactor(max_velocity_scaling_factor);
1502 }
1503 
1504 void MoveGroupInterface::setMaxAccelerationScalingFactor(double max_acceleration_scaling_factor)
1506  impl_->setMaxAccelerationScalingFactor(max_acceleration_scaling_factor);
1507 }
1508 
1509 void MoveGroupInterface::limitMaxCartesianLinkSpeed(const double max_speed, const std::string& link_name)
1511  impl_->limitMaxCartesianLinkSpeed(max_speed, link_name);
1512 }
1513 
1517 }
1518 
1521  return impl_->move(false);
1522 }
1523 
1525 {
1527 }
1528 
1530 {
1531  return impl_->move(true);
1533 
1535 {
1536  return impl_->execute(plan.trajectory_, false);
1538 
1539 moveit::core::MoveItErrorCode MoveGroupInterface::asyncExecute(const moveit_msgs::RobotTrajectory& trajectory)
1540 {
1541  return impl_->execute(trajectory, false);
1543 
1545 {
1546  return impl_->execute(plan.trajectory_, true);
1548 
1549 moveit::core::MoveItErrorCode MoveGroupInterface::execute(const moveit_msgs::RobotTrajectory& trajectory)
1550 {
1551  return impl_->execute(trajectory, true);
1553 
1555 {
1556  return impl_->plan(plan);
1558 
1559 moveit_msgs::PickupGoal MoveGroupInterface::constructPickupGoal(const std::string& object,
1560  std::vector<moveit_msgs::Grasp> grasps,
1561  bool plan_only = false) const
1563  return impl_->constructPickupGoal(object, std::move(grasps), plan_only);
1564 }
1565 
1566 moveit_msgs::PlaceGoal MoveGroupInterface::constructPlaceGoal(const std::string& object,
1567  std::vector<moveit_msgs::PlaceLocation> locations,
1568  bool plan_only = false) const
1569 {
1570  return impl_->constructPlaceGoal(object, std::move(locations), plan_only);
1571 }
1573 std::vector<moveit_msgs::PlaceLocation>
1574 MoveGroupInterface::posesToPlaceLocations(const std::vector<geometry_msgs::PoseStamped>& poses) const
1575 {
1576  return impl_->posesToPlaceLocations(poses);
1578 
1579 moveit::core::MoveItErrorCode MoveGroupInterface::pick(const moveit_msgs::PickupGoal& goal)
1580 {
1581  return impl_->pick(goal);
1583 
1584 moveit::core::MoveItErrorCode MoveGroupInterface::planGraspsAndPick(const std::string& object, bool plan_only)
1585 {
1586  return impl_->planGraspsAndPick(object, plan_only);
1588 
1589 moveit::core::MoveItErrorCode MoveGroupInterface::planGraspsAndPick(const moveit_msgs::CollisionObject& object,
1590  bool plan_only)
1591 {
1592  return impl_->planGraspsAndPick(object, plan_only);
1593 }
1594 
1595 moveit::core::MoveItErrorCode MoveGroupInterface::place(const moveit_msgs::PlaceGoal& goal)
1596 {
1597  return impl_->place(goal);
1598 }
1599 
1600 double MoveGroupInterface::computeCartesianPath(const std::vector<geometry_msgs::Pose>& waypoints, double eef_step,
1601  double jump_threshold, moveit_msgs::RobotTrajectory& trajectory,
1602  bool avoid_collisions, moveit_msgs::MoveItErrorCodes* error_code)
1603 {
1604  return computeCartesianPath(waypoints, eef_step, jump_threshold, trajectory, moveit_msgs::Constraints(),
1605  avoid_collisions, error_code);
1606 }
1608 double MoveGroupInterface::computeCartesianPath(const std::vector<geometry_msgs::Pose>& waypoints, double eef_step,
1609  double jump_threshold, moveit_msgs::RobotTrajectory& trajectory,
1610  const moveit_msgs::Constraints& path_constraints, bool avoid_collisions,
1611  moveit_msgs::MoveItErrorCodes* error_code)
1613  moveit_msgs::MoveItErrorCodes err_tmp;
1614  moveit_msgs::MoveItErrorCodes& err = error_code ? *error_code : err_tmp;
1615  return impl_->computeCartesianPath(waypoints, eef_step, jump_threshold, trajectory, path_constraints,
1616  avoid_collisions, err);
1618 
1620 {
1621  impl_->stop();
1623 
1624 void MoveGroupInterface::setStartState(const moveit_msgs::RobotState& start_state)
1625 {
1626  moveit::core::RobotStatePtr rs;
1627  if (start_state.is_diff)
1628  impl_->getCurrentState(rs);
1629  else
1630  {
1631  rs = std::make_shared<moveit::core::RobotState>(getRobotModel());
1632  rs->setToDefaultValues(); // initialize robot state values for conversion
1633  }
1635  setStartState(*rs);
1636 }
1637 
1639 {
1640  impl_->setStartState(start_state);
1641 }
1644 {
1646 }
1649 {
1651  impl_->setTargetType(JOINT);
1653 
1654 const std::vector<std::string>& MoveGroupInterface::getVariableNames() const
1655 {
1658 
1659 const std::vector<std::string>& MoveGroupInterface::getLinkNames() const
1660 {
1662 }
1664 std::map<std::string, double> MoveGroupInterface::getNamedTargetValues(const std::string& name) const
1665 {
1666  std::map<std::string, std::vector<double>>::const_iterator it = remembered_joint_values_.find(name);
1667  std::map<std::string, double> positions;
1669  if (it != remembered_joint_values_.cend())
1670  {
1671  std::vector<std::string> names = impl_->getJointModelGroup()->getVariableNames();
1672  for (size_t x = 0; x < names.size(); ++x)
1673  {
1674  positions[names[x]] = it->second[x];
1675  }
1676  }
1677  else
1678  {
1680  }
1681  return positions;
1682 }
1683 
1684 bool MoveGroupInterface::setNamedTarget(const std::string& name)
1685 {
1686  std::map<std::string, std::vector<double>>::const_iterator it = remembered_joint_values_.find(name);
1687  if (it != remembered_joint_values_.end())
1688  {
1689  return setJointValueTarget(it->second);
1690  }
1691  else
1692  {
1694  {
1695  impl_->setTargetType(JOINT);
1696  return true;
1697  }
1698  ROS_ERROR_NAMED(LOGNAME, "The requested named target '%s' does not exist", name.c_str());
1699  return false;
1700  }
1701 }
1702 
1703 void MoveGroupInterface::getJointValueTarget(std::vector<double>& group_variable_values) const
1704 {
1707 
1708 bool MoveGroupInterface::setJointValueTarget(const std::vector<double>& joint_values)
1709 {
1710  auto const n_group_joints = impl_->getJointModelGroup()->getVariableCount();
1711  if (joint_values.size() != n_group_joints)
1712  {
1713  ROS_DEBUG_STREAM_NAMED(LOGNAME, "Provided joint value list has length " << joint_values.size() << " but group "
1715  << " has " << n_group_joints << " joints");
1716  return false;
1717  }
1718  impl_->setTargetType(JOINT);
1721 }
1723 bool MoveGroupInterface::setJointValueTarget(const std::map<std::string, double>& variable_values)
1724 {
1725  const auto& allowed = impl_->getJointModelGroup()->getVariableNames();
1726  for (const auto& pair : variable_values)
1727  {
1728  if (std::find(allowed.begin(), allowed.end(), pair.first) == allowed.end())
1729  {
1730  ROS_ERROR_STREAM("joint variable " << pair.first << " is not part of group "
1731  << impl_->getJointModelGroup()->getName());
1732  return false;
1733  }
1734  }
1735 
1736  impl_->setTargetType(JOINT);
1737  impl_->getTargetRobotState().setVariablePositions(variable_values);
1739 }
1740 
1741 bool MoveGroupInterface::setJointValueTarget(const std::vector<std::string>& variable_names,
1742  const std::vector<double>& variable_values)
1743 {
1744  if (variable_names.size() != variable_values.size())
1745  {
1746  ROS_ERROR_STREAM("sizes of name and position arrays do not match");
1747  return false;
1748  }
1749  const auto& allowed = impl_->getJointModelGroup()->getVariableNames();
1750  for (const auto& variable_name : variable_names)
1751  {
1752  if (std::find(allowed.begin(), allowed.end(), variable_name) == allowed.end())
1753  {
1754  ROS_ERROR_STREAM("joint variable " << variable_name << " is not part of group "
1755  << impl_->getJointModelGroup()->getName());
1756  return false;
1757  }
1758  }
1759 
1760  impl_->setTargetType(JOINT);
1761  impl_->getTargetRobotState().setVariablePositions(variable_names, variable_values);
1763 }
1764 
1766 {
1767  impl_->setTargetType(JOINT);
1768  impl_->getTargetRobotState() = rstate;
1770 }
1772 bool MoveGroupInterface::setJointValueTarget(const std::string& joint_name, double value)
1773 {
1774  std::vector<double> values(1, value);
1775  return setJointValueTarget(joint_name, values);
1777 
1778 bool MoveGroupInterface::setJointValueTarget(const std::string& joint_name, const std::vector<double>& values)
1779 {
1780  impl_->setTargetType(JOINT);
1781  const moveit::core::JointModel* jm = impl_->getJointModelGroup()->getJointModel(joint_name);
1782  if (jm && jm->getVariableCount() == values.size())
1783  {
1786  }
1787 
1788  ROS_ERROR_STREAM("joint " << joint_name << " is not part of group " << impl_->getJointModelGroup()->getName());
1789  return false;
1790 }
1792 bool MoveGroupInterface::setJointValueTarget(const sensor_msgs::JointState& state)
1793 {
1794  return setJointValueTarget(state.name, state.position);
1795 }
1796 
1797 bool MoveGroupInterface::setJointValueTarget(const geometry_msgs::Pose& eef_pose, const std::string& end_effector_link)
1798 {
1799  return impl_->setJointValueTarget(eef_pose, end_effector_link, "", false);
1800 }
1801 
1802 bool MoveGroupInterface::setJointValueTarget(const geometry_msgs::PoseStamped& eef_pose,
1803  const std::string& end_effector_link)
1804 {
1805  return impl_->setJointValueTarget(eef_pose.pose, end_effector_link, eef_pose.header.frame_id, false);
1806 }
1807 
1808 bool MoveGroupInterface::setJointValueTarget(const Eigen::Isometry3d& eef_pose, const std::string& end_effector_link)
1810  geometry_msgs::Pose msg = tf2::toMsg(eef_pose);
1811  return setJointValueTarget(msg, end_effector_link);
1812 }
1813 
1814 bool MoveGroupInterface::setApproximateJointValueTarget(const geometry_msgs::Pose& eef_pose,
1815  const std::string& end_effector_link)
1816 {
1817  return impl_->setJointValueTarget(eef_pose, end_effector_link, "", true);
1818 }
1819 
1820 bool MoveGroupInterface::setApproximateJointValueTarget(const geometry_msgs::PoseStamped& eef_pose,
1821  const std::string& end_effector_link)
1822 {
1823  return impl_->setJointValueTarget(eef_pose.pose, end_effector_link, eef_pose.header.frame_id, true);
1824 }
1825 
1826 bool MoveGroupInterface::setApproximateJointValueTarget(const Eigen::Isometry3d& eef_pose,
1827  const std::string& end_effector_link)
1828 {
1829  geometry_msgs::Pose msg = tf2::toMsg(eef_pose);
1830  return setApproximateJointValueTarget(msg, end_effector_link);
1831 }
1832 
1834 {
1835  return impl_->getTargetRobotState();
1836 }
1837 
1839 {
1841 }
1842 
1843 const std::string& MoveGroupInterface::getEndEffectorLink() const
1844 {
1845  return impl_->getEndEffectorLink();
1847 
1848 const std::string& MoveGroupInterface::getEndEffector() const
1849 {
1850  return impl_->getEndEffector();
1851 }
1852 
1853 bool MoveGroupInterface::setEndEffectorLink(const std::string& link_name)
1854 {
1855  if (impl_->getEndEffectorLink().empty() || link_name.empty())
1856  return false;
1857  impl_->setEndEffectorLink(link_name);
1858  impl_->setTargetType(POSE);
1859  return true;
1861 
1862 bool MoveGroupInterface::setEndEffector(const std::string& eef_name)
1863 {
1864  const moveit::core::JointModelGroup* jmg = impl_->getRobotModel()->getEndEffector(eef_name);
1865  if (jmg)
1866  return setEndEffectorLink(jmg->getEndEffectorParentGroup().second);
1867  return false;
1868 }
1869 
1870 void MoveGroupInterface::clearPoseTarget(const std::string& end_effector_link)
1871 {
1872  impl_->clearPoseTarget(end_effector_link);
1873 }
1874 
1878 }
1879 
1880 bool MoveGroupInterface::setPoseTarget(const Eigen::Isometry3d& pose, const std::string& end_effector_link)
1881 {
1882  std::vector<geometry_msgs::PoseStamped> pose_msg(1);
1883  pose_msg[0].pose = tf2::toMsg(pose);
1884  pose_msg[0].header.frame_id = getPoseReferenceFrame();
1885  pose_msg[0].header.stamp = ros::Time::now();
1886  return setPoseTargets(pose_msg, end_effector_link);
1887 }
1889 bool MoveGroupInterface::setPoseTarget(const geometry_msgs::Pose& target, const std::string& end_effector_link)
1890 {
1891  std::vector<geometry_msgs::PoseStamped> pose_msg(1);
1892  pose_msg[0].pose = target;
1893  pose_msg[0].header.frame_id = getPoseReferenceFrame();
1894  pose_msg[0].header.stamp = ros::Time::now();
1895  return setPoseTargets(pose_msg, end_effector_link);
1896 }
1897 
1898 bool MoveGroupInterface::setPoseTarget(const geometry_msgs::PoseStamped& target, const std::string& end_effector_link)
1899 {
1900  std::vector<geometry_msgs::PoseStamped> targets(1, target);
1901  return setPoseTargets(targets, end_effector_link);
1902 }
1903 
1904 bool MoveGroupInterface::setPoseTargets(const EigenSTL::vector_Isometry3d& target, const std::string& end_effector_link)
1905 {
1906  std::vector<geometry_msgs::PoseStamped> pose_out(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  pose_out[i].pose = tf2::toMsg(target[i]);
1912  pose_out[i].header.stamp = tm;
1913  pose_out[i].header.frame_id = frame_id;
1914  }
1915  return setPoseTargets(pose_out, end_effector_link);
1917 
1918 bool MoveGroupInterface::setPoseTargets(const std::vector<geometry_msgs::Pose>& target,
1919  const std::string& end_effector_link)
1920 {
1921  std::vector<geometry_msgs::PoseStamped> target_stamped(target.size());
1922  ros::Time tm = ros::Time::now();
1923  const std::string& frame_id = getPoseReferenceFrame();
1924  for (std::size_t i = 0; i < target.size(); ++i)
1925  {
1926  target_stamped[i].pose = target[i];
1927  target_stamped[i].header.stamp = tm;
1928  target_stamped[i].header.frame_id = frame_id;
1929  }
1930  return setPoseTargets(target_stamped, end_effector_link);
1931 }
1932 
1933 bool MoveGroupInterface::setPoseTargets(const std::vector<geometry_msgs::PoseStamped>& target,
1934  const std::string& end_effector_link)
1935 {
1936  if (target.empty())
1937  {
1938  ROS_ERROR_NAMED(LOGNAME, "No pose specified as goal target");
1939  return false;
1940  }
1941  else
1942  {
1944  return impl_->setPoseTargets(target, end_effector_link);
1945  }
1946 }
1947 
1948 const geometry_msgs::PoseStamped& MoveGroupInterface::getPoseTarget(const std::string& end_effector_link) const
1949 {
1950  return impl_->getPoseTarget(end_effector_link);
1951 }
1952 
1953 const std::vector<geometry_msgs::PoseStamped>&
1954 MoveGroupInterface::getPoseTargets(const std::string& end_effector_link) const
1955 {
1956  return impl_->getPoseTargets(end_effector_link);
1958 
1959 namespace
1960 {
1961 inline void transformPose(const tf2_ros::Buffer& tf_buffer, const std::string& desired_frame,
1962  geometry_msgs::PoseStamped& target)
1963 {
1964  if (desired_frame != target.header.frame_id)
1965  {
1966  geometry_msgs::PoseStamped target_in(target);
1967  tf_buffer.transform(target_in, target, desired_frame);
1968  // we leave the stamp to ros::Time(0) on purpose
1969  target.header.stamp = ros::Time(0);
1970  }
1971 }
1972 } // namespace
1973 
1974 bool MoveGroupInterface::setPositionTarget(double x, double y, double z, const std::string& end_effector_link)
1975 {
1976  geometry_msgs::PoseStamped target;
1977  if (impl_->hasPoseTarget(end_effector_link))
1978  {
1979  target = getPoseTarget(end_effector_link);
1980  transformPose(*impl_->getTF(), impl_->getPoseReferenceFrame(), target);
1981  }
1982  else
1983  {
1984  target.pose.orientation.x = 0.0;
1985  target.pose.orientation.y = 0.0;
1986  target.pose.orientation.z = 0.0;
1987  target.pose.orientation.w = 1.0;
1988  target.header.frame_id = impl_->getPoseReferenceFrame();
1989  }
1990 
1991  target.pose.position.x = x;
1992  target.pose.position.y = y;
1993  target.pose.position.z = z;
1994  bool result = setPoseTarget(target, end_effector_link);
1995  impl_->setTargetType(POSITION);
1996  return result;
1997 }
1998 
1999 bool MoveGroupInterface::setRPYTarget(double r, double p, double y, const std::string& end_effector_link)
2000 {
2001  geometry_msgs::PoseStamped target;
2002  if (impl_->hasPoseTarget(end_effector_link))
2003  {
2004  target = getPoseTarget(end_effector_link);
2005  transformPose(*impl_->getTF(), impl_->getPoseReferenceFrame(), target);
2006  }
2007  else
2008  {
2009  target.pose.position.x = 0.0;
2010  target.pose.position.y = 0.0;
2011  target.pose.position.z = 0.0;
2012  target.header.frame_id = impl_->getPoseReferenceFrame();
2013  }
2015  q.setRPY(r, p, y);
2016  target.pose.orientation = tf2::toMsg(q);
2017  bool result = setPoseTarget(target, end_effector_link);
2018  impl_->setTargetType(ORIENTATION);
2019  return result;
2020 }
2021 
2022 bool MoveGroupInterface::setOrientationTarget(double x, double y, double z, double w,
2023  const std::string& end_effector_link)
2024 {
2025  geometry_msgs::PoseStamped target;
2026  if (impl_->hasPoseTarget(end_effector_link))
2027  {
2028  target = getPoseTarget(end_effector_link);
2029  transformPose(*impl_->getTF(), impl_->getPoseReferenceFrame(), target);
2030  }
2031  else
2032  {
2033  target.pose.position.x = 0.0;
2034  target.pose.position.y = 0.0;
2035  target.pose.position.z = 0.0;
2036  target.header.frame_id = impl_->getPoseReferenceFrame();
2037  }
2038 
2039  target.pose.orientation.x = x;
2040  target.pose.orientation.y = y;
2041  target.pose.orientation.z = z;
2042  target.pose.orientation.w = w;
2043  bool result = setPoseTarget(target, end_effector_link);
2044  impl_->setTargetType(ORIENTATION);
2045  return result;
2046 }
2047 
2048 void MoveGroupInterface::setPoseReferenceFrame(const std::string& pose_reference_frame)
2049 {
2050  impl_->setPoseReferenceFrame(pose_reference_frame);
2051 }
2052 
2053 const std::string& MoveGroupInterface::getPoseReferenceFrame() const
2054 {
2055  return impl_->getPoseReferenceFrame();
2056 }
2057 
2059 {
2060  return impl_->getGoalJointTolerance();
2061 }
2062 
2064 {
2065  return impl_->getGoalPositionTolerance();
2066 }
2069 {
2071 }
2072 
2073 void MoveGroupInterface::setGoalTolerance(double tolerance)
2074 {
2075  setGoalJointTolerance(tolerance);
2076  setGoalPositionTolerance(tolerance);
2077  setGoalOrientationTolerance(tolerance);
2078 }
2079 
2080 void MoveGroupInterface::setGoalJointTolerance(double tolerance)
2081 {
2082  impl_->setGoalJointTolerance(tolerance);
2083 }
2084 
2085 void MoveGroupInterface::setGoalPositionTolerance(double tolerance)
2086 {
2087  impl_->setGoalPositionTolerance(tolerance);
2088 }
2089 
2091 {
2093 }
2094 
2095 void MoveGroupInterface::rememberJointValues(const std::string& name)
2096 {
2098 }
2099 
2100 bool MoveGroupInterface::startStateMonitor(double wait)
2101 {
2102  return impl_->startStateMonitor(wait);
2103 }
2104 
2105 std::vector<double> MoveGroupInterface::getCurrentJointValues() const
2106 {
2107  moveit::core::RobotStatePtr current_state;
2108  std::vector<double> values;
2109  if (impl_->getCurrentState(current_state))
2110  current_state->copyJointGroupPositions(getName(), values);
2111  return values;
2112 }
2113 
2114 std::vector<double> MoveGroupInterface::getRandomJointValues() const
2115 {
2116  std::vector<double> r;
2118  return r;
2119 }
2120 
2121 geometry_msgs::PoseStamped MoveGroupInterface::getRandomPose(const std::string& end_effector_link) const
2122 {
2123  const std::string& eef = end_effector_link.empty() ? getEndEffectorLink() : end_effector_link;
2124  Eigen::Isometry3d pose;
2125  pose.setIdentity();
2126  if (eef.empty())
2127  ROS_ERROR_NAMED(LOGNAME, "No end-effector specified");
2128  else
2129  {
2130  moveit::core::RobotStatePtr current_state;
2131  if (impl_->getCurrentState(current_state))
2132  {
2133  current_state->setToRandomPositions(impl_->getJointModelGroup());
2134  const moveit::core::LinkModel* lm = current_state->getLinkModel(eef);
2135  if (lm)
2136  pose = current_state->getGlobalLinkTransform(lm);
2137  }
2138  }
2139  geometry_msgs::PoseStamped pose_msg;
2140  pose_msg.header.stamp = ros::Time::now();
2141  pose_msg.header.frame_id = impl_->getRobotModel()->getModelFrame();
2142  pose_msg.pose = tf2::toMsg(pose);
2143  return pose_msg;
2144 }
2145 
2146 geometry_msgs::PoseStamped MoveGroupInterface::getCurrentPose(const std::string& end_effector_link) const
2147 {
2148  const std::string& eef = end_effector_link.empty() ? getEndEffectorLink() : end_effector_link;
2149  Eigen::Isometry3d pose;
2150  pose.setIdentity();
2151  if (eef.empty())
2152  ROS_ERROR_NAMED(LOGNAME, "No end-effector specified");
2153  else
2154  {
2155  moveit::core::RobotStatePtr current_state;
2156  if (impl_->getCurrentState(current_state))
2157  {
2158  const moveit::core::LinkModel* lm = current_state->getLinkModel(eef);
2159  if (lm)
2160  pose = current_state->getGlobalLinkTransform(lm);
2161  }
2162  }
2163  geometry_msgs::PoseStamped pose_msg;
2164  pose_msg.header.stamp = ros::Time::now();
2165  pose_msg.header.frame_id = impl_->getRobotModel()->getModelFrame();
2166  pose_msg.pose = tf2::toMsg(pose);
2167  return pose_msg;
2169 
2170 std::vector<double> MoveGroupInterface::getCurrentRPY(const std::string& end_effector_link) const
2171 {
2172  std::vector<double> result;
2173  const std::string& eef = end_effector_link.empty() ? getEndEffectorLink() : end_effector_link;
2174  if (eef.empty())
2175  ROS_ERROR_NAMED(LOGNAME, "No end-effector specified");
2176  else
2177  {
2178  moveit::core::RobotStatePtr current_state;
2179  if (impl_->getCurrentState(current_state))
2180  {
2181  const moveit::core::LinkModel* lm = current_state->getLinkModel(eef);
2182  if (lm)
2183  {
2184  result.resize(3);
2185  geometry_msgs::TransformStamped tfs = tf2::eigenToTransform(current_state->getGlobalLinkTransform(lm));
2186  double pitch, roll, yaw;
2187  tf2::getEulerYPR<geometry_msgs::Quaternion>(tfs.transform.rotation, yaw, pitch, roll);
2188  result[0] = roll;
2189  result[1] = pitch;
2190  result[2] = yaw;
2191  }
2192  }
2193  }
2194  return result;
2195 }
2196 
2197 const std::vector<std::string>& MoveGroupInterface::getActiveJoints() const
2198 {
2200 }
2201 
2202 const std::vector<std::string>& MoveGroupInterface::getJoints() const
2203 {
2205 }
2206 
2207 unsigned int MoveGroupInterface::getVariableCount() const
2208 {
2210 }
2211 
2212 moveit::core::RobotStatePtr MoveGroupInterface::getCurrentState(double wait) const
2213 {
2214  moveit::core::RobotStatePtr current_state;
2215  impl_->getCurrentState(current_state, wait);
2216  return current_state;
2217 }
2218 
2219 void MoveGroupInterface::rememberJointValues(const std::string& name, const std::vector<double>& values)
2220 {
2222 }
2223 
2224 void MoveGroupInterface::forgetJointValues(const std::string& name)
2225 {
2226  remembered_joint_values_.erase(name);
2227 }
2228 
2229 void MoveGroupInterface::allowLooking(bool flag)
2230 {
2231  impl_->can_look_ = flag;
2232  ROS_DEBUG_NAMED(LOGNAME, "Looking around: %s", flag ? "yes" : "no");
2233 }
2234 
2235 void MoveGroupInterface::setLookAroundAttempts(int32_t attempts)
2236 {
2237  if (attempts < 0)
2238  {
2239  ROS_ERROR_NAMED(LOGNAME, "Tried to set negative number of look-around attempts");
2240  }
2241  else
2242  {
2243  ROS_DEBUG_STREAM_NAMED(LOGNAME, "Look around attempts: " << attempts);
2244  impl_->look_around_attempts_ = attempts;
2245  }
2246 }
2247 
2249 {
2250  impl_->can_replan_ = flag;
2251  ROS_DEBUG_NAMED(LOGNAME, "Replanning: %s", flag ? "yes" : "no");
2252 }
2253 
2254 void MoveGroupInterface::setReplanAttempts(int32_t attempts)
2255 {
2256  if (attempts < 0)
2257  {
2258  ROS_ERROR_NAMED(LOGNAME, "Tried to set negative number of replan attempts");
2259  }
2260  else
2261  {
2262  ROS_DEBUG_STREAM_NAMED(LOGNAME, "Replan Attempts: " << attempts);
2263  impl_->replan_attempts_ = attempts;
2264  }
2266 
2267 void MoveGroupInterface::setReplanDelay(double delay)
2268 {
2269  if (delay < 0.0)
2270  {
2271  ROS_ERROR_NAMED(LOGNAME, "Tried to set negative replan delay");
2272  }
2273  else
2274  {
2275  ROS_DEBUG_STREAM_NAMED(LOGNAME, "Replan Delay: " << delay);
2276  impl_->replan_delay_ = delay;
2277  }
2278 }
2279 
2280 std::vector<std::string> MoveGroupInterface::getKnownConstraints() const
2281 {
2282  return impl_->getKnownConstraints();
2283 }
2284 
2285 moveit_msgs::Constraints MoveGroupInterface::getPathConstraints() const
2286 {
2288 }
2289 
2290 bool MoveGroupInterface::setPathConstraints(const std::string& constraint)
2291 {
2292  return impl_->setPathConstraints(constraint);
2293 }
2294 
2295 void MoveGroupInterface::setPathConstraints(const moveit_msgs::Constraints& constraint)
2296 {
2298 }
2299 
2301 {
2304 
2305 moveit_msgs::TrajectoryConstraints MoveGroupInterface::getTrajectoryConstraints() const
2306 {
2307  return impl_->getTrajectoryConstraints();
2308 }
2309 
2310 void MoveGroupInterface::setTrajectoryConstraints(const moveit_msgs::TrajectoryConstraints& constraint)
2311 {
2312  impl_->setTrajectoryConstraints(constraint);
2313 }
2314 
2318 }
2319 
2320 void MoveGroupInterface::setConstraintsDatabase(const std::string& host, unsigned int port)
2321 {
2323 }
2324 
2325 void MoveGroupInterface::setWorkspace(double minx, double miny, double minz, double maxx, double maxy, double maxz)
2326 {
2327  impl_->setWorkspace(minx, miny, minz, maxx, maxy, maxz);
2328 }
2329 
2331 void MoveGroupInterface::setPlanningTime(double seconds)
2332 {
2333  impl_->setPlanningTime(seconds);
2334 }
2338 {
2339  return impl_->getPlanningTime();
2340 }
2341 
2342 void MoveGroupInterface::setSupportSurfaceName(const std::string& name)
2343 {
2345 }
2346 
2347 const std::string& MoveGroupInterface::getPlanningFrame() const
2349  return impl_->getRobotModel()->getModelFrame();
2350 }
2351 
2352 const std::vector<std::string>& MoveGroupInterface::getJointModelGroupNames() const
2354  return impl_->getRobotModel()->getJointModelGroupNames();
2355 }
2356 
2357 bool MoveGroupInterface::attachObject(const std::string& object, const std::string& link)
2359  return attachObject(object, link, std::vector<std::string>());
2360 }
2361 
2362 bool MoveGroupInterface::attachObject(const std::string& object, const std::string& link,
2363  const std::vector<std::string>& touch_links)
2364 {
2365  return impl_->attachObject(object, link, touch_links);
2366 }
2367 
2368 bool MoveGroupInterface::detachObject(const std::string& name)
2369 {
2370  return impl_->detachObject(name);
2371 }
2372 
2373 void MoveGroupInterface::constructMotionPlanRequest(moveit_msgs::MotionPlanRequest& goal_out)
2374 {
2375  impl_->constructMotionPlanRequest(goal_out);
2376 }
2377 
2378 } // namespace planning_interface
2379 } // 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:541
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:1916
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:1692
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::planGraspsAndPick
moveit::core::MoveItErrorCode planGraspsAndPick(const std::string &object, bool plan_only=false)
Definition: move_group_interface.cpp:833
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:1520
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:1948
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:1776
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::max_acceleration_scaling_factor_
double max_acceleration_scaling_factor_
Definition: move_group_interface.cpp:1396
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:2348
moveit::planning_interface::MoveGroupInterface::getDefaultPlanningPipelineId
std::string getDefaultPlanningPipelineId() const
Definition: move_group_interface.cpp:1532
moveit::planning_interface::MoveGroupInterface::getTrajectoryConstraints
moveit_msgs::TrajectoryConstraints getTrajectoryConstraints() const
Definition: move_group_interface.cpp:2373
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:1398
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getTargetRobotState
moveit::core::RobotState & getTargetRobotState()
Definition: move_group_interface.cpp:509
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:2270
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:1592
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:2168
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:646
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::computeCartesianPath
double computeCartesianPath(const std::vector< geometry_msgs::Pose > &waypoints, double step, double jump_threshold, moveit_msgs::RobotTrajectory &msg, const moveit_msgs::Constraints &path_constraints, bool avoid_collisions, moveit_msgs::MoveItErrorCodes &error_code)
Definition: move_group_interface.cpp:1007
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:2158
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:264
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:2090
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:1378
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:708
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::clearTrajectoryConstraints
void clearTrajectoryConstraints()
Definition: move_group_interface.cpp:1301
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:1711
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::get_params_service_
ros::ServiceClient get_params_service_
Definition: move_group_interface.cpp:1428
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPoseTarget
const geometry_msgs::PoseStamped & getPoseTarget(const std::string &end_effector_link) const
Definition: move_group_interface.cpp:652
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:2280
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPlanningPipelineId
const std::string & getPlanningPipelineId() const
Definition: move_group_interface.cpp:425
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::plan
moveit::core::MoveItErrorCode plan(Plan &plan)
Definition: move_group_interface.cpp:882
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:325
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getGoalOrientationTolerance
double getGoalOrientationTolerance() const
Definition: move_group_interface.cpp:1114
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:2316
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:2275
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:1390
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPathConstraints
moveit_msgs::Constraints getPathConstraints() const
Definition: move_group_interface.cpp:1321
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:668
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::execute
moveit::core::MoveItErrorCode execute(const moveit_msgs::RobotTrajectory &trajectory, bool wait)
Definition: move_group_interface.cpp:968
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:1602
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPlanningPipelineId
void setPlanningPipelineId(const std::string &pipeline_id)
Definition: move_group_interface.cpp:414
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:2292
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:2415
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:2303
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::clearPathConstraints
void clearPathConstraints()
Definition: move_group_interface.cpp:1291
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::robot_model_
moveit::core::RobotModelConstPtr robot_model_
Definition: move_group_interface.cpp:1381
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:1431
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:1405
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:1552
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:2148
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:2238
moveit::planning_interface::MoveGroupInterface::getJointModelGroupNames
const std::vector< std::string > & getJointModelGroupNames() const
Get the available planning group names.
Definition: move_group_interface.cpp:2420
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:1410
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getOptions
const Options & getOptions() const
Definition: move_group_interface.cpp:330
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:1402
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPathConstraints
void setPathConstraints(const moveit_msgs::Constraints &constraint)
Definition: move_group_interface.cpp:1269
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::cartesian_path_service_
ros::ServiceClient cartesian_path_service_
Definition: move_group_interface.cpp:1430
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:2335
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:1587
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:1716
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:2173
moveit::planning_interface::MoveGroupInterface::setPlanningTime
void setPlanningTime(double seconds)
Specify the maximum amount of time to use when planning.
Definition: move_group_interface.cpp:2399
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:2368
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::constraints_init_thread_
std::unique_ptr< boost::thread > constraints_init_thread_
Definition: move_group_interface.cpp:1433
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:1911
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:1652
moveit::planning_interface::MoveGroupInterface::clearPoseTargets
void clearPoseTargets()
Forget any poses specified for all end-effectors.
Definition: move_group_interface.cpp:1943
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:2022
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setEndEffectorLink
void setEndEffectorLink(const std::string &end_effector)
Definition: move_group_interface.cpp:593
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:1597
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getEndEffector
const std::string & getEndEffector() const
Definition: move_group_interface.cpp:613
ros::NodeHandle::advertise
Publisher advertise(AdvertiseOptions &ops)
moveit::planning_interface::MoveGroupInterface::getTargetRobotState
const moveit::core::RobotState & getTargetRobotState() const
Definition: move_group_interface.cpp:1906
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:2163
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:1526
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:2153
moveit::planning_interface::MoveGroupInterface::remembered_joint_values_
std::map< std::string, std::vector< double > > remembered_joint_values_
Definition: move_group_interface.h:1115
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::move
moveit::core::MoveItErrorCode move(bool wait)
Definition: move_group_interface.cpp:923
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::trajectory_event_publisher_
ros::Publisher trajectory_event_publisher_
Definition: move_group_interface.cpp:1425
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:475
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:1577
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:1385
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::~MoveGroupInterfaceImpl
~MoveGroupInterfaceImpl()
Definition: move_group_interface.cpp:319
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setGoalPositionTolerance
void setGoalPositionTolerance(double tolerance)
Definition: move_group_interface.cpp:1129
moveit::planning_interface::MoveGroupInterface::computeCartesianPath
double computeCartesianPath(const std::vector< geometry_msgs::Pose > &waypoints, double eef_step, double jump_threshold, 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.cpp:1668
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:2297
moveit::planning_interface::MoveGroupInterface::setReplanAttempts
void setReplanAttempts(int32_t attempts)
Maximum number of replanning attempts.
Definition: move_group_interface.cpp:2322
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:1547
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:1329
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:1296
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:2121
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:2388
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::pose_targets_
std::map< std::string, std::vector< geometry_msgs::PoseStamped > > pose_targets_
Definition: move_group_interface.cpp:1414
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:2116
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getDefaultPlannerId
std::string getDefaultPlannerId(const std::string &group) const
Definition: move_group_interface.cpp:430
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:1500
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:949
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:2189
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::clearPoseTargets
void clearPoseTargets()
Definition: move_group_interface.cpp:603
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::end_effector_link_
std::string end_effector_link_
Definition: move_group_interface.cpp:1420
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:1505
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::considered_start_state_
moveit::core::RobotStatePtr considered_start_state_
Definition: move_group_interface.cpp:1389
ROS_FATAL_STREAM_NAMED
#define ROS_FATAL_STREAM_NAMED(name, args)
moveit::planning_interface::MoveGroupInterface::~MoveGroupInterface
~MoveGroupInterface()
Definition: move_group_interface.cpp:1464
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::look_around_attempts_
int32_t look_around_attempts_
Definition: move_group_interface.cpp:1403
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:724
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::constructGoal
void constructGoal(moveit_msgs::MoveGroupGoal &goal) const
Definition: move_group_interface.cpp:1210
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::place
moveit::core::MoveItErrorCode place(const moveit_msgs::PlaceGoal &goal)
Definition: move_group_interface.cpp:772
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:1567
c
c
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::num_planning_attempts_
unsigned int num_planning_attempts_
Definition: move_group_interface.cpp:1394
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:1622
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:1488
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::planning_pipeline_id_
std::string planning_pipeline_id_
Definition: move_group_interface.cpp:1392
moveit::core::JointModelGroup::getJointModelNames
const std::vector< std::string > & getJointModelNames() const
trajectory_execution_manager.h
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:1572
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getKnownConstraints
std::vector< std::string > getKnownConstraints() const
Definition: move_group_interface.cpp:1306
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:2141
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getJointModelGroup
const moveit::core::JointModelGroup * getJointModelGroup() const
Definition: move_group_interface.cpp:340
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:1882
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:1921
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setMaxAccelerationScalingFactor
void setMaxAccelerationScalingFactor(double value)
Definition: move_group_interface.cpp:470
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:1537
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setSupportSurfaceName
void setSupportSurfaceName(const std::string &support_surface)
Definition: move_group_interface.cpp:688
value
float value
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::tf_buffer_
std::shared_ptr< tf2_ros::Buffer > tf_buffer_
Definition: move_group_interface.cpp:1380
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:2067
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:1642
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:1383
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::path_constraints_
std::unique_ptr< moveit_msgs::Constraints > path_constraints_
Definition: move_group_interface.cpp:1418
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:1421
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:1419
moveit::core::JointModelGroup::getDefaultStateNames
const std::vector< std::string > & getDefaultStateNames() const
t
tuple t
moveit::planning_interface::MoveGroupInterface::setTrajectoryConstraints
void setTrajectoryConstraints(const moveit_msgs::TrajectoryConstraints &constraint)
Definition: move_group_interface.cpp:2378
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:2358
moveit::planning_interface::MoveGroupInterface::stop
void stop()
Stop any trajectory execution, if one is active.
Definition: move_group_interface.cpp:1687
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:503
moveit::planning_interface::MoveGroupInterface::getPoseTarget
const geometry_msgs::PoseStamped & getPoseTarget(const std::string &end_effector_link="") const
Definition: move_group_interface.cpp:2016
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:391
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:497
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::active_target_
ActiveTargetType active_target_
Definition: move_group_interface.cpp:1417
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getStartState
moveit::core::RobotStatePtr getStartState()
Definition: move_group_interface.cpp:529
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:1612
planning_scene_interface.h
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:2126
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::joint_state_target_
moveit::core::RobotStatePtr joint_state_target_
Definition: move_group_interface.cpp:1409
moveit::planning_interface::MoveGroupInterface::clearMaxCartesianLinkSpeed
void clearMaxCartesianLinkSpeed()
Clear maximum Cartesian speed of the end effector.
Definition: move_group_interface.cpp:1582
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:524
common_objects.h
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::initializeConstraintsStorage
void initializeConstraintsStorage(const std::string &host, unsigned int port)
Definition: move_group_interface.cpp:1337
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setTargetType
void setTargetType(ActiveTargetType type)
Definition: move_group_interface.cpp:698
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:407
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:2182
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::initializing_constraints_
bool initializing_constraints_
Definition: move_group_interface.cpp:1434
transform_listener.h
moveit::planning_interface::MoveGroupInterface::getPlannerId
const std::string & getPlannerId() const
Get the current planner_id.
Definition: move_group_interface.cpp:1557
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::constraints_storage_
std::unique_ptr< moveit_warehouse::ConstraintsStorage > constraints_storage_
Definition: move_group_interface.cpp:1432
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:1901
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:455
ros::NodeHandle::ok
bool ok() const
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getTargetType
ActiveTargetType getTargetType() const
Definition: move_group_interface.cpp:703
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:2383
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:465
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:1634
moveit::planning_interface::MoveGroupInterface::getPlanningPipelineId
const std::string & getPlanningPipelineId() const
Get the current planning_pipeline_id.
Definition: move_group_interface.cpp:1542
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:363
ros::Time
moveit
values
std::vector< double > values
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::can_replan_
bool can_replan_
Definition: move_group_interface.cpp:1404
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:1493
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:1515
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:2410
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::goal_joint_tolerance_
double goal_joint_tolerance_
Definition: move_group_interface.cpp:1399
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:416
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:1938
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:1562
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:1242
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:1722
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::goal_orientation_tolerance_
double goal_orientation_tolerance_
Definition: move_group_interface.cpp:1401
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:914
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:376
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:1427
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:1406
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPlannerId
void setPlannerId(const std::string &planner_id)
Definition: move_group_interface.cpp:450
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:2042
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:1215
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:1510
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setStartState
void setStartState(const moveit::core::RobotState &start_state)
Definition: move_group_interface.cpp:519
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:335
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getInterfaceDescription
bool getInterfaceDescription(moveit_msgs::PlannerInterfaceDescription &desc)
Definition: move_group_interface.cpp:350
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:627
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:2425
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:2393
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::attached_object_publisher_
ros::Publisher attached_object_publisher_
Definition: move_group_interface.cpp:1426
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:1382
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getEndEffectorLink
const std::string & getEndEffectorLink() const
Definition: move_group_interface.cpp:608
moveit::planning_interface::MoveGroupInterface::impl_
MoveGroupInterfaceImpl * impl_
Definition: move_group_interface.h:1116
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:1400
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:2353
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:2405
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:1451
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::cartesian_speed_limited_link_
std::string cartesian_speed_limited_link_
Definition: move_group_interface.cpp:1397
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::execute_action_client_
std::unique_ptr< actionlib::SimpleActionClient< moveit_msgs::ExecuteTrajectoryAction > > execute_action_client_
Definition: move_group_interface.cpp:1384
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:2265
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:1727
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:1386
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:1972
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:1752
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:1346
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:2136
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:748
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::max_velocity_scaling_factor_
double max_velocity_scaling_factor_
Definition: move_group_interface.cpp:1395
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:1359
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::clearPoseTarget
void clearPoseTarget(const std::string &end_effector_link)
Definition: move_group_interface.cpp:598
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:1732
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:2441
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:2214
z
double z
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getMoveGroupClient
actionlib::SimpleActionClient< moveit_msgs::MoveGroupAction > & getMoveGroupClient() const
Definition: move_group_interface.cpp:345
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:2436
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::support_surface_
std::string support_surface_
Definition: move_group_interface.cpp:1422
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:1930
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:1391
moveit::core::JointModel
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setNumPlanningAttempts
void setNumPlanningAttempts(unsigned int num_planning_attempts)
Definition: move_group_interface.cpp:460
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::set_params_service_
ros::ServiceClient set_params_service_
Definition: move_group_interface.cpp:1429
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::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:803
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:1627
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::setPoseReferenceFrame
void setPoseReferenceFrame(const std::string &pose_reference_frame)
Definition: move_group_interface.cpp:683
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:2131
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:1379
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::planner_id_
std::string planner_id_
Definition: move_group_interface.cpp:1393
moveit::planning_interface::MoveGroupInterface::MoveGroupInterfaceImpl::getPoseReferenceFrame
const std::string & getPoseReferenceFrame() const
Definition: move_group_interface.cpp:693


planning_interface
Author(s): Ioan Sucan
autogenerated on Thu Apr 18 2024 02:25:17