Forward Kinematics

 

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) Ri(qi).

 

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 [R1, R1.1, R2].

o   Using a pose vector makes sense if the hierarchical model’s connectivity is not changed.

 

Forward Kinematics Algorithm

o   We use a preorder (depth-first) 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 Ni is the node transformation to move the object to its center of rotation, and Ri and Ti, are transformations relative to the node’s parent and Childreni are indices of the children of node i.

o   The function is:

 

            ForwardKinematics(matrix M, node i)

                        M0 =M * Ti * Ri

                        M1 = M0 * Ni

                                Object1 = TransformObject(M1, Object[i])

                        DisplayObject(Object1)

 

                        for each child node c in Childreni:

                                                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

Childreni

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 * Ti * Ri

                                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 * Ti * Ri = I * T0 * R0 = T0 * R0 = T0

Display(Mesh for object 0 transformed by T0)

For node 1, the first child of node 0

 

            Algorithm called with

                        M = T0,

                        i = 1

            M0 =M * T1 * R1  = T0 * T1 * R1

            Display(Mesh for object 1 transformed by T0 * T1 * R1)

            For node 3, the first child of node 1

 

                        Algorithm called with

                                    M = T0 * T1 * R1,

                                    i = 3

                        M0 =M * T3 * R3  = T0 * T1 * R1 * T3 * R3

                        Display(Mesh for object 3 transformed by T0 * T1 * R1 * T3 * R3)

                        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 = T0,

                        i = 2

            M0 =M * T2 * R2  = T0 * T2 * R2

            Display(Mesh for object 2 transformed by T0 * T2 * R2)

            There are no children of node 2

 

There are no more children of node 0

 

 

Local Coordinate Frames

 

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 vice-versa.  However, a more concise way of relating adjacent objects to each other exists in Denavit-Hartenberg Notation.

 

Denavit-Hartenberg (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 z-axis corresponds to the joint’s axis of rotation, and the x-axis runs down the “limb” associated with the joint.  The y-axis points in a direction that is perpendicular to the x and z axes and is consistent with the right-hand rule (assuming we are using a right-hand 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 Mii+1, which may be used to transform a coordinate in frame i+1 to frame i.  Simply use the equation , where Vi is a coordinate in the i frame and Vi+1 is the associated coordinate in the i+1 frame.  Also, the inverse of Mii+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 Mii+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 x-axis of a joint runs in the same direction as the link.  Also, the z-axis 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:

 

q3 = -60°

a2 = 2

q2 = 36°

a1 = 2.5

 

Since the links are planar, di and ai 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