openai / mujoco-py

MuJoCo is a physics engine for detailed, efficient rigid body simulations with contacts. mujoco-py allows using MuJoCo from Python 3.
Other
2.81k stars 810 forks source link

How to map mesh_vert to global cartesian coordinates? #722

Closed naruya closed 2 years ago

naruya commented 2 years ago

Help! How to map mesh_vert to global cartesian coordinates?

We have seen that geom local coordinates can be converted to global coordinates by

    # local pos/rot
    pos = env.sim.model.geom_pos[geom_id].copy()
    quat = env.sim.model.geom_quat[geom_id].copy()

    # global pos/rot (for storing outputs)
    xpos = np.zeros(3, dtype=np.float64)
    xrot = np.identity(3, dtype=np.float64).flatten()

    mj_local2Global(env.sim.data, xpos, xrot, pos, quat, body_id, False)

Now what we want to do is to get the global coordinates of mesh (env.sim.model.mesh_vert). I would like to know if there are any useful methods, functions, or easy ways to achieve this. Thanks!

naruya commented 2 years ago

I got the solution here. https://github.com/deepmind/mujoco/issues 345