To animate a hierarchical object using forward kinematics, desired joint angles are set directly for each joint using the corresponding node, constant, and variable transformations, as described in the Hierarchical Kinematic Modelling section of the notes. Since the node transformation and constant transformation do not vary, most of the attention will be focussed on the variable transformation (usually rotation) R_{i}(q_{i}).
o A pose is a complete set of values for the parameters for the variable transformations, which are used to position a hierarchical model.
o A pose vector is used to specify a pose. The vector contains one parameter value (usually a rotation angle) for each joint.
o For example, for the robot example, assuming there is no rotation angle for the root node, then the pose vector is [14°, 31°, 70°] corresponding to [R_{1}, R_{1.1}, R_{2}].
o Using a pose vector makes sense if the hierarchical model’s connectivity is not changed.
Forward Kinematics Algorithm
o We use a preorder (depthfirst) traversal of the tree to perform forward kinematics. This is most easily written as a recursive function.
o The initial call for the recursive function ForwardKinematics has the identity matrix as the matrix and the root node as the node.
o We assume we actually want to draw the rigid objects corresponding to the bones; often a skin near the bones is drawn instead.
o Assume N_{i} is the node transformation to move the object to its center of rotation, and R_{i} and T_{i}, are transformations relative to the node’s parent and Children_{i} are indices of the children of node i.
o The function is:
ForwardKinematics(matrix M, node i)
M0 =M * T_{i} * R_{i}
M1 = M0 * N_{i}
_{ }Object1 = TransformObject(M1, Object[i])
DisplayObject(Object1)
for each child node c in Children_{i}:
_{ }ForwardKinematics(M0, c)
_{ }end for
end
Example:
Recall the table of information constructed for the robot example:
Node Index 
Node Id 
Parent Index 
Constant T 
Variable R 
Children_{i} 

X 
Y 
θ 

0 
0 
 
3 
3 
 
1, 2 
1 
1 
0 
1.5 
4 
14 
3 
2 
2 
0 
1.5 
4 
70 
 
3 
3 (old 1.1) 
1 
3 
0 
31 
 
For this example, the old name 1.1 is replaced by 3, which is easier to understand in the context of the algorithm. The identity matrix is denoted by I. We assume that there are no node transformations, and thus the algorithm can be simplified to the following:
ForwardKinematics(matrix M, node i)
M0 =M * T_{i} * R_{i}
_{ }Object1 = TransformObject(M0, Object[i])
DisplayObject(Object1)
for all child nodes a of node i:
_{ }ForwardKinematics(M0, a)
_{ }end for
end
A trace follows.
Algorithm called with
M = I,
i = 0.
M0 =M * T_{i} * R_{i} = I * T_{0} * R_{0} = T_{0} * R_{0} = T_{0}
Display(Mesh for object 0 transformed by T_{0})
For node 1, the first child of node 0
Algorithm called with
M = T_{0},
i = 1
M0 =M * T_{1} * R_{1 } = T_{0} * T_{1} * R_{1}
Display(Mesh for object 1 transformed by T_{0} * T_{1} * R_{1})
For node 3, the first child of node 1
Algorithm called with
M = T_{0} * T_{1} * R_{1},
i = 3
M0 =M * T_{3} * R_{3 } = T_{0} * T_{1} * R_{1} * T_{3} * R_{3}
Display(Mesh for object 3 transformed by T_{0} * T_{1} * R_{1} * T_{3} * R_{3})
There are no children of node 3
There are no more children of node 1
For node 2, the second child of node 0
Algorithm called with
M = T_{0},
i = 2
M0 =M * T_{2} * R_{2 } = T_{0} * T_{2} * R_{2}
Display(Mesh for object 2 transformed by T_{0} * T_{2} * R_{2})
There are no children of node 2
There are no more children of node 0
o A frame is the local coordinate system associated with a given joint.
In certain instances, we need to convert the coordinates of a point defined in one frame to coordinates in the frame of a neighbouring joint. One way of doing this is to use the transformations defined in the object tree and their inverses to convert from a child node’s coordinate space to a parent node’s coordinate space and viceversa. However, a more concise way of relating adjacent objects to each other exists in DenavitHartenberg Notation.
DenavitHartenberg (DH) notation describes the relationship between two coordinate frames using a small number of parameters. In DH notation, a typical hinge joint is assigned a local coordinate space where the zaxis corresponds to the joint’s axis of rotation, and the xaxis runs down the “limb” associated with the joint. The yaxis points in a direction that is perpendicular to the x and z axes and is consistent with the righthand rule (assuming we are using a righthand coordinate space). When the joints defining each coordinate frame exist on the same plane, only two parameters are needed (in addition to the axis definitions):
When the limb connecting joint i and joint i+1 is not linear, two extra parameters are added to the definition for a total of four:
Note that to fully understand the relationship between two joints, it is necessary to look at the parameters for both joints, as pictured in the diagrams above.
Each parameter can be converted into a transformation matrix as follows:
By combining the transformation matrices associated with these symbols we can get a matrix M_{i}^{i+}^{1}, which may be used to transform a coordinate in frame i+1 to frame i. Simply use the equation , where V_{i} is a coordinate in the i frame and V_{i+}_{1} is the associated coordinate in the i+1 frame. Also, the inverse of M_{i}^{i+}^{1} can transform a coordinate from the i frame to the i+1 frame. By combining a number of these matrices we can transform the coordinates of points to any coordinate frame we choose.
Here is how the matrix M_{i}^{i+}^{1} is derived:
Now that we have the matrix, it is a simple matter to use it to transform coordinates from one frame to another. Consider the simple robot arm pictured below. In this case, we have several hinge joints connecting linear links. Let’s say we wish to transform the vertex (3, 0) on object 3 from the coordinate frame of object 3 to the coordinate frame of object 1. For this, we need two matrix multiplications:
First, we must define the variables for each link. Remember that for linear links the xaxis of a joint runs in the same direction as the link. Also, the zaxis corresponds to the axis of joint rotation, which in this case is perpendicular to the screen/paper surface.
Assuming the articulation is identical to that in the complete robot diagram in the above example, we have the following parameters:
q_{3} = 60°
a_{2 }= 2
q_{2} = 36°
a_{1} = 2.5
Since the links are planar, d_{i }and a_{i} are 0 for all cases. Now with our parameters defined, all we have to do is solve the above equation:
Representing Ball and Socket Joints using DH Notation:
Some common joints are not easily represented as hinges. For example, the human shoulder has 3 degrees of freedom (DOF) (i.e. it is capable of rotating about 3 different axes), versus only 1 DOF for a hinge joint. Since DH notation is built to only handle 1 DOF joints, other types of joints are treated as combinations of 1 DOF joints. For example, a ball and socket joint can be represented in DH notation by 3 single DOF joints where the length of the links between them is zero.
Return
to Main Topic
Return to
Table of Contents