def call_plan_point_cluster_grasp(cluster):

    req = GraspPlanningRequest()
    req.target.reference_frame_id = "/base_link"
    req.target.cluster = cluster
    req.arm_name = "right_arm"
    req.collision_support_surface_name = "table"
    service_name = "plan_point_cluster_grasp"
    rospy.loginfo("waiting for plan_point_cluster_grasp service")
    rospy.wait_for_service(service_name)
    rospy.loginfo("service found")
    serv = rospy.ServiceProxy(service_name, GraspPlanning)
    try:
        res = serv(req)
    except rospy.ServiceException, e:
        rospy.logerr("error when calling plan_point_cluster_grasp: %s" % e)
        return 0
コード例 #2
0
def call_plan_segmented_clutter_grasps(point_cloud, box_pose, box_dims,
                                       arm_name):
    """call plan_point_cluster_grasp to get candidate grasps for a cluster"""
    req = GraspPlanningRequest()
    req.arm_name = arm_name
    req.target.reference_frame_id = box_pose.header.frame_id
    req.target.region.cloud = point_cloud
    req.target.region.roi_box_pose = box_pose
    req.target.region.roi_box_dims = box_dims

    service_name = "plan_segmented_clutter_grasps"
    rospy.loginfo("waiting for %s" % service_name)
    rospy.wait_for_service(service_name)
    rospy.loginfo("service found")
    serv = rospy.ServiceProxy(service_name, GraspPlanning)
    try:
        res = serv(req)
    except rospy.ServiceException, e:
        rospy.logerr("error when calling plan_segmented_clutter_grasps: %s" %
                     e)
        return 0