本文整理汇总了C++中actionlib::SimpleActionClient::waitForResult方法的典型用法代码示例。如果您正苦于以下问题:C++ SimpleActionClient::waitForResult方法的具体用法?C++ SimpleActionClient::waitForResult怎么用?C++ SimpleActionClient::waitForResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类actionlib::SimpleActionClient
的用法示例。
在下文中一共展示了SimpleActionClient::waitForResult方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rt_arm_request_tool_pose_wrt_torso
int ArmMotionCommander::rt_arm_request_tool_pose_wrt_torso(void) {
// debug: compare this to output of:
//rosrun tf tf_echo torso yale_gripper_frame
ROS_INFO("requesting right-arm tool pose");
cart_goal_.command_code = cwru_action::cwru_baxter_cart_moveGoal::RT_ARM_GET_TOOL_POSE;
cart_move_action_client_.sendGoal(cart_goal_, boost::bind(&ArmMotionCommander::doneCb_, this, _1, _2)); // we could also name additional callback functions here, if desired
finished_before_timeout_ = cart_move_action_client_.waitForResult(ros::Duration(2.0));
if (!finished_before_timeout_) {
ROS_WARN("did not respond within timeout");
return (int) cwru_action::cwru_baxter_cart_moveResult::NOT_FINISHED_BEFORE_TIMEOUT;
}
if (cart_result_.return_code!=cwru_action::cwru_baxter_cart_moveResult::SUCCESS) {
ROS_WARN("move did not return success; code = %d",cart_result_.return_code);
return (int) cart_result_.return_code;
}
tool_pose_stamped_ = cart_result_.current_pose_gripper_right;
ROS_INFO("move returned success; right arm tool pose: ");
ROS_INFO("origin w/rt torso = %f, %f, %f ",tool_pose_stamped_.pose.position.x,
tool_pose_stamped_.pose.position.y,tool_pose_stamped_.pose.position.z);
ROS_INFO("quaternion x,y,z,w: %f, %f, %f, %f",tool_pose_stamped_.pose.orientation.x,
tool_pose_stamped_.pose.orientation.y,tool_pose_stamped_.pose.orientation.z,
tool_pose_stamped_.pose.orientation.w);
return (int) cart_result_.return_code;
}
示例2: rt_arm_plan_path_current_to_goal_pose
int ArmMotionCommander::rt_arm_plan_path_current_to_goal_pose(geometry_msgs::PoseStamped des_pose) {
ROS_INFO("requesting a cartesian-space motion plan");
cart_goal_.command_code = cwru_action::cwru_baxter_cart_moveGoal::RT_ARM_PLAN_PATH_CURRENT_TO_GOAL_POSE;
cart_goal_.des_pose_gripper_right = des_pose;
cart_move_action_client_.sendGoal(cart_goal_, boost::bind(&ArmMotionCommander::doneCb_, this, _1, _2)); // we could also name additional callback functions here, if desired
finished_before_timeout_ = cart_move_action_client_.waitForResult(ros::Duration(2.0));
ROS_INFO("return code: %d",cart_result_.return_code);
if (!finished_before_timeout_) {
ROS_WARN("giving up waiting on result");
return (int) cwru_action::cwru_baxter_cart_moveResult::NOT_FINISHED_BEFORE_TIMEOUT;
}
ROS_INFO("finished before timeout");
if (cart_result_.return_code==cwru_action::cwru_baxter_cart_moveResult::RT_ARM_PATH_NOT_VALID) {
ROS_WARN("right arm plan not valid");
return (int) cart_result_.return_code;
}
if (cart_result_.return_code!=cwru_action::cwru_baxter_cart_moveResult::SUCCESS) {
ROS_WARN("unknown return code... not SUCCESS");
return (int) cart_result_.return_code;
}
//here if success return code
ROS_INFO("returned SUCCESS from planning request");
computed_arrival_time_= cart_result_.computed_arrival_time; //action_client.get_computed_arrival_time();
ROS_INFO("computed move time: %f",computed_arrival_time_);
return (int) cart_result_.return_code;
}
示例3: rt_arm_plan_path_current_to_goal_dp_xyz
int ArmMotionCommander::rt_arm_plan_path_current_to_goal_dp_xyz(Eigen::Vector3d dp_displacement) {
ROS_INFO("requesting a cartesian-space motion plan along vector");
cart_goal_.command_code = cwru_action::cwru_baxter_cart_moveGoal::RT_ARM_PLAN_PATH_CURRENT_TO_GOAL_DP_XYZ;
//must fill in desired vector displacement
cart_goal_.arm_dp_right.resize(3);
for (int i=0;i<3;i++) cart_goal_.arm_dp_right[i] = dp_displacement[i];
cart_move_action_client_.sendGoal(cart_goal_, boost::bind(&ArmMotionCommander::doneCb_, this, _1, _2)); // we could also name additional callback functions here, if desired
finished_before_timeout_ = cart_move_action_client_.waitForResult(ros::Duration(2.0));
ROS_INFO("return code: %d",cart_result_.return_code);
if (!finished_before_timeout_) {
ROS_WARN("giving up waiting on result");
return (int) cwru_action::cwru_baxter_cart_moveResult::NOT_FINISHED_BEFORE_TIMEOUT;
}
ROS_INFO("finished before timeout");
if (cart_result_.return_code==cwru_action::cwru_baxter_cart_moveResult::RT_ARM_PATH_NOT_VALID) {
ROS_WARN("right arm plan not valid");
return (int) cart_result_.return_code;
}
if (cart_result_.return_code!=cwru_action::cwru_baxter_cart_moveResult::SUCCESS) {
ROS_WARN("unknown return code... not SUCCESS");
return (int) cart_result_.return_code;
}
//here if success return code
ROS_INFO("returned SUCCESS from planning request");
computed_arrival_time_= cart_result_.computed_arrival_time; //action_client.get_computed_arrival_time();
ROS_INFO("computed move time: %f",computed_arrival_time_);
return (int) cart_result_.return_code;
}
示例4: rt_arm_plan_jspace_path_current_to_qgoal
int ArmMotionCommander::rt_arm_plan_jspace_path_current_to_qgoal(Eigen::VectorXd q_des_vec) {
ROS_INFO("requesting a joint-space motion plan");
cart_goal_.command_code = cwru_action::cwru_baxter_cart_moveGoal::RT_ARM_PLAN_JSPACE_PATH_CURRENT_TO_QGOAL;
cart_goal_.q_goal_right.resize(7);
for (int i=0;i<7;i++) cart_goal_.q_goal_right[i] = q_des_vec[i]; //specify the goal js pose
cart_move_action_client_.sendGoal(cart_goal_, boost::bind(&ArmMotionCommander::doneCb_, this, _1, _2)); // we could also name additional callback functions here, if desired
finished_before_timeout_ = cart_move_action_client_.waitForResult(ros::Duration(2.0));
ROS_INFO("return code: %d",cart_result_.return_code);
if (!finished_before_timeout_) {
ROS_WARN("giving up waiting on result");
return (int) cwru_action::cwru_baxter_cart_moveResult::NOT_FINISHED_BEFORE_TIMEOUT;
}
ROS_INFO("finished before timeout");
if (cart_result_.return_code==cwru_action::cwru_baxter_cart_moveResult::RT_ARM_PATH_NOT_VALID) {
ROS_WARN("right arm plan not valid");
return (int) cart_result_.return_code;
}
if (cart_result_.return_code!=cwru_action::cwru_baxter_cart_moveResult::SUCCESS) {
ROS_WARN("unknown return code... not SUCCESS");
return (int) cart_result_.return_code;
}
//here if success return code
ROS_INFO("returned SUCCESS from planning request");
computed_arrival_time_= cart_result_.computed_arrival_time; //action_client.get_computed_arrival_time();
ROS_INFO("computed move time: %f",computed_arrival_time_);
return (int) cart_result_.return_code;
}
示例5: send_test_goal
void ArmMotionCommander::send_test_goal(void) {
ROS_INFO("sending a test goal");
cart_goal_.command_code = cwru_action::cwru_baxter_cart_moveGoal::ARM_TEST_MODE;
cart_move_action_client_.sendGoal(cart_goal_, boost::bind(&ArmMotionCommander::doneCb_, this, _1, _2)); // we could also name additional callback functions here, if desired
finished_before_timeout_ = cart_move_action_client_.waitForResult(ros::Duration(2.0));
//bool finished_before_timeout = action_client.waitForResult(); // wait forever...
if (!finished_before_timeout_) {
ROS_WARN("giving up waiting on result");
} else {
ROS_INFO("finished before timeout");
ROS_INFO("return code: %d",cart_result_.return_code);
}
}
示例6: rt_arm_execute_planned_path
int ArmMotionCommander::rt_arm_execute_planned_path(void) {
ROS_INFO("requesting execution of planned path");
cart_goal_.command_code = cwru_action::cwru_baxter_cart_moveGoal::RT_ARM_EXECUTE_PLANNED_PATH;
cart_move_action_client_.sendGoal(cart_goal_, boost::bind(&ArmMotionCommander::doneCb_, this, _1, _2)); // we could also name additional callback functions here, if desired
finished_before_timeout_ = cart_move_action_client_.waitForResult(ros::Duration(computed_arrival_time_+2.0));
if (!finished_before_timeout_) {
ROS_WARN("did not complete move in expected time");
return (int) cwru_action::cwru_baxter_cart_moveResult::NOT_FINISHED_BEFORE_TIMEOUT;
}
if (cart_result_.return_code!=cwru_action::cwru_baxter_cart_moveResult::SUCCESS) {
ROS_WARN("move did not return success; code = %d",cart_result_.return_code);
return (int) cart_result_.return_code;
}
ROS_INFO("move returned success");
return (int) cart_result_.return_code;
}
示例7: turn
void turn() {
turtlebot_actions::TurtlebotMoveGoal goal;
goal.forward_distance = 0;
goal.turn_distance = M_PI;
action_client.waitForServer();
action_client.sendGoal(goal);
//wait for the action to return
bool finished_before_timeout = action_client.waitForResult(
ros::Duration(30.0));
if (finished_before_timeout) {
actionlib::SimpleClientGoalState state = action_client.getState();
ROS_INFO("Action finished: %s", state.toString().c_str());
} else
ROS_INFO("Action did not finish before the time out.");
}
示例8: rt_arm_request_q_data
//send goal command to request right-arm joint angles; these will be stored in internal variable
int ArmMotionCommander::rt_arm_request_q_data(void) {
ROS_INFO("requesting right-arm joint angles");
cart_goal_.command_code = cwru_action::cwru_baxter_cart_moveGoal::RT_ARM_GET_Q_DATA;
cart_move_action_client_.sendGoal(cart_goal_, boost::bind(&ArmMotionCommander::doneCb_, this, _1, _2)); // we could also name additional callback functions here, if desired
finished_before_timeout_ = cart_move_action_client_.waitForResult(ros::Duration(computed_arrival_time_+2.0));
if (!finished_before_timeout_) {
ROS_WARN("did not respond within timeout");
return (int) cwru_action::cwru_baxter_cart_moveResult::NOT_FINISHED_BEFORE_TIMEOUT;
}
if (cart_result_.return_code!=cwru_action::cwru_baxter_cart_moveResult::SUCCESS) {
ROS_WARN("move did not return success; code = %d",cart_result_.return_code);
return (int) cart_result_.return_code;
}
q_vec_ = cart_result_.q_arm_right;
ROS_INFO("move returned success; right arm angles: ");
ROS_INFO("%f; %f; %f; %f; %f; %f; %f",q_vec_[0],q_vec_[1],q_vec_[2],q_vec_[3],q_vec_[4],q_vec_[5],q_vec_[6]);
return (int) cart_result_.return_code;
}
示例9: execute_planned_move
void ArmMotionInterface::execute_planned_move(void) {
if (!path_is_valid_) {
cart_result_.return_code = cwru_action::cwru_baxter_cart_moveResult::RT_ARM_PATH_NOT_VALID;
ROS_WARN("attempted to execute invalid path!");
cart_move_as_.setAborted(cart_result_); // tell the client we have given up on this goal; send the result message as well
}
// convert path to a trajectory:
//baxter_traj_streamer_.stuff_trajectory(optimal_path_, des_trajectory_); //convert from vector of poses to trajectory message
js_goal_.trajectory = des_trajectory_;
//computed_arrival_time_ = des_trajectory_.points.back().time_from_start.toSec();
ROS_INFO("sending action request to traj streamer node");
ROS_INFO("computed arrival time is %f", computed_arrival_time_);
busy_working_on_a_request_ = true;
traj_streamer_action_client_.sendGoal(js_goal_, boost::bind(&ArmMotionInterface::js_doneCb_, this, _1, _2)); // we could also name additional callback functions here, if desired
finished_before_timeout_ = traj_streamer_action_client_.waitForResult(ros::Duration(computed_arrival_time_ + 2.0));
if (!finished_before_timeout_) {
ROS_WARN("EXECUTE_PLANNED_PATH: giving up waiting on result");
cart_result_.return_code = cwru_action::cwru_baxter_cart_moveResult::NOT_FINISHED_BEFORE_TIMEOUT;
cart_move_as_.setSucceeded(cart_result_); //could say "aborted"
} else {
ROS_INFO("finished before timeout");
cart_result_.return_code = cwru_action::cwru_baxter_cart_moveResult::SUCCESS;
cart_move_as_.setSucceeded(cart_result_);
}
path_is_valid_ = false; // reset--require new path before next move
busy_working_on_a_request_ = false;
//save the last point commanded, for future reference
std::vector <double> last_pt;
last_pt = des_trajectory_.points.back().positions;
int njnts = last_pt.size();
for (int i=0;i<njnts;i++) {
last_arm_jnt_cmd_right_[i] = last_pt[i];
}
}
示例10: actualizeGoal
void actualizeGoal(ros::NodeHandle& nh,
actionlib::SimpleActionClient<arm_navigation_msgs::MoveArmAction>& client,
arm_navigation_msgs::MoveArmGoal goal) {
if (nh.ok())
{
bool finished_within_time = false;
client.sendGoal(goal);
finished_within_time = client.waitForResult(ros::Duration(200.0));
if (!finished_within_time)
{
client.cancelGoal();
ROS_INFO("Timed out achieving goal");
}
else
{
actionlib::SimpleClientGoalState state = client.getState();
bool success = (state == actionlib::SimpleClientGoalState::SUCCEEDED);
if(success)
ROS_INFO("Action finished: %s",state.toString().c_str());
else
ROS_INFO("Action failed: %s",state.toString().c_str());
}
}
}
示例11: move_straight
void move_straight() {
float current_angle = 0;
float desired_angle = 0;
/*
if (map->frames.size() > 0) {
Sophus::SE3f position =
map->frames[map->frames.size() - 1]->get_pos();
Eigen::Vector3f current_heading = position.unit_quaternion()
* Eigen::Vector3f::UnitZ();
current_angle = std::atan2(-current_heading(1), current_heading(0));
desired_angle = std::asin(position.translation()(1)/10.0);
}*/
turtlebot_actions::TurtlebotMoveGoal goal;
goal.forward_distance = 25.0;
goal.turn_distance = current_angle - desired_angle;
action_client.waitForServer();
action_client.sendGoal(goal);
//wait for the action to return
bool finished_before_timeout = action_client.waitForResult(
ros::Duration(500.0));
if (finished_before_timeout) {
actionlib::SimpleClientGoalState state = action_client.getState();
ROS_INFO("Action finished: %s", state.toString().c_str());
} else
ROS_INFO("Action did not finish before the time out.");
map->save("corridor_map");
}
示例12: pickAndPlace
void pickAndPlace(const geometry_msgs::Pose& start_pose, const geometry_msgs::Pose& end_pose)
{
ROS_INFO("[pick and place] Picking. Also placing.");
simple_arm_server::MoveArmGoal goal;
simple_arm_server::ArmAction action;
simple_arm_server::ArmAction grip;
/* open gripper */
grip.type = simple_arm_server::ArmAction::MOVE_GRIPPER;
grip.move_time.sec = 1.0;
grip.command = gripper_open;
goal.motions.push_back(grip);
/* arm straight up */
tf::Quaternion temp;
temp.setRPY(0,1.57,0);
action.goal.orientation.x = temp.getX();
action.goal.orientation.y = temp.getY();
action.goal.orientation.z = temp.getZ();
action.goal.orientation.w = temp.getW();
/* hover over */
action.goal.position.x = start_pose.position.x;
action.goal.position.y = start_pose.position.y;
action.goal.position.z = z_up;
action.move_time.sec = 0.25;
goal.motions.push_back(action);
/* go down */
action.goal.position.z = start_pose.position.z;
action.move_time.sec = 1.5;
goal.motions.push_back(action);
/* close gripper */
grip.type = simple_arm_server::ArmAction::MOVE_GRIPPER;
grip.command = gripper_closed;
grip.move_time.sec = 1.0;
goal.motions.push_back(grip);
/* go up */
action.goal.position.z = z_up;
action.move_time.sec = 1.0;
goal.motions.push_back(action);
/* hover over */
action.goal.position.x = end_pose.position.x;
action.goal.position.y = end_pose.position.y;
action.goal.position.z = z_up;
action.move_time.sec = 1.0;
goal.motions.push_back(action);
/* go down */
action.goal.position.z = end_pose.position.z;
action.move_time.sec = 1.5;
goal.motions.push_back(action);
/* open gripper */
grip.command = gripper_open;
goal.motions.push_back(grip);
/* go up */
action.goal.position.z = z_up;
action.move_time.sec = 1.0;
goal.motions.push_back(action);
goal.header.frame_id = arm_link;
client_.sendGoal(goal);
ROS_INFO("[pick and place] Sent goal. Waiting.");
client_.waitForResult(ros::Duration(30.0));
ROS_INFO("[pick and place] Received result.");
if (client_.getState() == actionlib::SimpleClientGoalState::SUCCEEDED)
as_.setSucceeded(result_);
else
{
ROS_INFO("Actual state: %s", client_.getState().toString().c_str());
as_.setAborted(result_);
}
}
示例13: executeCB
//.........这里部分代码省略.........
ROS_INFO("stored previous command to gripper one: ");
cout<<gripper1_affine_last_commanded_pose_.linear()<<endl;
cout<<"origin: "<<gripper1_affine_last_commanded_pose_.translation().transpose()<<endl;
// first, reiterate previous command:
// this could be easier, if saved previous joint-space trajectory point...
des_gripper_affine1_ = affine_lcamera_to_psm_one_.inverse()*gripper1_affine_last_commanded_pose_; //previous pose
ik_solver_.ik_solve(des_gripper_affine1_); //convert desired pose into equiv joint displacements
q_vec1 = ik_solver_.get_soln();
q_vec1(6) = last_gripper_ang1_; // include desired gripper opening angle
des_gripper_affine2_ = affine_lcamera_to_psm_two_.inverse()*gripper2_affine_last_commanded_pose_; //previous pose
ik_solver_.ik_solve(des_gripper_affine2_); //convert desired pose into equiv joint displacements
q_vec2 = ik_solver_.get_soln();
cout<<"q_vec1 of stored pose: "<<endl;
for (int i=0;i<6;i++) {
cout<<q_vec1[i]<<", ";
}
cout<<endl;
q_vec2(6) = last_gripper_ang2_; // include desired gripper opening angle
for (int i=0;i<7;i++) {
trajectory_point.positions[i] = q_vec1(i);
trajectory_point.positions[i+7] = q_vec2(i);
}
cout<<"start traj pt: "<<endl;
for (int i=0;i<14;i++) {
cout<<trajectory_point.positions[i]<<", ";
}
cout<<endl;
trajectory_point.time_from_start = ros::Duration(0.0); // start time set to 0
// PUSH IN THE START POINT:
des_trajectory.points.push_back(trajectory_point);
// compute and append the goal point, in joint space trajectory:
des_gripper_affine1_ = affine_lcamera_to_psm_one_.inverse()*des_gripper1_affine_wrt_lcamera_;
ROS_INFO("desired gripper one location in base frame: ");
cout<<"gripper1 desired pose; "<<endl;
cout<<des_gripper_affine1_.linear()<<endl;
cout<<"origin: "<<des_gripper_affine1_.translation().transpose()<<endl;
ik_solver_.ik_solve(des_gripper_affine1_); //convert desired pose into equiv joint displacements
q_vec1 = ik_solver_.get_soln();
q_vec1(6) = gripper_ang1_; // include desired gripper opening angle
des_gripper_affine2_ = affine_lcamera_to_psm_two_.inverse()*des_gripper2_affine_wrt_lcamera_;
ik_solver_.ik_solve(des_gripper_affine2_); //convert desired pose into equiv joint displacements
q_vec2 = ik_solver_.get_soln();
cout<<"q_vec1 of goal pose: "<<endl;
for (int i=0;i<6;i++) {
cout<<q_vec1[i]<<", ";
}
cout<<endl;
q_vec2(6) = gripper_ang2_;
for (int i=0;i<7;i++) {
trajectory_point.positions[i] = q_vec1(i);
trajectory_point.positions[i+7] = q_vec2(i);
}
trajectory_point.time_from_start = ros::Duration(arrival_time_);
cout<<"goal traj pt: "<<endl;
for (int i=0;i<14;i++) {
cout<<trajectory_point.positions[i]<<", ";
}
cout<<endl;
des_trajectory.points.push_back(trajectory_point);
js_goal_.trajectory = des_trajectory;
// Need boost::bind to pass in the 'this' pointer
// see example: http://library.isr.ist.utl.pt/docs/roswiki/actionlib_tutorials%282f%29Tutorials%282f%29Writing%2820%29a%2820%29Callback%2820%29Based%2820%29Simple%2820%29Action%2820%29Client.html
// ac.sendGoal(goal,
// boost::bind(&MyNode::doneCb, this, _1, _2),
// Client::SimpleActiveCallback(),
// Client::SimpleFeedbackCallback());
js_action_client_.sendGoal(js_goal_, boost::bind(&CartMoveActionServer::js_doneCb_,this,_1,_2)); // we could also name additional callback functions here, if desired
// action_client.sendGoal(goal, &doneCb, &activeCb, &feedbackCb); //alt--more callback funcs possible
double t_timeout=arrival_time_+2.0; //wait 2 sec longer than expected duration of move
bool finished_before_timeout = js_action_client_.waitForResult(ros::Duration(t_timeout));
//bool finished_before_timeout = action_client.waitForResult(); // wait forever...
if (!finished_before_timeout) {
ROS_WARN("joint-space interpolation result is overdue ");
} else {
ROS_INFO("finished before timeout");
}
ROS_INFO("completed callback" );
cart_move_as_.setSucceeded(cart_result_); // tell the client that we were successful acting on the request, and return the "result" message
//let's remember the last pose commanded, so we can use it as start pose for next move
gripper1_affine_last_commanded_pose_ = des_gripper1_affine_wrt_lcamera_;
gripper2_affine_last_commanded_pose_ = des_gripper2_affine_wrt_lcamera_;
//and the jaw opening angles:
last_gripper_ang1_=gripper_ang1_;
last_gripper_ang2_=gripper_ang2_;
}
示例14: executeGrasps
bool executeGrasps(const std::vector<manipulation_msgs::Grasp>& possible_grasps,
const geometry_msgs::Pose& block_pose)
{
ROS_INFO_STREAM_NAMED("pick_place_moveit","Creating Pickup Goal");
// ---------------------------------------------------------------------------------------------
// Create PlanningOptions
moveit_msgs::PlanningOptions options;
// The diff to consider for the planning scene (optional)
//PlanningScene planning_scene_diff
// If this flag is set to true, the action
// returns an executable plan in the response but does not attempt execution
options.plan_only = false;
// If this flag is set to true, the action of planning &
// executing is allowed to look around (move sensors) if
// it seems that not enough information is available about
// the environment
options.look_around = false;
// If this value is positive, the action of planning & executing
// is allowed to look around for a maximum number of attempts;
// If the value is left as 0, the default value is used, as set
// with dynamic_reconfigure
//int32 look_around_attempts
// If set and if look_around is true, this value is used as
// the maximum cost allowed for a path to be considered executable.
// If the cost of a path is higher than this value, more sensing or
// a new plan needed. If left as 0.0 but look_around is true, then
// the default value set via dynamic_reconfigure is used
//float64 max_safe_execution_cost
// If the plan becomes invalidated during execution, it is possible to have
// that plan recomputed and execution restarted. This flag enables this
// functionality
options.replan = false;
// The maximum number of replanning attempts
//int32 replan_attempts
// ---------------------------------------------------------------------------------------------
// Create and populate the goal
moveit_msgs::PickupGoal goal;
// An action for picking up an object
// The name of the object to pick up (as known in the planning scene)
goal.target_name = chosen_block_object_.id;
// which group should be used to plan for pickup
goal.group_name = PLANNING_GROUP_NAME;
// which end-effector to be used for pickup (ideally descpending from the group above)
goal.end_effector = EE_NAME;
// a list of possible grasps to be used. At least one grasp must be filled in
goal.possible_grasps.resize(possible_grasps.size());
goal.possible_grasps = possible_grasps;
// the name that the support surface (e.g. table) has in the collision map
// can be left empty if no name is available
//string collision_support_surface_name
// whether collisions between the gripper and the support surface should be acceptable
// during move from pre-grasp to grasp and during lift. Collisions when moving to the
// pre-grasp location are still not allowed even if this is set to true.
goal.allow_gripper_support_collision = true;
// The names of the links the object to be attached is allowed to touch;
// If this is left empty, it defaults to the links in the used end-effector
//string[] attached_object_touch_links
// Optional constraints to be imposed on every point in the motion plan
//Constraints path_constraints
// an optional list of obstacles that we have semantic information about
// and that can be touched/pushed/moved in the course of grasping;
// CAREFUL: If the object name 'all' is used, collisions with all objects are disabled during the approach & lift.
//string[] allowed_touch_objects
// The maximum amount of time the motion planner is allowed to plan for
goal.allowed_planning_time = 10.0; // seconds?
// Planning options
goal.planning_options = options;
//ROS_INFO_STREAM_NAMED("pick_place_moveit","Pause");
//ros::Duration(5.0).sleep();
// ---------------------------------------------------------------------------------------------
// Send the grasp to move_group/Pickup
ROS_INFO_STREAM_NAMED("pick_place_moveit","Sending pick action to move_group/Pickup");
movegroup_action_.sendGoal(goal);
if(!movegroup_action_.waitForResult(ros::Duration(20.0)))
//.........这里部分代码省略.........