if __name__ == "__main__": sim = pymanoid.Simulation(dt=0.03) robot = pymanoid.robots.JVRC1() set_torque_limits(robot) robot.show_com() sim.set_viewer() sim.set_camera_transform( numpy.array([[-0.75166831, -0.47792323, 0.45451529, -0.99502754], [-0.65817994, 0.49930137, -0.563469, 1.14903212], [0.04235481, -0.72269463, -0.68986849, 2.35493684], [0., 0., 0., 1.]])) robot.set_transparency(0.25) stance = Stance.from_json('jvrc1_double_support.json') stance.bind(robot) robot.ik.solve() polygon_height = stance.com.z # [m] uncons_polygon = stance.compute_static_equilibrium_polygon(method="cdd") h1 = draw_horizontal_polygon(uncons_polygon, polygon_height, color='g') sim.schedule(robot.ik) sim.start() ada = ActuationDependentArea(robot, stance) ada.sample_working_set(uncons_polygon, "sample", 20) PLAY_WITH_LOCAL_POLYGONS = False if PLAY_WITH_LOCAL_POLYGONS:
print("- half-width = %s" % repr(contact.shape[1])) print("- friction = %f" % contact.friction) print("") if __name__ == "__main__": sim = pymanoid.Simulation(dt=0.03) robot = pymanoid.robots.JVRC1('JVRC-1.dae', download_if_needed=True) sim.set_viewer() sim.viewer.SetCamera([ [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.]]) robot.set_transparency(0.25) stance = Stance.from_json('stances/triple.json') stance.bind(robot) robot.ik.solve() sim.schedule(robot.ik) sim.start() p = array([0., 0., 0.]) CWC_O = stance.compute_wrench_inequalities(p) print_contact("Left foot", stance.left_foot) print_contact("Right foot", stance.right_foot) print("Contact Wrench Cone at %s:" % str(p)) print("- has %d lines" % CWC_O.shape[0]) if IPython.get_ipython() is None: IPython.embed()
def on_tick(self, sim): self.stance.com.set_x(self.com_above.x) self.stance.com.set_y(self.com_above.y) if __name__ == "__main__": sim = pymanoid.Simulation(dt=0.03) robot = pymanoid.robots.JVRC1('JVRC-1.dae', download_if_needed=True) sim.set_viewer() sim.set_camera_top(x=0., y=0., z=3.) robot.set_transparency(0.25) com_above = pymanoid.Cube(0.02, [0.05, 0.04, z_polygon], color='b') stance = Stance.from_json('../stances/double.json') stance.com.hide() stance.bind(robot) robot.ik.solve() method = "hull" if "bretl" in sys.argv: method = "bretl" elif "cdd" in sys.argv: method = "cdd" com_sync = COMSync(stance, com_above) polygon_drawer = SupportPolygonDrawer(stance, method) wrench_drawer = StaticWrenchDrawer(stance) sim.schedule(robot.ik)
robot.L_UINDEX, robot.L_ULITTLE ]) robot.set_dof_values(-q_fingers, [ robot.R_LTHUMB, robot.R_LINDEX, robot.R_LLITTLE, robot.R_UTHUMB, robot.R_UINDEX, robot.R_ULITTLE ]) sim.set_viewer() sim.set_camera_transform( array([[-0.75318301, -0.33670976, 0.56510344, -1.27825475], [-0.65389426, 0.28962469, -0.69895625, 1.3535881], [0.07167748, -0.89595987, -0.43831297, 1.87996328], [0., 0., 0., 1.]])) robot.set_transparency(0.25) stance = Stance.from_json('jvrc1_ladder_climbing.json') stance.bind(robot) robot.ik.maximize_margins = True robot.ik.verbosity = 0 robot.ik.solve(impr_stop=1e-3) from pymanoid.tasks import AxisAngleContactTask if False: del robot.ik.tasks['left_hand_palm'] del robot.ik.tasks['right_hand_palm'] lh_task = AxisAngleContactTask(robot, robot.left_hand, stance.left_hand, weight=1, gain=0.8)