Пример #1
0
def init_ground_truth():
    global ground_truth_items
    apc.load_fake_items()
    apc.load_all_items(gripper=baxter.gripper.gripper_name)
    #ground_truth_items = [apc.ItemInBin(apc.item_info['tall_item'],'bin_C'),
    ground_truth_items = [apc.ItemInBin(apc.item_info['cheezit_bit_original'],'bin_C'),
                          apc.ItemInBin(apc.item_info['small_item'],'bin_D'),
                          apc.ItemInBin(apc.item_info['med_item'],'bin_J')]
    #only load geometries for items that were spawned
    names = set()
    for item in ground_truth_items:
        names.add(item.info.name)
    print "Loading geometries for",','.join(names)
    for name in names:
        item = apc.item_info[name]
        item.geometry = apc.load_item_geometry(item)

    #set_in_bin_xform uses bounding boxes to set vertical offsets, and 
    #bounding boxes are set up only *after* geometries are loaded
    ground_truth_items[0].set_in_bin_xform(ground_truth_shelf_xform,0.3,0.3,0.0)
    ground_truth_items[1].set_in_bin_xform(ground_truth_shelf_xform,0.5,0.1,math.pi/4)
    ground_truth_items[2].set_in_bin_xform(ground_truth_shelf_xform,0.4,0.25,math.pi/2)
    
    return
Пример #2
0
sys.path.append('../klampt_models')
import rethink_electric_gripper,reflex_col

grippermodules = {'reflex':reflex_col,
                  'rethink_electric_gripper':rethink_electric_gripper,
                  }
grippermodule = grippermodules[grippername]

world = WorldModel()
world.readFile(os.path.join('../klampt_models/',grippermodule.klampt_model_name))
robot = world.robot(0)

#load the items and spawn one in the world
apc.load_item(objectname,gripper=grippername)
item = apc.item_info[objectname]
item.geometry = apc.load_item_geometry(item)
itemposed = apc.ItemInBin(item,'blah')
itemposed.xform = se3.identity()
apc.spawn_item_in_world(itemposed,world)

#set the directory
print "Resouce directory is",os.path.join('../resources/',os.path.splitext(grippermodule.klampt_model_name)[0])
resource.setDirectory(os.path.join('../resources/',os.path.splitext(grippermodule.klampt_model_name)[0]))

#edit the default configurations
default_open_config = resource.get('default_open.config',
                                   description='Default hand open configuration',
                                   doedit='auto',
                                   world=world)
default_closed_config = resource.get('default_closed.config',
                                     description='Default hand closed configuration',