Skip to content

Python bindings for open source MuJoCo

License

Notifications You must be signed in to change notification settings

erwincoumans/pymujoco

Repository files navigation

pymujoco Software License

pymujoco-python bindings for MuJoCo simulator generated using pybind11.

There is also a preliminary colab that allows headless rendering using EGL (cannot restart the EGL context at the moment).

Usage

from pymujoco import *
r = mjv_create_renderer()

#help(p)
m = mj_loadXML("humanoid.xml")
#print(m.qpos0)
#print(m.nq)
#print(m.nv)
d = mj_makeData(m)

exit_requested=False
while not exit_requested:
  mj_step(m,d)
  
  print(d.qpos)
  exit_requested = r.render(m,d)
  
names = ''.join([row.tostring().decode('UTF-8') for row in m.names]).split('\x00')
print("names=",names)
mj_printModel(m, "humanoid2.txt")
mj_deleteData(d)
mj_deleteModel(m)

mjv_delete_renderer(r)