예제 #1
0
def sample_grasps(graspable, gripper, config):
    """ Sample grasps and compute metrics for given object, gripper, and stable pose """
    # create grasp sampler)
    if config['grasp_sampler'] == 'antipodal':
        sampler = gs.AntipodalGraspSampler(gripper, config)
    elif config['grasp_sampler'] == 'mesh_antipodal':
        sampler = gs.MeshAntipodalGraspSampler(gripper, config)
    elif config['grasp_sampler'] == 'gaussian':
        sampler = gs.GaussianGraspSampler(gripper, config)
    elif config['grasp_sampler'] == 'uniform':
        sampler = gs.UniformGraspSampler(gripper, config)

    # sample grasps
    grasps = sampler.generate_grasps(graspable, max_iter=config['max_grasp_sampling_iters'])
    return grasps
예제 #2
0
    def _single_obj_grasps(dataset, obj, gripper, config, stable_pose_id=None):
        """ Sample grasps and compute metrics for given object, gripper, and stable pose """

        # create grasp sampler
        logger.info('Sampling grasps')
        if config['grasp_sampler'] == 'antipodal':
            sampler = gs.AntipodalGraspSampler(gripper, config)
        elif config['grasp_sampler'] == 'gaussian':
            sampler = gs.GaussianGraspSampler(gripper, config)
        elif config['grasp_sampler'] == 'uniform':
            sampler = gs.UniformGraspSampler(gripper, config)

        # sample grasps
        grasps = sampler.generate_grasps(
            obj, max_iter=config['max_grasp_sampling_iters'])
        return grasps