def __init__(self): self.gcc = None self.dn = dexnet.DexNet() self.dn.open_database(DEX_NET_PATH + DB_NAME, create_db=True) self.dn.open_dataset('3dnet') self.gripper_name = GRIPPER_NAME self.gripper = dexnet.grasping.gripper.RobotGripper.load( GRIPPER_NAME, DEX_NET_PATH + GRIPPER_REL_PATH) self.gripper_rotation = [1, 0, 0, 0] self.cc_approach_dist = 1.0 self.cc_delta_approach = 0.1 # may need tuning
def __init__(self): # init core members self.dexnet_api = dexnet.DexNet() # setup command line parsing self.comp = Completer() readline.set_completer_delims(' \t\n;') readline.parse_and_bind("tab: complete") readline.set_completer(self.comp.complete) # display welcome message self.display_welcome()
import matplotlib.ticker as ticker import dexnet DEX_NET_PATH = '../dex-net/' DB_NAME = 'dexnet_2.hdf5' GRIPPER_NAME = 'yumi_metal_spline' GRIPPER_REL_PATH = 'data/grippers/' GRASP_METRIC = 'ferrari_canny' scene = Scene(show_gui=False) scene_pop = ScenePopulator(scene) total_grasps = 0 metrics_all = [] dn = dexnet.DexNet() dn.open_database(DEX_NET_PATH + DB_NAME, create_db=True) dn.open_dataset('3dnet') for item_name in scene_pop.item_database: grasps, metrics = dn.get_grasps(item_name, GRIPPER_NAME, GRASP_METRIC) l = len(grasps) print "num_grasps: " + str(l) + " ---" + "max: " + str( metrics[0]) + " ---min: " + str(metrics[-1]) + " ---" + item_name total_grasps += l metrics_all += metrics print "total grasps: " + str(total_grasps) print "mean: " + str(np.mean(metrics_all)) print "median: " + str(np.median(metrics_all))
@author: pyni """ import numpy as np import pybullet as p import random as rd import os from collision_checker_independent import GraspCollisionChecker openravechecker = GraspCollisionChecker(view=False) import dexnet path_of_stl_file = '/media/yuan/pyni/20190410/dexnet/dex-net/data/p_pybullet/' path_of_tmp_file = '/media/yuan/pyni/20190410/dexnet/dex-net/apps/' path_of_pickle_file = '/media/yuan/pyni/20190410/dexnet/' datasetpath = path_of_tmp_file + str(rd.random()) + 'temp_database.hdf5' dexnet_api = dexnet.DexNet() try: dexnet_api.open_database(datasetpath) except: pass try: dexnet_api.open_dataset('tmp') except: pass dexnet_api.setpath(path_of_pickle_file) dexnet_api.add_object(path_of_stl_file + '009_gelatin_box.stl', fast=True) dexnet_api.showgraspfrompickle('009_gelatin_box', 'ferrari_canny', False, False, openravechecker) #dexnet_api.showgraspfrompicklewithcandidate ( '009_gelatin_box', 'ferrari_canny', False , True ,openravechecker)