Easiest way to compute Jacobian

Discussion in 'Simulation' started by Michael J Mathew, Sep 18, 2016.

  1. Hi,

    What is the easiest (and efficient) way to compute jacobian of end-effector of an arm? Or any point on the robot specified as an end-effector?
    Is there a technique to define a particular point as end-effector and then compute its jacobian? (like the one we have in Orocos-KDL)


  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    The function for computing Jacobians is:

    void mj_jac(const mjModel* m,const mjData* d, mjtNum* jacp, mjtNum* jacr, const mjtNum* point, int body);

    jacp and jacr point to 3-by-nv matrices you allocated that will hold the result. If either is NULL, that Jacobian is not computed. The point is in 3D global coordinates. body is the body index.

    There are also helper functions mj_jacBody, mj_jacSite etc that compute the Jacobian of the frame of the specified body, site etc.

    Note that the position-dependent stages of the computation must have been executed for the current state in order for these functions to return correct results. So to be safe, do mj_forward and then mj_jac. If you do mj_step and then call mj_jac, the Jacobians will correspond to the state before the integration of positions and velocities took place.
    Michael J Mathew likes this.