Example #1
0
 def init_cameras(self, ):
     self.cameras = list()
     self.add_camera(
         Trackball(rot=[-0.152, 0.045, -0.002, 0.987],
                   trans=[0.050, 0.210, -2.500]), "Camera Y up")
     self.add_camera(
         Trackball(rot=[0.535, 0.284, 0.376, 0.701],
                   trans=[0.10, 0.02, -2.770]), "Camera Z up")
     self.set_camera(0)
Example #2
0
 def getViewer(self, sim, title=None):
     # glutInit(sys.argv)
     win = PushGLUTWindow(sim, title)
     win.scene.add_camera(Trackball(theta=-45.0, phi=0.0, zoom=0.1),
                          'gym_camera')
     win.scene.set_camera(win.scene.num_cameras() - 1)
     win.run()
     return win
Example #3
0
def getViewer(sim, title=None):

    win = PyQt5Window(sim, title)
    win.scene.add_camera(
        Trackball(theta=0, phi=0, zoom=1.2, trans=[0, 0.0, -30]),
        'Hopper_camera')
    win.scene.set_camera(win.scene.num_cameras() - 1)
    #win.run()
    return win
Example #4
0
    def getViewer(self, sim, title=None):
        # glutInit(sys.argv)
        win = StaticGLUTWindow(sim, title)
        win.scene.add_camera(Trackball(theta=-45.0, phi = 0.0, zoom=0.1), 'gym_camera')
        win.scene.set_camera(win.scene.num_cameras()-1)

        # to add speed,
        if self._obs_type == 'image':
            win.run(self.screen_width, self.screen_height, _show_window=self.visualize)
        else:
            win.run(_show_window=self.visualize)
        return win
Example #5
0
 def update_camera(self):
     self.glutwindow.scene.replace_camera(
         0,
         Trackball(theta=self.camera_theta,
                   phi=self.camera_phi,
                   trans=[
                       self.camera_horizontal, self.camera_vertical,
                       self.camera_depth
                   ]))
     self.glutwindow.scene.set_camera(0)
     self.glutwindow.drawGL()
     print("\r")
Example #6
0
    def __init__(self, env, title):
        Thread.__init__(self)
        self.cv = Condition()
        self.title = title
        self.env = env
        self.sim = env.sim
        self.win = MyGLUTWindow(self.sim.world, self.sim, self.env, self.title,
                                self.cv)

        self.camera_theta = 75  #, for mirror 85
        self.camera_phi = 135  #, for mirror -75
        self.camera_horizontal = 0.0
        self.camera_vertical = -0.25
        self.camera_depth = -1.25
        self.camera_0 = Trackball(theta=self.camera_theta,
                                  phi=self.camera_phi,
                                  trans=[
                                      self.camera_horizontal,
                                      self.camera_vertical, self.camera_depth
                                  ])
        self.win.scene.replace_camera(0, self.camera_0)
Example #7
0
for joint in robot.joints:
    print(joint.name)
# rootJoint added by default
# the default name for z trans root is rootJoint_pos_z
# positions['rootJoint_pos_z'] = 1.5
# positions['rootz'] = 1.5
# robot.set_positions(positions)

# robot.joints[0].set_actuator_type(pydart.joint.Joint.LOCKED)      # TODO
# floor.joints[0].set_actuator_type(pydart.joint.Joint.LOCKED)

# pydart.gui.viewer.launch(world, default_camera=1)  # Use Z-up camera

win = StaticGLUTWindow(world, None)
win.scene.add_camera(Trackball(theta=-45.0, phi=0.0, zoom=0.1), 'gym_camera')
# win.scene.set_camera(1)
win.run()

# win = pydart.gui.pyqt5.window.PyQt5Window(world)
#
# win.scene.add_camera(Trackball(theta=-45.0, phi=0.0, zoom=0.1), 'gym_camera')
# win.scene.set_camera(1)
# win.run()

while world.t < 10.0:
    robot.set_forces([0.0] * 3 + [100.0] * 3)
    # print(world.skeletons[1].q)
    world.step()
    # win.scene.render(sim=world)
    win.runSingleStep()
Example #8
0
from pydart2.gui.trackball import Trackball
from pydart2.gui.glut.window import GLUTWindow
stop = False

if __name__ == '__main__':
    print('Hello, PyDART!')

    pydart.init()
    print('pydart initialization OK')

    world = pydart.World(0.0005, 'examples/data/skel/arti_data.skel')
    #world.set_gravity([0, -9.8, 0])
    print('pydart create_world OK')
    # pydart.gui.viewer.launch(world)
    # skel = world.skeletons[-1]
    # skel.friction = 0.9
    #skel.q = (np.random.rand(skel.ndofs))
    #skel.set_forces(np.array([0, 0, 0, 100, 0, 0]))
    #skel.set_accelerations([0, 5, 0])
    #print(skel.tau)
    #print(skel.friction)
    # skel.controller = ApplyForce(skel)
    win = GLUTWindow(world, None)
    # win.scene.set_camera(None)
    win.scene.add_camera(
        Trackball(rot=[-0.152, 0.045, -0.002, 0.987], trans=[0, 0.2, -.500]),
        "Camera Y up")
    win.scene.set_camera(2)
    # skel.bodynodes[0].set_mass(1)
    win.run()