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


planning_interface
Author(s): Ioan Sucan
autogenerated on Sat Apr 27 2024 02:27:01