34 pub_ao =
nh_.
advertise<moveit_msgs::AttachedCollisionObject>(
"attached_collision_object", 10);
38 map_classid_to_classname[13]=
"fruittea";
39 map_classid_to_classname[16]=
"orangemarmelade";
40 map_classid_to_classname[18]=
"yellowsaltcube";
41 map_classid_to_classname[27]=
"hotpot";
42 map_classid_to_classname[30]=
"bluesaltcube";
43 map_classid_to_classname[31]=
"yellowsaltcylinder";
44 map_classid_to_classname[44]=
"knaeckebrot";
45 map_classid_to_classname[46]=
"liviosunfloweroil";
46 map_classid_to_classname[50]=
"instantsoup";
47 map_classid_to_classname[52]=
"hotpot2";
48 map_classid_to_classname[57]=
"mueslibars";
49 map_classid_to_classname[65]=
"fruitdrink";
50 map_classid_to_classname[99]=
"ruskwholemeal";
51 map_classid_to_classname[101]=
"koalacandy";
52 map_classid_to_classname[103]=
"instanttomatosoup";
53 map_classid_to_classname[106]=
"bakingsoda";
54 map_classid_to_classname[107]=
"sweetener";
55 map_classid_to_classname[109]=
"chocoicing";
56 map_classid_to_classname[119]=
"tomatoherbsauce";
57 map_classid_to_classname[122]=
"peanuts";
58 map_classid_to_classname[126]=
"herbsalt";
59 map_classid_to_classname[128]=
"bathdetergent";
62 map_classid_to_classname[5001]=
"pringles";
65 static const std::string COB_PICKUP_ACTION_NAME =
"cob_pick_action";
69 static const std::string COB_PLACE_ACTION_NAME =
"cob_place_action";
77 static const std::string QUERY_GRASPS_OR_ACTION_NAME =
"query_grasps";
79 ROS_INFO(
"Waiting for action server \"%s\" to start...", QUERY_GRASPS_OR_ACTION_NAME.c_str());
81 ROS_INFO(
"Action server \"%s\" started.", QUERY_GRASPS_OR_ACTION_NAME.c_str());
86 ROS_INFO(
"cob_pick_action...spinning");
92 ROS_INFO(
"PickGoalCB: Received new goal: Trying to pick %s", goal->object_name.c_str());
93 cob_pick_place_action::CobPickResult
result;
99 if(goal->gripper_type.empty())
101 ROS_ERROR(
"Pick failed: No gripper_type specified!");
102 result.success.data=
false;
103 response=
"Pick failed: No gripper_type specified!";
104 as_pick->setAborted(result, response);
111 std::vector<moveit_msgs::Grasp> grasps;
112 if(goal->grasp_database==
"KIT")
115 if(goal->grasp_id!=0)
117 ROS_INFO(
"Using specific grasp_id: %d", goal->grasp_id);
118 fillSingleGraspKIT(goal->object_class, goal->gripper_type, goal->grasp_id, goal->object_pose, grasps);
123 fillAllGraspsKIT(goal->object_class, goal->gripper_type, goal->object_pose, grasps);
126 else if(goal->grasp_database==
"OpenRAVE")
128 ROS_INFO(
"Using OpenRAVE grasp table");
129 fillGraspsOR(goal->object_class, goal->gripper_type, goal->gripper_side, goal->grasp_id, goal->object_pose, grasps);
131 else if(goal->grasp_database==
"ALL")
133 ROS_INFO(
"Using all available databases");
134 std::vector<moveit_msgs::Grasp> grasps_OR, grasps_KIT;
135 fillAllGraspsKIT(goal->object_class, goal->gripper_type, goal->object_pose, grasps_KIT);
136 fillGraspsOR(goal->object_class, goal->gripper_type, goal->gripper_side, goal->grasp_id, goal->object_pose, grasps_OR);
139 std::vector<moveit_msgs::Grasp>::iterator it = grasps.end();
140 grasps.insert(it, grasps_OR.begin(), grasps_OR.end());
144 ROS_ERROR(
"Grasp_Database %s not supported! Please use \"KIT\" or \"OpenRAVE\" or \"ALL\" instead", goal->grasp_database.c_str());
145 result.success.data=
false;
146 response=
"Pick failed: Grasp Database not supported!";
147 as_pick->setAborted(result, response);
155 ROS_INFO(
"PickGoalCB: Found %lu grasps for this object", grasps.size());
156 for(
unsigned int i=0; i<grasps.size(); i++)
163 ROS_ERROR(
"No grasps found for object %s in database %s using gripper_type %s", goal->object_name.c_str(), goal->grasp_database.c_str(), goal->gripper_type.c_str());
164 result.success.data=
false;
165 response=
"Pick failed: No grasps found!";
166 as_pick->setAborted(result, response);
173 insertObject(goal->object_name, goal->object_class, goal->object_pose);
175 if(!(goal->support_surface.empty()))
177 ROS_INFO(
"Setting SupportSurface to %s", goal->support_surface.c_str());
185 if(error_code == moveit_msgs::MoveItErrorCodes::SUCCESS)
187 std::string msg =
"PICK SUCCEEDED: " + boost::lexical_cast<std::string>(error_code);
189 result.success.data=
true;
191 as_pick->setSucceeded(result, response);
197 std::string msg =
"PICK FAILED: " + boost::lexical_cast<std::string>(error_code);
199 result.success.data=
false;
201 as_pick->setAborted(result, response);
209 ROS_INFO(
"PlaceCB: Received new goal: Trying to Place %s", goal->object_name.c_str());
210 cob_pick_place_action::CobPlaceResult
result;
211 std::string response;
216 ROS_ERROR(
"Object %s cannot be placed", goal->object_name.c_str());
217 result.success.data =
false;
218 response =
"Object has not been picked before";
219 as_place->setAborted(result, response);
225 if(goal->destinations.empty())
227 ROS_ERROR(
"Object %s cannot be placed", goal->object_name.c_str());
228 result.success.data =
false;
229 response =
"No destinations given";
230 as_place->setAborted(result, response);
236 std::vector<moveit_msgs::PlaceLocation> locations;
237 trajectory_msgs::JointTrajectory pre_grasp_posture;
239 pre_grasp_posture.joint_names.resize(7);
240 pre_grasp_posture.joint_names[0] =
"sdh_knuckle_joint";
241 pre_grasp_posture.joint_names[1] =
"sdh_finger_12_joint";
242 pre_grasp_posture.joint_names[2] =
"sdh_finger_13_joint";
243 pre_grasp_posture.joint_names[3] =
"sdh_finger_22_joint";
244 pre_grasp_posture.joint_names[4] =
"sdh_finger_23_joint";
245 pre_grasp_posture.joint_names[5] =
"sdh_thumb_2_joint";
246 pre_grasp_posture.joint_names[6] =
"sdh_thumb_3_joint";
248 trajectory_msgs::JointTrajectoryPoint point;
249 point.positions.assign(7,0.0);
250 point.velocities.assign(7,0.0);
251 point.accelerations.assign(7,0.0);
252 point.effort.assign(7,0.0);
255 point.positions[0] = 0.0;
256 point.positions[1] = -0.9854;
257 point.positions[2] = 0.9472;
258 point.positions[3] = -0.9854;
259 point.positions[4] = 0.9472;
260 point.positions[5] = -0.9854;
261 point.positions[6] = 0.9472;
262 pre_grasp_posture.points.push_back(point);
264 for(
unsigned int i=0; i<goal->destinations.size(); i++)
266 moveit_msgs::PlaceLocation place_location;
268 place_location.id =
"Last_"+goal->object_name+
"_grasp";
269 place_location.post_place_posture = pre_grasp_posture;
270 place_location.place_pose = goal->destinations[i];
271 place_location.pre_place_approach.direction.header.frame_id =
"/base_footprint";
272 place_location.pre_place_approach.direction.vector.z = -1.0;
273 place_location.pre_place_approach.min_distance = 0.1;
274 place_location.pre_place_approach.desired_distance = 0.15;
275 place_location.post_place_retreat.direction.header.frame_id =
"/base_footprint";
276 place_location.post_place_retreat.direction.vector.z = 1.0;
277 place_location.post_place_retreat.min_distance = 0.1;
278 place_location.post_place_retreat.desired_distance = 0.15;
280 locations.push_back(place_location);
283 if(!(goal->support_surface.empty()))
285 ROS_INFO(
"Setting SupportSurface to %s", goal->support_surface.c_str());
292 if(error_code == moveit_msgs::MoveItErrorCodes::SUCCESS)
294 std::string msg =
"PLACE SUCCEEDED: " + boost::lexical_cast<std::string>(error_code);
296 result.success.data=
true;
298 as_place->setSucceeded(result, response);
304 std::string msg =
"PLACE FAILED: " + boost::lexical_cast<std::string>(error_code);
306 result.success.data=
false;
308 as_place->setAborted(result, response);
316 ROS_INFO(
"Adding object to MoveIt! environment..");
318 moveit_msgs::CollisionObject co;
319 co.header.stamp = object_pose.header.stamp;
320 co.header.frame_id = object_pose.header.frame_id;
324 co.operation = co.REMOVE;
329 co.operation = co.ADD;
332 std::transform(mesh_name.begin(), mesh_name.end(), mesh_name.begin(), ::tolower);
334 boost::scoped_ptr<shapes::Mesh> mesh;
338 co.meshes.push_back(boost::get<shape_msgs::Mesh>(shape_msg));
339 co.mesh_poses.push_back(object_pose.pose);
344 transform.
setOrigin(
tf::Vector3(object_pose.pose.position.x, object_pose.pose.position.y, object_pose.pose.position.z) );
345 transform.
setRotation(
tf::Quaternion(object_pose.pose.orientation.x, object_pose.pose.orientation.y, object_pose.pose.orientation.z, object_pose.pose.orientation.w) );
360 std::string
path =
ros::package::getPath(
"cob_grasp_generation")+std::string(
"/files/")+gripper_type+std::string(
"_grasptable_kit.txt");
366 ROS_ERROR(
"Failed to initialize GraspTables");
371 unsigned int grasp_index = 0;
390 std::string
path =
ros::package::getPath(
"cob_grasp_generation")+std::string(
"/files/")+gripper_type+std::string(
"_grasptable_kit.txt");
396 ROS_ERROR(
"Failed to initialize GraspTables");
404 ROS_INFO(
"GraspIndex %d found",grasp_id);
409 ROS_ERROR(
"Grasp %d NOT found", grasp_id);
415 moveit_msgs::Grasp g;
419 sensor_msgs::JointState pre_grasp_posture;
420 pre_grasp_posture.position.clear();
421 for (
unsigned int i=0; i<current_hand_pre_config.size(); i++)
423 pre_grasp_posture.position.push_back(current_hand_pre_config[i]);
429 sensor_msgs::JointState grasp_posture;
430 grasp_posture.position.clear();
431 for (
unsigned int i=0; i<current_hand_config.size(); i++)
433 grasp_posture.position.push_back(current_hand_config[i]);
441 std::vector<double> current_grasp_pose = current_grasp->
GetTCPGraspPose();
444 0.001*
tf::Vector3(current_grasp_pose[0],current_grasp_pose[1],current_grasp_pose[2]));
448 geometry_msgs::Transform msg_grasp_O_from_SDH;
455 tf::Quaternion(object_pose.pose.orientation.x, object_pose.pose.orientation.y, object_pose.pose.orientation.z, object_pose.pose.orientation.w),
456 tf::Vector3(object_pose.pose.position.x, object_pose.pose.position.y, object_pose.pose.position.z));
460 geometry_msgs::Transform msg_HEADER_from_O;
466 tf::Transform transform_grasp_FOOTPRINT_from_ARM7 =
transformPose(transform_grasp_O_from_SDH, transform_HEADER_from_O, object_pose.header.frame_id);
470 geometry_msgs::Transform msg_grasp_FOOTPRINT_from_ARM7;
472 ROS_DEBUG_STREAM(
"msg_grasp_FOOTPRINT_from_ARM7:" << msg_grasp_FOOTPRINT_from_ARM7);
476 geometry_msgs::Transform msg_transform_grasp_FOOTPRINT_from_ARM7;
477 tf::transformTFToMsg(transform_grasp_FOOTPRINT_from_ARM7, msg_transform_grasp_FOOTPRINT_from_ARM7);
478 geometry_msgs::PoseStamped msg_pose_grasp_FOOTPRINT_from_ARM7;
479 msg_pose_grasp_FOOTPRINT_from_ARM7.header.stamp =
ros::Time::now();
480 msg_pose_grasp_FOOTPRINT_from_ARM7.header.frame_id =
"/base_footprint";
481 msg_pose_grasp_FOOTPRINT_from_ARM7.pose.position.x = msg_transform_grasp_FOOTPRINT_from_ARM7.translation.x;
482 msg_pose_grasp_FOOTPRINT_from_ARM7.pose.position.y = msg_transform_grasp_FOOTPRINT_from_ARM7.translation.y;
483 msg_pose_grasp_FOOTPRINT_from_ARM7.pose.position.z = msg_transform_grasp_FOOTPRINT_from_ARM7.translation.z;
484 msg_pose_grasp_FOOTPRINT_from_ARM7.pose.orientation = msg_transform_grasp_FOOTPRINT_from_ARM7.rotation;
488 ROS_DEBUG_STREAM(
"msg_pose_grasp_FOOTPRINT_from_ARM7:" << msg_pose_grasp_FOOTPRINT_from_ARM7);
491 g.grasp_pose = msg_pose_grasp_FOOTPRINT_from_ARM7;
498 0.001*
tf::Vector3(current_pre_grasp_pose[0],current_pre_grasp_pose[1],current_pre_grasp_pose[2]));
502 geometry_msgs::Transform msg_pre_O_from_SDH;
508 tf::Transform transform_pre_FOOTPRINT_from_ARM7 =
transformPose(transform_pre_O_from_SDH, transform_HEADER_from_O, object_pose.header.frame_id);
512 geometry_msgs::Transform msg_pre_FOOTPRINT_from_ARM7;
514 ROS_DEBUG_STREAM(
"msg_pre_FOOTPRINT_from_ARM7:" << msg_pre_FOOTPRINT_from_ARM7);
518 geometry_msgs::Transform msg_transform_pre_FOOTPRINT_from_ARM7;
520 geometry_msgs::PoseStamped msg_pose_pre_FOOTPRINT_from_ARM7;
522 msg_pose_pre_FOOTPRINT_from_ARM7.header.frame_id =
"/base_footprint";
523 msg_pose_pre_FOOTPRINT_from_ARM7.pose.position.x = msg_transform_pre_FOOTPRINT_from_ARM7.translation.x;
524 msg_pose_pre_FOOTPRINT_from_ARM7.pose.position.y = msg_transform_pre_FOOTPRINT_from_ARM7.translation.y;
525 msg_pose_pre_FOOTPRINT_from_ARM7.pose.position.z = msg_transform_pre_FOOTPRINT_from_ARM7.translation.z;
526 msg_pose_pre_FOOTPRINT_from_ARM7.pose.orientation = msg_transform_pre_FOOTPRINT_from_ARM7.rotation;
529 ROS_DEBUG_STREAM(
"msg_pose_pre_FOOTPRINT_from_ARM7:" << msg_pose_pre_FOOTPRINT_from_ARM7);
532 g.pre_grasp_approach =
calculateApproachDirection(msg_pose_grasp_FOOTPRINT_from_ARM7.pose, msg_pose_pre_FOOTPRINT_from_ARM7.pose);
535 g.post_grasp_retreat.direction.header.frame_id = g.pre_grasp_approach.direction.header.frame_id;
536 g.post_grasp_retreat.direction.vector.x = -g.pre_grasp_approach.direction.vector.x;
537 g.post_grasp_retreat.direction.vector.y = -g.pre_grasp_approach.direction.vector.y;
538 g.post_grasp_retreat.direction.vector.z = -g.pre_grasp_approach.direction.vector.z + 0.5;
540 g.post_grasp_retreat.min_distance = g.pre_grasp_approach.min_distance;
541 g.post_grasp_retreat.desired_distance = g.pre_grasp_approach.desired_distance;
543 g.post_place_retreat = g.post_grasp_retreat;
551 void CobPickPlaceActionServer::fillGraspsOR(
unsigned int objectClassId, std::string gripper_type, std::string gripper_side,
unsigned int grasp_id, geometry_msgs::PoseStamped object_pose, std::vector<moveit_msgs::Grasp> &grasps)
553 bool finished_before_timeout;
559 ROS_ERROR(
"Unable to resolve class_name for class_id %d", objectClassId);
564 cob_grasp_generation::QueryGraspsGoal goal_query_grasps;
566 goal_query_grasps.gripper_type = gripper_type;
567 goal_query_grasps.gripper_side = gripper_side;
568 goal_query_grasps.grasp_id = grasp_id;
569 goal_query_grasps.num_grasps = 0;
570 goal_query_grasps.threshold = 0;
578 if (finished_before_timeout)
582 ROS_INFO(
"Found %lu grasps for this object", result_query_grasps.get()->grasp_list.size());
583 for(
unsigned int i=0; i<result_query_grasps.get()->grasp_list.size(); i++)
585 ROS_DEBUG_STREAM(
"Grasp "<< i <<
": " << result_query_grasps.get()->grasp_list[i]);
588 for(
unsigned int i=0; i<result_query_grasps.get()->grasp_list.size(); i++)
590 moveit_msgs::Grasp current_grasp;
592 current_grasp.grasp_posture = result_query_grasps.get()->grasp_list[i].grasp_posture;
599 current_grasp.pre_grasp_posture = result_query_grasps.get()->grasp_list[i].pre_grasp_posture;
605 geometry_msgs::Pose current_grasp_pose = result_query_grasps.get()->grasp_list[i].grasp_pose.pose;
607 tf::Quaternion(current_grasp_pose.orientation.x, current_grasp_pose.orientation.y, current_grasp_pose.orientation.z, current_grasp_pose.orientation.w),
608 tf::Vector3(current_grasp_pose.position.x, current_grasp_pose.position.y, current_grasp_pose.position.z));
611 geometry_msgs::Transform msg_grasp_O_from_SDH;
617 tf::Quaternion(object_pose.pose.orientation.x, object_pose.pose.orientation.y, object_pose.pose.orientation.z, object_pose.pose.orientation.w),
618 tf::Vector3(object_pose.pose.position.x, object_pose.pose.position.y, object_pose.pose.position.z));
620 geometry_msgs::Transform msg_HEADER_from_O;
625 tf::Transform transform_grasp_FOOTPRINT_from_ARM7 =
transformPose(transform_grasp_O_from_SDH, transform_HEADER_from_O, object_pose.header.frame_id);
627 geometry_msgs::Transform msg_grasp_FOOTPRINT_from_ARM7;
629 ROS_DEBUG_STREAM(
"msg_grasp_FOOTPRINT_from_ARM7:" << msg_grasp_FOOTPRINT_from_ARM7);
632 geometry_msgs::Transform msg_transform_grasp_FOOTPRINT_from_ARM7;
633 tf::transformTFToMsg(transform_grasp_FOOTPRINT_from_ARM7, msg_transform_grasp_FOOTPRINT_from_ARM7);
634 geometry_msgs::PoseStamped msg_pose_grasp_FOOTPRINT_from_ARM7;
635 msg_pose_grasp_FOOTPRINT_from_ARM7.header.stamp =
ros::Time::now();
636 msg_pose_grasp_FOOTPRINT_from_ARM7.header.frame_id =
"/base_footprint";
637 msg_pose_grasp_FOOTPRINT_from_ARM7.pose.position.x = msg_transform_grasp_FOOTPRINT_from_ARM7.translation.x;
638 msg_pose_grasp_FOOTPRINT_from_ARM7.pose.position.y = msg_transform_grasp_FOOTPRINT_from_ARM7.translation.y;
639 msg_pose_grasp_FOOTPRINT_from_ARM7.pose.position.z = msg_transform_grasp_FOOTPRINT_from_ARM7.translation.z;
640 msg_pose_grasp_FOOTPRINT_from_ARM7.pose.orientation = msg_transform_grasp_FOOTPRINT_from_ARM7.rotation;
641 ROS_DEBUG_STREAM(
"msg_pose_grasp_FOOTPRINT_from_ARM7:" << msg_pose_grasp_FOOTPRINT_from_ARM7);
643 current_grasp.grasp_pose = msg_pose_grasp_FOOTPRINT_from_ARM7;
656 current_grasp.pre_grasp_approach.direction.vector.x = 0.0;
657 current_grasp.pre_grasp_approach.direction.vector.y = 0.0;
658 current_grasp.pre_grasp_approach.direction.vector.z = 1.0;
659 current_grasp.pre_grasp_approach.min_distance = 0.18;
660 current_grasp.pre_grasp_approach.desired_distance = 0.28;
670 current_grasp.post_grasp_retreat.direction.header.frame_id =
"/base_footprint";
671 current_grasp.post_grasp_retreat.direction.vector.x = 0.0;
672 current_grasp.post_grasp_retreat.direction.vector.y = 0.0;
673 current_grasp.post_grasp_retreat.direction.vector.z = 1.0;
674 current_grasp.post_grasp_retreat.min_distance = 0.05;
675 current_grasp.post_grasp_retreat.desired_distance = 0.1;
684 current_grasp.post_place_retreat = current_grasp.post_grasp_retreat;
686 grasps.push_back(current_grasp);
691 ROS_ERROR(
"Grasps not queried within timeout");
701 trajectory_msgs::JointTrajectory grasp_configuration;
703 trajectory_msgs::JointTrajectoryPoint point;
704 point.positions.assign(7,0.0);
705 point.velocities.assign(7,0.0);
706 point.accelerations.assign(7,0.0);
707 point.effort.assign(7,0.0);
710 point.positions[0] = table_config.position[0];
711 point.positions[1] = table_config.position[2];
712 point.positions[2] = table_config.position[3];
713 point.positions[3] = table_config.position[5];
714 point.positions[4] = table_config.position[6];
715 point.positions[5] = table_config.position[11];
716 point.positions[6] = table_config.position[12];
717 grasp_configuration.points.push_back(point);
719 grasp_configuration.joint_names.resize(7);
720 grasp_configuration.joint_names[0]=(
"sdh_knuckle_joint");
721 grasp_configuration.joint_names[1]=(
"sdh_thumb_2_joint");
722 grasp_configuration.joint_names[2]=(
"sdh_thumb_3_joint");
723 grasp_configuration.joint_names[3]=(
"sdh_finger_12_joint");
724 grasp_configuration.joint_names[4]=(
"sdh_finger_13_joint");
725 grasp_configuration.joint_names[5]=(
"sdh_finger_22_joint");
726 grasp_configuration.joint_names[6]=(
"sdh_finger_23_joint");
729 for(
unsigned int i=0; i<grasp_configuration.points[0].positions.size();i++)
731 if(grasp_configuration.points[0].positions[i]>1.57079){grasp_configuration.points[0].positions[i]=1.57079;}
732 if(grasp_configuration.points[0].positions[i]<-1.57079){grasp_configuration.points[0].positions[i]=-1.57079;}
734 return grasp_configuration;
744 bool transform_available =
false;
745 while(!transform_available)
751 transform_available =
true;
754 ROS_WARN(
"Waiting for transform...(%s)",ex.what());
760 geometry_msgs::TransformStamped msg_SDH_from_ARM7;
767 tf::Transform transform_O_from_ARM7 = transform_O_from_SDH * transform_SDH_from_ARM7;
782 geometry_msgs::TransformStamped msg_FOOTPRINT_from_HEADER;
786 ROS_DEBUG_STREAM(
"msg_FOOTPRINT_from_HEADER:" << msg_FOOTPRINT_from_HEADER);
789 tf::Transform transform_FOOTPRINT_from_O = transform_FOOTPRINT_from_HEADER * transform_HEADER_from_O;
792 tf::Transform transform_FOOTPRINT_from_ARM7 = transform_FOOTPRINT_from_O * transform_O_from_ARM7;
794 return transform_FOOTPRINT_from_ARM7;
799 double finger_length = 0.18;
800 moveit_msgs::GripperTranslation approach;
801 approach.direction.header.frame_id =
"/base_footprint";
806 pow((msg_pose_grasp_FOOTPRINT_from_ARM7.position.x-msg_pose_pre_FOOTPRINT_from_ARM7.position.x),2) +
807 pow((msg_pose_grasp_FOOTPRINT_from_ARM7.position.y-msg_pose_pre_FOOTPRINT_from_ARM7.position.y),2) +
808 pow((msg_pose_grasp_FOOTPRINT_from_ARM7.position.z-msg_pose_pre_FOOTPRINT_from_ARM7.position.z),2));
810 ROS_DEBUG(
"Distance between pre-grasp and grasp: %f", distance);
812 approach.direction.vector.x = (msg_pose_grasp_FOOTPRINT_from_ARM7.position.x-msg_pose_pre_FOOTPRINT_from_ARM7.position.x)/distance;
813 approach.direction.vector.y = (msg_pose_grasp_FOOTPRINT_from_ARM7.position.y-msg_pose_pre_FOOTPRINT_from_ARM7.position.y)/distance;
814 approach.direction.vector.z = (msg_pose_grasp_FOOTPRINT_from_ARM7.position.z-msg_pose_pre_FOOTPRINT_from_ARM7.position.z)/distance;
817 if(distance < finger_length)
819 approach.min_distance = finger_length;
823 approach.min_distance = distance;
825 approach.desired_distance = approach.min_distance + 0.1;
844 int main(
int argc,
char **argv)
846 ros::init (argc, argv,
"cob_pick_place_action_server_node");
854 ROS_INFO(
"Starting PickPlace ActionServer for group %s", argv[1]);
860 cob_pick_place_action_server->
run();
string object_name
ADDING OBJECT.
Grasp * GetGrasp(unsigned int object_class_id, unsigned int &grasp_id)
int main(int argc, char **argv)
static tf::Quaternion createQuaternionFromRPY(double roll, double pitch, double yaw)
moveit_msgs::GripperTranslation calculateApproachDirection(geometry_msgs::Pose msg_pose_grasp_FOOTPRINT_from_ARM7, geometry_msgs::Pose msg_pose_pre_FOOTPRINT_from_ARM7)
boost::scoped_ptr< actionlib::SimpleActionServer< cob_pick_place_action::CobPlaceAction > > as_place
void publish(const boost::shared_ptr< M > &message) const
Grasp * GetNextGrasp(unsigned int object_class_id)
void fillGraspsOR(unsigned int objectClassId, std::string gripper_type, std::string gripper_side, unsigned int grasp_id, geometry_msgs::PoseStamped object_pose, std::vector< moveit_msgs::Grasp > &grasps)
MoveItErrorCode pick(const std::string &object, bool plan_only=false)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
tf::TransformBroadcaster tf_broadcaster_
CobPickPlaceActionServer(std::string group_name)
boost::scoped_ptr< actionlib::SimpleActionServer< cob_pick_place_action::CobPickAction > > as_pick
std::vector< double > GetTCPGraspPose()
boost::scoped_ptr< actionlib::SimpleActionClient< cob_grasp_generation::QueryGraspsAction > > ac_grasps_or
void setPlanningTime(double seconds)
void insertObject(std::string object_name, unsigned int object_class, geometry_msgs::PoseStamped object_pose)
ROSCPP_DECL void spin(Spinner &spinner)
moveit::planning_interface::MoveGroupInterface group
const std::string & getEndEffectorLink() const
std::string toString() const
void fillSingleGraspKIT(unsigned int objectClassId, std::string gripper_type, unsigned int grasp_id, geometry_msgs::PoseStamped object_pose, std::vector< moveit_msgs::Grasp > &grasps)
std::string last_object_name
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
MoveItErrorCode place(const std::string &object, bool plan_only=false)
int Init(char *iniFile, unsigned int table_size=MAX_NO_OF_OBJECTS)
#define ROS_DEBUG_STREAM(args)
ROSLIB_DECL std::string getPath(const std::string &package_name)
std::vector< double > GetHandPreGraspConfig()
tf::Transform transformPose(tf::Transform transform_O_from_SDH, tf::Transform transform_HEADER_from_OBJECT, std::string object_frame_id)
bool constructMsgFromShape(const Shape *shape, ShapeMsg &shape_msg)
Mesh * createMeshFromResource(const std::string &resource)
#define ROS_INFO_STREAM(args)
void place_goal_cb(const cob_pick_place_action::CobPlaceGoalConstPtr &goal)
trajectory_msgs::JointTrajectory MapHandConfiguration(sensor_msgs::JointState table_config)
std::vector< double > GetHandOptimalGraspConfig()
void setSupportSurfaceName(const std::string &name)
GraspTable * m_GraspTable
tf::TransformListener tf_listener_
static void transformStampedTFToMsg(const StampedTransform &bt, geometry_msgs::TransformStamped &msg)
void pick_goal_cb(const cob_pick_place_action::CobPickGoalConstPtr &goal)
#define ROS_ERROR_STREAM(args)
std::vector< double > GetTCPPreGraspPose()
std::map< unsigned int, std::string > map_classid_to_classname
void fillAllGraspsKIT(unsigned int objectClassId, std::string gripper_type, geometry_msgs::PoseStamped object_pose, std::vector< moveit_msgs::Grasp > &grasps)
double distance(const urdf::Pose &transform)
static void transformTFToMsg(const Transform &bt, geometry_msgs::Transform &msg)
boost::variant< shape_msgs::SolidPrimitive, shape_msgs::Mesh, shape_msgs::Plane > ShapeMsg
void ResetReadPtr(unsigned int object_class_id)
void convertGraspKIT(Grasp *current_grasp, geometry_msgs::PoseStamped object_pose, std::vector< moveit_msgs::Grasp > &grasps)