Get derivative of qpos

Discussion in 'Simulation' started by Robert, Jan 7, 2020.

  1. 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:
    [​IMG]
    Where the state typically contains positons and velocities:
    [​IMG]
    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:
    [​IMG]

    But what to do with [​IMG] ? 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!
     
    Last edited: Jan 7, 2020
  2. Robert likes this.
  3. @florianw thank you for your reply.
    A question, how can you figure out wich values from qpos make up a quaternion? Since it is a combination of the degrees-of-freedeom (not exactly, but that's roughly the idea) it is not obvious to me to find specific parts of it.
     
  4. Quaternions occur for freejoints and ball joints. Also the joints occur in the same sequence as specified in the mjcf file. You can get everything from the api, like joint type and the corresponding starting adress in qpos (qposadr if i remember correctly). As a quick yet hack check you could calculate the norm of the four values. it should equal 1.
     
    Robert likes this.