qposadr -> jnt id

Discussion in 'Priority support' started by Ethan Brooks, Jun 28, 2018.

  1. I would like to identify the upper bound and lower bound (if any) for each element in qpos.
    Presumably I need to associate each index in qpos with an index in jnt_range. How can I do this?
     
  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    For dofs there is mjData.dof_jntid. You can use this for velocity, acceleration and force vectors. But qpos is more complicated because of quaternions. So you should index it the other way around: scan mjData.jnt_qposadr and look for the qpos address you need. The number of qpos addresses associated with each joint depends on the joint type: 7 for free joint, 4 for ball joint, 1 for hinge and slider joint.
     
  3. This worked well. Thank you. I iterated through integers up to njnt and looked up the corresponding jnt_type. If it was mjJNT_SLIDE or mjJNT_HINGE, I set a limit.