def noise_vis(): print 'best actions', np.max(action.metadata['vertex_probs'], axis=0) render_3d_scene(env) j = 113 j = np.argmax(action.metadata['vertex_probs'][:, 1]) a = j * policy.toppling_model.n_trials b = (j + 1) * policy.toppling_model.n_trials for i in range(a, b): start = policy.toppling_model.vertices[i] end = start - .01 * policy.toppling_model.push_directions[i] vis3d.plot([start, end], color=[0, 1, 0], radius=.0002) vis3d.show(starting_camera_pose=camera_pose())
#figure_0() # figure_3() # figure_0() #failure_modes() action = policy.action(env.state) #noise_vis() if False: j = np.argmax(action.metadata['vertex_probs'][:, 2]) R = policy.toppling_model.tipping_point_rotations()[1] mesh.apply_transform(R.matrix) vis3d.mesh(mesh, color=env.state.color) new_point = (R * Point(action.metadata['vertices'][j], 'world')).data new_normal = (R * Point(action.metadata['normals'][j], 'world')).data vis3d.points(new_point, radius=.001, color=[0, 1, 0]) vis3d.plot([new_point, new_point + .01 * new_normal], radius=.0001) vis3d.show(starting_camera_pose=CAMERA_POSE) # state.T_obj_world.translation[:2] = np.array([0,0]) # Visualize if args.topple_probs: vis3d.figure() env.render_3d_scene() for vertex, prob in zip(action.metadata['vertices'], action.metadata['topple_probs']): color = [min(1, 2 * (1 - prob)), min(2 * prob, 1), 0] vis3d.points(Point(vertex, 'world'), scale=.001, color=color) # for bottom_point in policy.toppling_model.bottom_points: # vis3d.points(Point(bottom_point, 'world'), scale=.001, color=[0,0,0]) display_or_save('{}_topple_probs.gif'.format(obj_name))