def draw_cdd_only_thread(): while True: try: # you can vary ``custom_mass`` to check that it has no effect vertices = compute_static_polygon_cdd_only(contacts, custom_mass) gui_handles['cdd_only'] = draw_com_polygon(vertices, black) except Exception as e: print "draw_cdd_only_thread:", e continue time.sleep(1e-2) if __name__ == "__main__": pymanoid.init() robot = RobotModel(download_if_needed=True) robot.set_transparency(0.2) robot_mass = robot.mass viewer = pymanoid.get_env().GetViewer() viewer.SetCamera( numpy.array([[0.60587192, -0.36596244, 0.70639274, -2.4904027], [-0.79126787, -0.36933163, 0.48732874, -1.6965636], [0.08254916, -0.85420468, -0.51334199, 2.79584694], [0., 0., 0., 1.]])) viewer.SetBkgndColor([1, 1, 1]) fname = sys.argv[1] if len(sys.argv) > 1 else '../stances/triple.json' contacts = pymanoid.ContactSet.from_json(fname) com_target = pymanoid.Cube(0.01, visible=True) outbox = pymanoid.Cube(0.02, color='b')
robot.ik.add_task(DOFTask(robot, robot.ROT_P, 0., gain=0.9, weight=0.05)) robot.solve_ik() def record_video(): window_recorder.record_video = True camera_travel.on_tick(sim) time.sleep(2) sim.start() if __name__ == "__main__": seed(24) pylab.ion() pymanoid.init(set_viewer=False) robot = RobotModel(download_if_needed=True) robot.set_transparency(0.3) env = pymanoid.get_env() env.SetViewer('qtcoin') pymanoid.env.set_default_background_color() viewer = pymanoid.get_viewer() viewer.SetCamera( [[5.39066316e-01, 3.61154816e-01, -7.60903874e-01, 6.57677031e+00], [8.42254221e-01, -2.26944015e-01, 4.88982864e-01, -2.9774201e+00], [3.91593606e-03, -9.04468691e-01, -4.26522042e-01, 2.25269456e+00], [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]]) contacts = generate_contacts() com = PointMass([0, 0, 0], robot.mass, visible=False) free_foot = FreeFoot(color='c', visible=False)
def suntan_hrp(ambient=0., diffuse=0.85): with robot_lock: robot.set_transparency(0) for link in robot.rave.GetLinks(): if len(link.GetGeometries()) > 0: geom = link.GetGeometries()[0] geom.SetAmbientColor([ambient] * 3) geom.SetDiffuseColor([diffuse] * 3) if __name__ == "__main__": seed(42) pymanoid.init(set_viewer=False) robot = RobotModel(download_if_needed=True) robot_mass = robot.mass # saved here to avoid taking robot_lock pymanoid.get_env().SetViewer('qtcoin') viewer = pymanoid.get_viewer() set_camera_0() robot.set_transparency(0.3) staircase = generate_staircase( radius=1.4, angular_step=0.5, height=1.4, roughness=0.5, friction=0.7, step_dim_x=0.2, step_dim_y=0.1)