Rotational Jacobian w.r.t. quaternion

Discussion in 'Modeling' started by Keven Wang, Nov 25, 2017.

  1. Hi,

    I have two questions regarding the jacobian calculation in mujoco:

    1. I'm using the rotational jacobian from mj_jacBody function. http://www.mujoco.org/book/reference.html#mj_jacBody. Is this jacobian with respect to Euler angles in world coordinate?

    2. Is there a way to compute jacobian with respect to quaternion?
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    This is the Jacobian with respect to a quaternion. However, quaternions representing orientations live on the unit 3D sphere in 4D. The Jacobian maps from joint velocity (qvel) to rotational velocity. But this velocity cannot be a 4D vector, because then the quaternion can leave the unit sphere. Instead, it is a 3D vector which is tangent to the sphere (the actual math involves an exponential map). From the viewpoint of 3D geometry, the direction of that velocity vector is the axis of rigid-body rotation, while the length of the vector is the speed of rotation. If you want to integrate the quaternion with that velocity, use the function mju_quatIntegrate.
     
  3. Thanks for the detailed explanation.

    I'm trying to control my end-effector to reach a desired quaternion. So I'm using the pseudo-inverse of the rotational jacobian, to go from endeffector quaternion to joint velocity. How could I go from endeffector quaternion derivative to joint velocity?

    Currently, I have the following. However, even when I set a fixed target quaternion, my endeffector keeps moving. So I'm likely doing something wrong. Any idea?


    # quat: current quaternion of endeffector
    # quat_targ: target quaternion of endeffector we want to be in

    # 1. compute qvel
    mujoco_py.functions.mj_differentiatePos(model, qvel, dt, quat, quat_targ)
    # 2. compute inverse rotational jacobian jacr_inv
    # ...
    # 3. compute joint velocity vel_joint
    vel_joint = jacr_inv.dot(qvel)
     
    Last edited: Nov 29, 2017
  4. OK. I think I figured it out. I was computing qvel in the wrong way. Now I'm using: mju_quat2Vel() to go from delta quaternion to qvel.