def main(): parser = argparse.ArgumentParser() #parser.add_argument('-attempts', default=100, type=int, # help='The number of attempts') parser.add_argument('-cfree', action='store_true', help='When enabled, disables collision checking (for debugging).') #parser.add_argument('-grasp_type', default=GRASP_TYPES[0], # help='Specifies the type of grasp.') #parser.add_argument('-problem', default='test_block', # help='The name of the problem to solve.') parser.add_argument('-max_time', default=10*60, type=float, help='The maximum runtime') parser.add_argument('-num_samples', default=1000, type=int, help='The number of samples') parser.add_argument('-robot', default=FRANKA_CARTER, choices=[FRANKA_CARTER, EVE], help='The robot to use.') parser.add_argument('-seed', default=None, help='The random seed to use.') parser.add_argument('-teleport', action='store_true', help='Uses unit costs') parser.add_argument('-visualize', action='store_true', help='When enabled, visualizes planning rather than the world (for debugging).') args = parser.parse_args() world = World(use_gui=args.visualize, robot_name=args.robot) #dump_body(world.robot) for joint in world.kitchen_joints: world.open_door(joint) # open_door | close_door world.open_gripper() # TODO: sample from set of objects? object_name = '{}_{}_block{}'.format(BLOCK_SIZES[-1], BLOCK_COLORS[0], 0) world.add_body(object_name) # TODO: could constrain Eve to be within a torso cone grasp_colors = { TOP_GRASP: RED, SIDE_GRASP: BLUE, } #combinations = list(product(OPEN_SURFACES, GRASP_TYPES)) \ # + [(surface_name, TOP_GRASP) for surface_name in DRAWERS] \ # + [(surface_name, SIDE_GRASP) for surface_name in CABINETS] # ENV_SURFACES combinations = [] for surface_name in ZED_LEFT_SURFACES: if surface_name in (OPEN_SURFACES + DRAWERS): combinations.append((surface_name, TOP_GRASP)) if surface_name in (OPEN_SURFACES + CABINETS): combinations.append((surface_name, SIDE_GRASP)) # TODO: parallelize print('Combinations:', combinations) wait_for_user('Start?') for surface_name, grasp_type in combinations: #draw_picks(world, object_name, surface_name, grasp_type, color=grasp_colors[grasp_type]) collect_place(world, object_name, surface_name, grasp_type, args) world.destroy()
def main(): parser = argparse.ArgumentParser() #parser.add_argument('-attempts', default=100, type=int, # help='The number of attempts') parser.add_argument( '-cfree', action='store_true', help='When enabled, disables collision checking (for debugging).') parser.add_argument('-max_time', default=10 * 60, type=float, help='The maximum runtime') parser.add_argument('-num_samples', default=1000, type=int, help='The number of samples') parser.add_argument('-seed', default=None, help='The random seed to use.') parser.add_argument('-teleport', action='store_true', help='Uses unit costs') parser.add_argument( '-visualize', action='store_true', help= 'When enabled, visualizes planning rather than the world (for debugging).' ) args = parser.parse_args() # TODO: could record the full trajectories here world = World(use_gui=args.visualize) world.open_gripper() #joint_names = DRAWER_JOINTS + CABINET_JOINTS joint_names = ZED_LEFT_JOINTS print('Joints:', joint_names) print('Knobs:', KNOBS) wait_for_user('Start?') for joint_name in joint_names: collect_pull(world, joint_name, args) for knob_name in KNOBS: collect_pull(world, knob_name, args) world.destroy()