A Practical Formulation of the Exponential Map for Rotations

Pseudocode for Jacobian Calculation

The code and functionality pertaining to the exponential map is typically a very small (but important!) part of much larger systems. It is beyond the scope of this paper to provide any kind of meaningful working system for example purposes. But to help give a feel for where computing fits into the overall scheme of things, this page contains pseudocode for computing the Jacobian contribution of a node in a transformation hierarchy, with respect to all of the end effectors below it in the hierarchy. The pseudocode routine Node_Jacobian_Contribution() makes the following assumptions:


void Node_Jacobian_Contribution(inout Jacobian jac, inout TransformStack stack,
                                in double nodeTrans[3], inout double nodeOrient[3],
                                in int startDOF, in EffectorList effectors)
{
    int              i,j;
    EffectorList     currEff;
    double           dRdv[4][4];
    double           column[3];
 
    stack.Push();   
    stack.Translate(nodeTrans);  /* put the constant translation on the stack */     

    for j = 0 to 2 do {
        stack.Push();
        Partial_R_Partial_EM3(nodeOrient, j, dRdv);   /* provided function */
        stack.Concat_Matrix(dRdv);

        /* In the terminology used above, the partial derivative of the position of
         * the end effector with respect to the jth rotational parameter of node
         * i is:
         *    (d F)/(d nodeOrient_j) = 
         *      T_0 R_0 ... T_i (d R_i)/(d nodeOrient_j) ... T_n R_n  ee =
         *      stack.Current * i_local(ee)
         *
         *  which is what we compute below */
        for currEff = each element of effectors do {
            stack.Vector_Transform(currEff.coords, column);
            for i = 0 to 2 do
                jac[currEff.jacIndex+i][startDOF+j] = column[i];
        }
        stack.Pop();
    }
    stack.Pop();
}

Return to A Practical Formulation of the Exponential Map for Rotations