def sample_rope_state(demofile, sim, animation, human_check=False, perturb_points=7, min_rad=0.1, max_rad=0.1): success = False while not success: # TODO: pick a random rope initialization new_xyz, demo_id = load_random_start_segment(demofile) perturb_radius = random.uniform(min_rad, max_rad) rope_nodes = rope_initialization.find_path_through_point_cloud( new_xyz, perturb_peak_dist=perturb_radius, num_perturb_points=perturb_points) replace_rope(sim, rope_nodes, animation) sim.settle() if animation: sim.viewer.Step() if human_check: resp = raw_input("Use this simulation?[Y/n]") success = resp not in ('N', 'n') else: success = True return (rope_nodes, demo_id)
def sample_rope_state(demofile, sim, animation, human_check=False, perturb_points=7, min_rad=0.1, max_rad=0.1): success = False while not success: # TODO: pick a random rope initialization new_xyz, demo_id = load_random_start_segment(demofile) perturb_radius = random.uniform(min_rad, max_rad) rope_nodes = rope_initialization.find_path_through_point_cloud( new_xyz, perturb_peak_dist=perturb_radius, num_perturb_points=perturb_points) replace_rope(sim, rope_nodes, animation) sim.settle() if animation: sim.viewer.Step() if human_check: resp = raw_input("Use this simulation?[Y/n]") success = resp not in ('N', 'n') else: success = True return (rope_nodes, demo_id)
def sample_rope_state(rope_args, sim, animation=False, human_check=True): print 'Sampling rope state' success = False while not success: new_xyz, demo_id = load_random_start_segment(GlobalVars.actions) print demo_id perturb_radius = random.uniform(rope_args.min_rad, rope_args.max_rad) rope_nodes = rope_initialization.find_path_through_point_cloud( new_xyz, perturb_peak_dist=perturb_radius, num_perturb_points=rope_args.n_perturb_pts) replace_rope(sim, rope_nodes, animation) sim.settle() if human_check: resp = raw_input("Use this simulation?[Y/n]") success = resp not in ('N', 'n') else: success = True return sim.get_state()
def sample_rope_state(rope_args, sim, animation=False, human_check=True): print 'Sampling rope state' success = False while not success: new_xyz, demo_id = load_random_start_segment(GlobalVars.actions) print demo_id perturb_radius = random.uniform(rope_args.min_rad, rope_args.max_rad) rope_nodes = rope_initialization.find_path_through_point_cloud( new_xyz, perturb_peak_dist=perturb_radius, num_perturb_points=rope_args.n_perturb_pts) replace_rope(sim, rope_nodes, animation) sim.settle() if human_check: resp = raw_input("Use this simulation?[Y/n]") success = resp not in ('N', 'n') else: success = True return sim.get_state()