For an application I am writing I need MuJoCo to function as the dynamics back-end. This is going so far so good, however, I'm running into a problem tying stuff together. I need the system dynamics in terms of the state: Where the state typically contains positons and velocities: This notation is nice because it allows you to tackle Eulrer angles vs. Angular velocity. (See this post.) In this case qpos has one more dimension than qvel. The second part of the state derivative is easy: But what to do with ? Is there a built-in function to get the derivative of d->qpos? I know it is not (always) equal to d->qvel, which is obvious when the dimensions are different. In the documentation this is glanced over without giving a real answer: http://www.mujoco.org/book/programming.html#siStateControl I could find the derivative of the quaternion using qvel, however, for e.g. the Humanoid model with nq = 28 it is not trival to find which variables make up the freejoint rotation. Thank you!