00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include "pick_place_action_capability.h"
00038 #include <moveit/plan_execution/plan_execution.h>
00039 #include <moveit/plan_execution/plan_with_sensing.h>
00040 #include <moveit/move_group_pick_place_capability/capability_names.h>
00041
00042 #include <manipulation_msgs/GraspPlanning.h>
00043 #include <eigen_conversions/eigen_msg.h>
00044
00045 move_group::MoveGroupPickPlaceAction::MoveGroupPickPlaceAction()
00046 : MoveGroupCapability("PickPlaceAction"), pickup_state_(IDLE)
00047 {
00048 }
00049
00050 void move_group::MoveGroupPickPlaceAction::initialize()
00051 {
00052 pick_place_.reset(new pick_place::PickPlace(context_->planning_pipeline_));
00053 pick_place_->displayComputedMotionPlans(true);
00054
00055 if (context_->debug_)
00056 pick_place_->displayProcessedGrasps(true);
00057
00058
00059 pickup_action_server_.reset(new actionlib::SimpleActionServer<moveit_msgs::PickupAction>(
00060 root_node_handle_, PICKUP_ACTION, boost::bind(&MoveGroupPickPlaceAction::executePickupCallback, this, _1),
00061 false));
00062 pickup_action_server_->registerPreemptCallback(boost::bind(&MoveGroupPickPlaceAction::preemptPickupCallback, this));
00063 pickup_action_server_->start();
00064
00065
00066 place_action_server_.reset(new actionlib::SimpleActionServer<moveit_msgs::PlaceAction>(
00067 root_node_handle_, PLACE_ACTION, boost::bind(&MoveGroupPickPlaceAction::executePlaceCallback, this, _1), false));
00068 place_action_server_->registerPreemptCallback(boost::bind(&MoveGroupPickPlaceAction::preemptPlaceCallback, this));
00069 place_action_server_->start();
00070
00071 grasp_planning_service_ =
00072 root_node_handle_.serviceClient<manipulation_msgs::GraspPlanning>("database_grasp_planning");
00073 }
00074
00075 void move_group::MoveGroupPickPlaceAction::startPickupExecutionCallback()
00076 {
00077 setPickupState(MONITOR);
00078 }
00079
00080 void move_group::MoveGroupPickPlaceAction::startPickupLookCallback()
00081 {
00082 setPickupState(LOOK);
00083 }
00084
00085 void move_group::MoveGroupPickPlaceAction::startPlaceExecutionCallback()
00086 {
00087 setPlaceState(MONITOR);
00088 }
00089
00090 void move_group::MoveGroupPickPlaceAction::startPlaceLookCallback()
00091 {
00092 setPlaceState(LOOK);
00093 }
00094
00095 void move_group::MoveGroupPickPlaceAction::executePickupCallback_PlanOnly(const moveit_msgs::PickupGoalConstPtr& goal,
00096 moveit_msgs::PickupResult& action_res)
00097 {
00098 pick_place::PickPlanPtr plan;
00099 try
00100 {
00101 planning_scene_monitor::LockedPlanningSceneRO ps(context_->planning_scene_monitor_);
00102 plan = pick_place_->planPick(ps, *goal);
00103 }
00104 catch (std::runtime_error& ex)
00105 {
00106 ROS_ERROR_NAMED("manipulation", "Pick&place threw an exception: %s", ex.what());
00107 }
00108 catch (...)
00109 {
00110 ROS_ERROR_NAMED("manipulation", "Pick&place threw an exception");
00111 }
00112
00113 if (plan)
00114 {
00115 const std::vector<pick_place::ManipulationPlanPtr>& success = plan->getSuccessfulManipulationPlans();
00116 if (success.empty())
00117 {
00118 action_res.error_code = plan->getErrorCode();
00119 }
00120 else
00121 {
00122 const pick_place::ManipulationPlanPtr& result = success.back();
00123 convertToMsg(result->trajectories_, action_res.trajectory_start, action_res.trajectory_stages);
00124 action_res.trajectory_descriptions.resize(result->trajectories_.size());
00125 for (std::size_t i = 0; i < result->trajectories_.size(); ++i)
00126 action_res.trajectory_descriptions[i] = result->trajectories_[i].description_;
00127 if (result->id_ < goal->possible_grasps.size())
00128 action_res.grasp = goal->possible_grasps[result->id_];
00129 action_res.error_code.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
00130 }
00131 }
00132 else
00133 {
00134 action_res.error_code.val = moveit_msgs::MoveItErrorCodes::FAILURE;
00135 }
00136 }
00137
00138 void move_group::MoveGroupPickPlaceAction::executePlaceCallback_PlanOnly(const moveit_msgs::PlaceGoalConstPtr& goal,
00139 moveit_msgs::PlaceResult& action_res)
00140 {
00141 pick_place::PlacePlanPtr plan;
00142 try
00143 {
00144 planning_scene_monitor::LockedPlanningSceneRO ps(context_->planning_scene_monitor_);
00145 plan = pick_place_->planPlace(ps, *goal);
00146 }
00147 catch (std::runtime_error& ex)
00148 {
00149 ROS_ERROR_NAMED("manipulation", "Pick&place threw an exception: %s", ex.what());
00150 }
00151 catch (...)
00152 {
00153 ROS_ERROR_NAMED("manipulation", "Pick&place threw an exception");
00154 }
00155
00156 if (plan)
00157 {
00158 const std::vector<pick_place::ManipulationPlanPtr>& success = plan->getSuccessfulManipulationPlans();
00159 if (success.empty())
00160 {
00161 action_res.error_code = plan->getErrorCode();
00162 }
00163 else
00164 {
00165 const pick_place::ManipulationPlanPtr& result = success.back();
00166 convertToMsg(result->trajectories_, action_res.trajectory_start, action_res.trajectory_stages);
00167 action_res.trajectory_descriptions.resize(result->trajectories_.size());
00168 for (std::size_t i = 0; i < result->trajectories_.size(); ++i)
00169 action_res.trajectory_descriptions[i] = result->trajectories_[i].description_;
00170 if (result->id_ < goal->place_locations.size())
00171 action_res.place_location = goal->place_locations[result->id_];
00172 action_res.error_code.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
00173 }
00174 }
00175 else
00176 {
00177 action_res.error_code.val = moveit_msgs::MoveItErrorCodes::FAILURE;
00178 }
00179 }
00180
00181 bool move_group::MoveGroupPickPlaceAction::planUsingPickPlace_Pickup(const moveit_msgs::PickupGoal& goal,
00182 moveit_msgs::PickupResult* action_res,
00183 plan_execution::ExecutableMotionPlan& plan)
00184 {
00185 setPickupState(PLANNING);
00186
00187 planning_scene_monitor::LockedPlanningSceneRO ps(plan.planning_scene_monitor_);
00188
00189 pick_place::PickPlanPtr pick_plan;
00190 try
00191 {
00192 pick_plan = pick_place_->planPick(plan.planning_scene_, goal);
00193 }
00194 catch (std::runtime_error& ex)
00195 {
00196 ROS_ERROR_NAMED("manipulation", "Pick&place threw an exception: %s", ex.what());
00197 }
00198 catch (...)
00199 {
00200 ROS_ERROR_NAMED("manipulation", "Pick&place threw an exception");
00201 }
00202
00203 if (pick_plan)
00204 {
00205 const std::vector<pick_place::ManipulationPlanPtr>& success = pick_plan->getSuccessfulManipulationPlans();
00206 if (success.empty())
00207 {
00208 plan.error_code_ = pick_plan->getErrorCode();
00209 }
00210 else
00211 {
00212 const pick_place::ManipulationPlanPtr& result = success.back();
00213 plan.plan_components_ = result->trajectories_;
00214 if (result->id_ < goal.possible_grasps.size())
00215 action_res->grasp = goal.possible_grasps[result->id_];
00216 plan.error_code_.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
00217 }
00218 }
00219 else
00220 {
00221 plan.error_code_.val = moveit_msgs::MoveItErrorCodes::FAILURE;
00222 }
00223
00224 return plan.error_code_.val == moveit_msgs::MoveItErrorCodes::SUCCESS;
00225 }
00226
00227 bool move_group::MoveGroupPickPlaceAction::planUsingPickPlace_Place(const moveit_msgs::PlaceGoal& goal,
00228 moveit_msgs::PlaceResult* action_res,
00229 plan_execution::ExecutableMotionPlan& plan)
00230 {
00231 setPlaceState(PLANNING);
00232
00233 planning_scene_monitor::LockedPlanningSceneRO ps(plan.planning_scene_monitor_);
00234
00235 pick_place::PlacePlanPtr place_plan;
00236 try
00237 {
00238 place_plan = pick_place_->planPlace(plan.planning_scene_, goal);
00239 }
00240 catch (std::runtime_error& ex)
00241 {
00242 ROS_ERROR_NAMED("manipulation", "Pick&place threw an exception: %s", ex.what());
00243 }
00244 catch (...)
00245 {
00246 ROS_ERROR_NAMED("manipulation", "Pick&place threw an exception");
00247 }
00248
00249 if (place_plan)
00250 {
00251 const std::vector<pick_place::ManipulationPlanPtr>& success = place_plan->getSuccessfulManipulationPlans();
00252 if (success.empty())
00253 {
00254 plan.error_code_ = place_plan->getErrorCode();
00255 }
00256 else
00257 {
00258 const pick_place::ManipulationPlanPtr& result = success.back();
00259 plan.plan_components_ = result->trajectories_;
00260 if (result->id_ < goal.place_locations.size())
00261 action_res->place_location = goal.place_locations[result->id_];
00262 plan.error_code_.val = moveit_msgs::MoveItErrorCodes::SUCCESS;
00263 }
00264 }
00265 else
00266 {
00267 plan.error_code_.val = moveit_msgs::MoveItErrorCodes::FAILURE;
00268 }
00269
00270 return plan.error_code_.val == moveit_msgs::MoveItErrorCodes::SUCCESS;
00271 }
00272
00273 void move_group::MoveGroupPickPlaceAction::executePickupCallback_PlanAndExecute(
00274 const moveit_msgs::PickupGoalConstPtr& goal, moveit_msgs::PickupResult& action_res)
00275 {
00276 plan_execution::PlanExecution::Options opt;
00277
00278 opt.replan_ = goal->planning_options.replan;
00279 opt.replan_attempts_ = goal->planning_options.replan_attempts;
00280 opt.replan_delay_ = goal->planning_options.replan_delay;
00281 opt.before_execution_callback_ = boost::bind(&MoveGroupPickPlaceAction::startPickupExecutionCallback, this);
00282
00283 opt.plan_callback_ =
00284 boost::bind(&MoveGroupPickPlaceAction::planUsingPickPlace_Pickup, this, boost::cref(*goal), &action_res, _1);
00285 if (goal->planning_options.look_around && context_->plan_with_sensing_)
00286 {
00287 opt.plan_callback_ = boost::bind(&plan_execution::PlanWithSensing::computePlan, context_->plan_with_sensing_.get(),
00288 _1, opt.plan_callback_, goal->planning_options.look_around_attempts,
00289 goal->planning_options.max_safe_execution_cost);
00290 context_->plan_with_sensing_->setBeforeLookCallback(
00291 boost::bind(&MoveGroupPickPlaceAction::startPickupLookCallback, this));
00292 }
00293
00294 plan_execution::ExecutableMotionPlan plan;
00295 context_->plan_execution_->planAndExecute(plan, goal->planning_options.planning_scene_diff, opt);
00296
00297 convertToMsg(plan.plan_components_, action_res.trajectory_start, action_res.trajectory_stages);
00298 action_res.trajectory_descriptions.resize(plan.plan_components_.size());
00299 for (std::size_t i = 0; i < plan.plan_components_.size(); ++i)
00300 action_res.trajectory_descriptions[i] = plan.plan_components_[i].description_;
00301 action_res.error_code = plan.error_code_;
00302 }
00303
00304 void move_group::MoveGroupPickPlaceAction::executePlaceCallback_PlanAndExecute(
00305 const moveit_msgs::PlaceGoalConstPtr& goal, moveit_msgs::PlaceResult& action_res)
00306 {
00307 plan_execution::PlanExecution::Options opt;
00308
00309 opt.replan_ = goal->planning_options.replan;
00310 opt.replan_attempts_ = goal->planning_options.replan_attempts;
00311 opt.replan_delay_ = goal->planning_options.replan_delay;
00312 opt.before_execution_callback_ = boost::bind(&MoveGroupPickPlaceAction::startPlaceExecutionCallback, this);
00313 opt.plan_callback_ =
00314 boost::bind(&MoveGroupPickPlaceAction::planUsingPickPlace_Place, this, boost::cref(*goal), &action_res, _1);
00315 if (goal->planning_options.look_around && context_->plan_with_sensing_)
00316 {
00317 opt.plan_callback_ = boost::bind(&plan_execution::PlanWithSensing::computePlan, context_->plan_with_sensing_.get(),
00318 _1, opt.plan_callback_, goal->planning_options.look_around_attempts,
00319 goal->planning_options.max_safe_execution_cost);
00320 context_->plan_with_sensing_->setBeforeLookCallback(
00321 boost::bind(&MoveGroupPickPlaceAction::startPlaceLookCallback, this));
00322 }
00323
00324 plan_execution::ExecutableMotionPlan plan;
00325 context_->plan_execution_->planAndExecute(plan, goal->planning_options.planning_scene_diff, opt);
00326
00327 convertToMsg(plan.plan_components_, action_res.trajectory_start, action_res.trajectory_stages);
00328 action_res.trajectory_descriptions.resize(plan.plan_components_.size());
00329 for (std::size_t i = 0; i < plan.plan_components_.size(); ++i)
00330 action_res.trajectory_descriptions[i] = plan.plan_components_[i].description_;
00331 action_res.error_code = plan.error_code_;
00332 }
00333
00334 void move_group::MoveGroupPickPlaceAction::executePickupCallback(const moveit_msgs::PickupGoalConstPtr& input_goal)
00335 {
00336 setPickupState(PLANNING);
00337
00338 context_->planning_scene_monitor_->updateFrameTransforms();
00339
00340 moveit_msgs::PickupGoalConstPtr goal;
00341 if (input_goal->possible_grasps.empty())
00342 {
00343 moveit_msgs::PickupGoal* copy(new moveit_msgs::PickupGoal(*input_goal));
00344 goal.reset(copy);
00345 fillGrasps(*copy);
00346 }
00347 else
00348 goal = input_goal;
00349
00350 moveit_msgs::PickupResult action_res;
00351
00352 if (goal->planning_options.plan_only || !context_->allow_trajectory_execution_)
00353 {
00354 if (!goal->planning_options.plan_only)
00355 ROS_WARN_NAMED("manipulation", "This instance of MoveGroup is not allowed to execute trajectories but the pick "
00356 "goal request has plan_only set to false. Only a motion plan will be computed "
00357 "anyway.");
00358 executePickupCallback_PlanOnly(goal, action_res);
00359 }
00360 else
00361 executePickupCallback_PlanAndExecute(goal, action_res);
00362
00363 bool planned_trajectory_empty = action_res.trajectory_stages.empty();
00364 std::string response =
00365 getActionResultString(action_res.error_code, planned_trajectory_empty, goal->planning_options.plan_only);
00366 if (action_res.error_code.val == moveit_msgs::MoveItErrorCodes::SUCCESS)
00367 pickup_action_server_->setSucceeded(action_res, response);
00368 else
00369 {
00370 if (action_res.error_code.val == moveit_msgs::MoveItErrorCodes::PREEMPTED)
00371 pickup_action_server_->setPreempted(action_res, response);
00372 else
00373 pickup_action_server_->setAborted(action_res, response);
00374 }
00375
00376 setPickupState(IDLE);
00377 }
00378
00379 void move_group::MoveGroupPickPlaceAction::executePlaceCallback(const moveit_msgs::PlaceGoalConstPtr& goal)
00380 {
00381 setPlaceState(PLANNING);
00382
00383 context_->planning_scene_monitor_->updateFrameTransforms();
00384
00385 moveit_msgs::PlaceResult action_res;
00386
00387 if (goal->planning_options.plan_only || !context_->allow_trajectory_execution_)
00388 {
00389 if (!goal->planning_options.plan_only)
00390 ROS_WARN_NAMED("manipulation", "This instance of MoveGroup is not allowed to execute trajectories but the place "
00391 "goal request has plan_only set to false. Only a motion plan will be computed "
00392 "anyway.");
00393 executePlaceCallback_PlanOnly(goal, action_res);
00394 }
00395 else
00396 executePlaceCallback_PlanAndExecute(goal, action_res);
00397
00398 bool planned_trajectory_empty = action_res.trajectory_stages.empty();
00399 std::string response =
00400 getActionResultString(action_res.error_code, planned_trajectory_empty, goal->planning_options.plan_only);
00401 if (action_res.error_code.val == moveit_msgs::MoveItErrorCodes::SUCCESS)
00402 place_action_server_->setSucceeded(action_res, response);
00403 else
00404 {
00405 if (action_res.error_code.val == moveit_msgs::MoveItErrorCodes::PREEMPTED)
00406 place_action_server_->setPreempted(action_res, response);
00407 else
00408 place_action_server_->setAborted(action_res, response);
00409 }
00410
00411 setPlaceState(IDLE);
00412 }
00413
00414 void move_group::MoveGroupPickPlaceAction::preemptPickupCallback()
00415 {
00416 }
00417
00418 void move_group::MoveGroupPickPlaceAction::preemptPlaceCallback()
00419 {
00420 }
00421
00422 void move_group::MoveGroupPickPlaceAction::setPickupState(MoveGroupState state)
00423 {
00424 pickup_state_ = state;
00425 pickup_feedback_.state = stateToStr(state);
00426 pickup_action_server_->publishFeedback(pickup_feedback_);
00427 }
00428
00429 void move_group::MoveGroupPickPlaceAction::setPlaceState(MoveGroupState state)
00430 {
00431 place_state_ = state;
00432 place_feedback_.state = stateToStr(state);
00433 place_action_server_->publishFeedback(place_feedback_);
00434 }
00435
00436 void move_group::MoveGroupPickPlaceAction::fillGrasps(moveit_msgs::PickupGoal& goal)
00437 {
00438 if (grasp_planning_service_)
00439 {
00440 manipulation_msgs::GraspPlanning::Request request;
00441 manipulation_msgs::GraspPlanning::Response response;
00442 bool valid = true;
00443 std::string planning_frame;
00444
00445
00446 {
00447 planning_scene_monitor::LockedPlanningSceneRO lscene(context_->planning_scene_monitor_);
00448 planning_frame = lscene->getPlanningFrame();
00449
00450 collision_detection::World::ObjectConstPtr object = lscene->getWorld()->getObject(goal.target_name);
00451 if (!object || object->shape_poses_.empty())
00452 {
00453 ROS_ERROR_NAMED("manipulation", "Object '%s' does not exist or has no pose", goal.target_name.c_str());
00454 return;
00455 }
00456
00457 request.arm_name = goal.group_name;
00458 request.collision_object_name = goal.target_name;
00459 request.target.reference_frame_id = planning_frame;
00460
00461 if (lscene->hasObjectType(goal.target_name) && !lscene->getObjectType(goal.target_name).key.empty())
00462 {
00463 household_objects_database_msgs::DatabaseModelPose dbp;
00464 dbp.pose.header.frame_id = planning_frame;
00465 dbp.pose.header.stamp = ros::Time::now();
00466 tf::poseEigenToMsg(object->shape_poses_[0], dbp.pose.pose);
00467 dbp.type = lscene->getObjectType(goal.target_name);
00468 try
00469 {
00470 dbp.model_id = boost::lexical_cast<int>(dbp.type.key);
00471 ROS_DEBUG_NAMED("manipulation", "Asking database for grasps for '%s' with model id: %d", dbp.type.key.c_str(),
00472 dbp.model_id);
00473 request.target.potential_models.push_back(dbp);
00474 }
00475 catch (boost::bad_lexical_cast&)
00476 {
00477 valid = false;
00478 ROS_ERROR_NAMED("manipulation", "Expected an integer object id, not '%s'", dbp.type.key.c_str());
00479 }
00480 }
00481 }
00482
00483 if (valid)
00484 {
00485 ROS_DEBUG_NAMED("manipulation", "Calling grasp planner...");
00486 if (grasp_planning_service_.call(request, response))
00487 {
00488 goal.possible_grasps.resize(response.grasps.size());
00489 for (std::size_t i = 0; i < response.grasps.size(); ++i)
00490 {
00491
00492 goal.possible_grasps[i].id = response.grasps[i].id;
00493
00494 goal.possible_grasps[i].pre_grasp_posture.header = response.grasps[i].pre_grasp_posture.header;
00495 goal.possible_grasps[i].pre_grasp_posture.joint_names = response.grasps[i].pre_grasp_posture.name;
00496 goal.possible_grasps[i].pre_grasp_posture.points.resize(1);
00497 goal.possible_grasps[i].pre_grasp_posture.points[0].positions = response.grasps[i].pre_grasp_posture.position;
00498 goal.possible_grasps[i].pre_grasp_posture.points[0].velocities =
00499 response.grasps[i].pre_grasp_posture.velocity;
00500 goal.possible_grasps[i].pre_grasp_posture.points[0].effort = response.grasps[i].pre_grasp_posture.effort;
00501
00502 goal.possible_grasps[i].grasp_posture.header = response.grasps[i].grasp_posture.header;
00503 goal.possible_grasps[i].grasp_posture.joint_names = response.grasps[i].grasp_posture.name;
00504 goal.possible_grasps[i].grasp_posture.points.resize(1);
00505 goal.possible_grasps[i].grasp_posture.points[0].positions = response.grasps[i].grasp_posture.position;
00506 goal.possible_grasps[i].grasp_posture.points[0].velocities = response.grasps[i].grasp_posture.velocity;
00507 goal.possible_grasps[i].grasp_posture.points[0].effort = response.grasps[i].grasp_posture.effort;
00508
00509 goal.possible_grasps[i].grasp_pose = response.grasps[i].grasp_pose;
00510 goal.possible_grasps[i].grasp_quality = response.grasps[i].grasp_quality;
00511
00512 goal.possible_grasps[i].pre_grasp_approach.direction = response.grasps[i].approach.direction;
00513 goal.possible_grasps[i].pre_grasp_approach.desired_distance = response.grasps[i].approach.desired_distance;
00514 goal.possible_grasps[i].pre_grasp_approach.min_distance = response.grasps[i].approach.min_distance;
00515
00516
00517
00518 goal.possible_grasps[i].post_grasp_retreat.direction.vector.x = 0.0;
00519 goal.possible_grasps[i].post_grasp_retreat.direction.vector.y = 0.0;
00520 goal.possible_grasps[i].post_grasp_retreat.direction.vector.z = 1.0;
00521 goal.possible_grasps[i].post_grasp_retreat.desired_distance = 0.1;
00522 goal.possible_grasps[i].post_grasp_retreat.min_distance = 0.0;
00523 goal.possible_grasps[i].post_grasp_retreat.direction.header.frame_id = planning_frame;
00524
00525 goal.possible_grasps[i].post_place_retreat.direction = response.grasps[i].retreat.direction;
00526 goal.possible_grasps[i].post_place_retreat.desired_distance = response.grasps[i].retreat.desired_distance;
00527 goal.possible_grasps[i].post_place_retreat.min_distance = response.grasps[i].retreat.min_distance;
00528
00529 goal.possible_grasps[i].max_contact_force = response.grasps[i].max_contact_force;
00530 goal.possible_grasps[i].allowed_touch_objects = response.grasps[i].allowed_touch_objects;
00531 }
00532 }
00533 }
00534 }
00535
00536 if (goal.possible_grasps.empty())
00537 {
00538 planning_scene_monitor::LockedPlanningSceneRO lscene(context_->planning_scene_monitor_);
00539
00540 ROS_DEBUG_NAMED("manipulation", "Using default grasp poses");
00541 goal.minimize_object_distance = true;
00542
00543
00544
00545 moveit_msgs::Grasp g;
00546 g.grasp_pose.header.frame_id = goal.target_name;
00547 g.grasp_pose.pose.position.x = -0.2;
00548 g.grasp_pose.pose.position.y = 0.0;
00549 g.grasp_pose.pose.position.z = 0.0;
00550 g.grasp_pose.pose.orientation.x = 0.0;
00551 g.grasp_pose.pose.orientation.y = 0.0;
00552 g.grasp_pose.pose.orientation.z = 0.0;
00553 g.grasp_pose.pose.orientation.w = 1.0;
00554
00555 g.pre_grasp_approach.direction.header.frame_id = lscene->getPlanningFrame();
00556 g.pre_grasp_approach.direction.vector.x = 1.0;
00557 g.pre_grasp_approach.min_distance = 0.1;
00558 g.pre_grasp_approach.desired_distance = 0.2;
00559
00560 g.post_grasp_retreat.direction.header.frame_id = lscene->getPlanningFrame();
00561 g.post_grasp_retreat.direction.vector.z = 1.0;
00562 g.post_grasp_retreat.min_distance = 0.1;
00563 g.post_grasp_retreat.desired_distance = 0.2;
00564
00565 if (lscene->getRobotModel()->hasEndEffector(goal.end_effector))
00566 {
00567 g.pre_grasp_posture.joint_names =
00568 lscene->getRobotModel()->getEndEffector(goal.end_effector)->getJointModelNames();
00569 g.pre_grasp_posture.points.resize(1);
00570 g.pre_grasp_posture.points[0].positions.resize(g.pre_grasp_posture.joint_names.size(),
00571 std::numeric_limits<double>::max());
00572
00573 g.grasp_posture.joint_names = g.pre_grasp_posture.joint_names;
00574 g.grasp_posture.points.resize(1);
00575 g.grasp_posture.points[0].positions.resize(g.grasp_posture.joint_names.size(),
00576 -std::numeric_limits<double>::max());
00577 }
00578 goal.possible_grasps.push_back(g);
00579 }
00580 }
00581
00582 #include <class_loader/class_loader.h>
00583 CLASS_LOADER_REGISTER_CLASS(move_group::MoveGroupPickPlaceAction, move_group::MoveGroupCapability)