Logo
November, 03, 2022

Forward Kinematics in Robotics Using Screw Theory

Can you recall a time when you were frustrated when attempting to compute the forward kinematics for robotic systems? Did you find it frustrating to assign coordinaNte frames to each link when robots become more sophisticated? 

the woman is frustrated because she cannot assign coordinate frames to solve forward kinematics
The frustration caused by assigning coordinate frames for each link while solving the forward kinematics of robotic systems using methods like Denavit-Hartenberg is REAL.

If your answer to these questions is yes, and you’re tired of cumbersome methods like Denavit-Hartenberg to calculate the forward kinematics of robotic chains, this lesson is for you. 

forward kinematics - denavit hartenberg
The Denavit-Hartenberg is one of the methods to derive the forward kinematics in Robotics, but it grows complicated as robotic systems become more complex. The photo is from Wikipedia.

Rather than going into mathematical details first, let’s get right to the point with an educational example.

Example: Forward Kinematics of a 3 DOF Planar Open Chain Robot Arm

Consider a three dof planar open-chain robot arm modeled using STEM building blocks. Here is what it will look like once the coordinate frames, joints, and link lengths are identified:

forward kinematics of 3 dof robot
three dof planar robot arm with coordinate frames, joints, and links identified

L1, L2, and L3 are link lengths. {0} is the fixed frame with the origin located at the base joint. {4} is the end-effector frame attached to the tip of the third link. We do not need all the frames to derive the forward kinematics using the product of exponentials formula, but we depicted them for educational purposes. Since the motion is on the plane, the ẑ-axes are parallel and out of the page. But again, to reiterate, we don’t need all the coordinate frames.

In order to find the forward kinematics of a 3-dof planar open-chain robot, we will follow the following simple steps:

Step 1: Write the vector of joint angles.

Since all the joints, in this case, are revolute, the vector of joint angles can be written as:

$$\begin{pmatrix}\theta_1\\ \theta_2\\ \theta_3\end{pmatrix}$$

Step 2: Draw the robot in its home or zero position when all joint angles are set to zero and assign the base frame and the end-effector frame.

The 3-dof planar open-chain robot in its zero position can be depicted as the figure below:

3 dof robot arm home or zero position
3 dof robot arm in zero or home position

Step 3: Calculate the matrix M, which is the position and orientation of frame {4} relative to frame {0} in the robot’s zero position.

For our 3-dof planar open-chain robot, the matrix representing the position and orientation of the frame {4} relative to the frame {0} can be written using the knowledge that we gained in the transformation matrices lesson.

\[M = \begin{pmatrix}1 & 0 & 0 & L_1 + L_2 + L_3 \\0 & 1 & 0 & 0 \\0 & 0 & 1 & 0\\0 & 0 & 0 & 1\end{pmatrix}\]

The rotational part is the identity matrix since the orientation of frame {4} is the same as the frame {0}, and the position of the origin of frame {4} is L1 + L2 + L3 units in the direction of the x-axis of the {0} frame.

Step 4. Calculate the coordinates of 3D arbitrary points on the joint axes at zero configuration with respect to the coordinates of the fixed base frame.

For our 3-dof planar open-chain robot, we go back to the figure of the robot in the zero position. We can take the three arbitrary points on the joint axes as the following points:

forward kinematics-3 dof planar robot-arbitrary points
Three arbitrary points on the joint axes of the 3-dof planar robot

Then we can write the coordinates of these points with respect to the base frame as:

$$a_1 = \begin{pmatrix}0\\0\\0\end{pmatrix}, a_2 = \begin{pmatrix}L_1\\0\\0\end{pmatrix}, a_3 = \begin{pmatrix}L_1+L_2\\0\\0\end{pmatrix}$$

The first point is on the origin of the base frame, and that’s why its coordinates are all zero. The second point is located at L1 units from the x-axis of the base frame, and similarly, the third point is at L1 + L2 units from the x-axis of the base frame.

Step 5. Calculate the screw axis of each joint expressed in the base frame in the robot’s zero position.

For our 3-dof planar robot, we can say that each revolute joint axis is a zero-pitch screw axis (we know this from the previous lessons) by holding the first two joint angles at zero position:

3 dof robot arm screw motion 3rd joint

The third link goes through a screw motion, and the screw axis corresponding to rotating about the third joint expressed in frame {0} consists of two angular and linear parts as we saw in the lesson about screw motion in robotics:

\[\mathcal{S}_3 = \begin{pmatrix}\mathcal{S}_{\omega_3}\\ \mathcal{S}_{v_3} \end{pmatrix}\]

As we saw before, the angular part is the angular velocity when the angular speed is one, and the linear part is the linear velocity of the origin when the angular speed is one θ̇ = 1:

\[\mathcal{S}_{\omega_3} = \begin{pmatrix}0\\0\\1\end{pmatrix}, \mathcal{S}_{v_3} = -\hat{s} \dot{\theta} \times a_3 =-\hat{\omega}_3\times a_3\]

where a3 is any point on the screw axis expressed in frame {0} that we calculated in the previous step.

Therefore, the linear part of the screw axis can be calculated by the cross-product of the angular part of the screw axis and the selected point on the screw axis:

\[\mathcal{S}_{v_3} = \begin{pmatrix}0\\-(L_1 + L_2)\\0\end{pmatrix}\]

From this, we can see that the linear part of the screw axis is in the opposite direction of the y-axis of the {0} frame. This is also expected from the circular motion of the origin of joint 3 and the fact that the linear velocity is tangent to the circular path.

To learn more about circular motions and why the linear velocity is tangent to the circular path, please refer to the exponential coordinates lesson.

Therefore, the screw axis of joint 3 can be written by stacking up the angular part and the linear part:

\[\mathcal{S}_3 = \begin{pmatrix}0\\0\\1\\0\\-(L_1 + L_2)\\0\end{pmatrix}\]

Now, considering only the screw motion about the third joint, we can write the configuration of the end-effector in the base frame as the following transformation matrix:

\[T_{04}= e^{{[\mathcal{S}_3]}\theta_3} M\quad \text{ for } \theta_1 = \theta_2 = 0, \text{ any }\theta_3\]

The bracket notation shows the se(3) matrix form of the screw axis that we learned all about it and how to calculate it in the screws in robotics lesson.

Now for θ1 = 0 and fixed (but arbitrary) θ3, rotation about joint 2 can be viewed as applying a screw motion to the rigid link 2, and link 3 pair:

3 dof robot arm screw motion 2nd joint

Then, the configuration of the end-effector in the base frame can be updated as the following transformation matrix:

\[T_{04}= e^{{[\mathcal{S}_2]}\theta_2}e^{{[\mathcal{S}_3]}\theta_3} M \quad \text{ for } \theta_1 =0\]

And using the same method as before, the angular and linear components of the second screw axis can be calculated as follows:

\[\mathcal{S}_{\omega_2} = \begin{pmatrix}0\\0\\1\end{pmatrix}, \mathcal{S}_{v_2} = -\hat{\omega}_2\times a_2 =-\begin{pmatrix}0\\0\\1\end{pmatrix} \times \begin{pmatrix}L_1\\0\\0\end{pmatrix} = \begin{pmatrix}0\\-L_1\\0\end{pmatrix}\]

then the second screw axis can be calculated by stacking up the angular component and the linear component:

\[\mathcal{S}_{2} = \begin{pmatrix}0\\0\\1\\0\\-L_1\\0\end{pmatrix}\]

Finally, θ2 and θ3 are fixed, and we consider the rotation about joint 1. This is equivalent to applying a screw motion to the entire rigid three-link assembly.

For arbitrary values of (θ123), the final configuration of the end-effector in the base frame can be updated as the following transformation matrix:

\[T_{04} =e^{[\mathcal{S}_1]\theta_1}e^{[\mathcal{S}_2]\theta_2}e^{[\mathcal{S}_3]\theta_3}M\]

Where the first screw axis can be written as the following equation:

\[\mathcal{S}_1 = \begin{pmatrix}\mathcal{S}_{\omega_1}\\ \mathcal{S}_{v_1}\end{pmatrix} = \begin{pmatrix}0\\0\\1\\0\\0\\0\end{pmatrix}, \mathcal{S}_{v_1} = -\hat{\omega}_1 \times a_1 =o\]

Note that here the arbitrary point is at the center of the base frame and thus the linear part is zero. At the end of this lesson, we will provide you with a code that you can easily find the position and orientation of the end-effector frame in the base frame using the PoE formula.

Using the code provided in this lesson, we can find the position and orientation of the end-effector frame in the base frame as the following equations:

$$\begin{cases}x = L_1 cos(\theta_1) + L_2 cos(\theta_1 + \theta_2) + L_3 cos(\theta_1+ \theta_2 + \theta_3)\\y = L_1 sin(\theta_1) + L_2 sin(\theta_1 + \theta_2) + L_3 sin(\theta_1+ \theta_2 + \theta_3)\\ \phi = \theta_1 + \theta_2 + \theta_3\end{cases}$$

Note that x, y, and φ provide the position and orientation of the end-effector frame with respect to the base frame given the joint values, and we call it the forward kinematics of this robotic arm.

The steps taken to find the forward kinematics of the 3-dof planar robot are applicable to all open-chain manipulators, and we will see the general formula shortly. 

By now, we’ve become familiar with the tools required to express robot motions. Starting with this lesson, we will use the foundation we gained over the past eighteen lessons to better understand real robotics topics. In this lesson, we started with forward kinematics of serial manipulators, and our approach is based on screw theory in robotics. If you are unfamiliar with screw theory in robotics, you might want to read the previous lessons first. 

Now let’s learn about the general form of forward kinematics of serial manipulators using screw theory in robotics.

If you take a look at the literature on robot kinematics, you will figure out that most approaches are based on Denavit-Hartenberg (D-H) parameters presented first by guess what two people named Denavit and Hartenberg in an article in 1955.

Denavit Hartenber article
Article written by Denavit and Hartenberg to find the forward kinematics of serial manipulators. You can download the full paper HERE.

For reasons you’ll learn in this lesson, we prefer Brockett’s 1983 Product of Exponentials (PoE) formula based on screw theory to represent forward kinematics of open-chain robot arms. You can refer to the references section for the article. 

Forward kinematics using PoE formula paper
Brockett’s 1983 Product of Exponentials (PoE) formula to calculate the forward kinematics of open chain robots. You can download the paper HERE.

Forward kinematics calculates the position and orientation of the robot end-effector from the joint coordinates q. Therefore, it is a map that takes the joint values to the position and orientation of the end-effector frame or {b} frame with respect to the fixed reference frame {s}.

forward kinematics definition
Forward Kinematics FK is a map that takes the joint values to the position and orientation of the end-effector frame

If you do not know what the body frame or the fixed frame is, please read this lesson.

Product of Exponentials Formula (PoE)

Now that we have seen how the PoE formula is used to find the forward kinematics of a three-link planar robot arm, let’s look at a more general description.

Let’s consider the figure below, which consists of n one-dof joints connected serially in an n-link spatial open chain:

product of exponentials poe formula - n one dof joints connected serially
n one-dof joints connected serially.

The key concept behind the PoE formula is that every joint applies a screw motion to all outward links.

In order to find the configuration of the end-effector frame relative to the base frame, we first choose a fixed frame {s} and the end-effector frame {b} attached to the last link.

PoE formula forward kinematics - base frame and end effector frame
To find the forward kinematics of an open-chain robot using the PoE formula, we only need to assign the base frame and the end-effector frame.

Then, we should place the robot in its zero position, which means setting all joint values to zero with the direction of positive displacement (rotation for revolute joints, translation for prismatic joints) for each joint. Then find M ∈ SE(3), which is the configuration of the end-effector frame with respect to the fixed base frame when the robot is in its zero position.

PoE formula forward kinematics - zero position
The robot in zero position is used to find M, which is the configuration of the end-effector frame with respect to the fixed base frame in this position.

Now suppose that the joint n is displaced to some joint value qn. The end-effector frame M undergoes a displacement of the form:

\[T = e^{[\mathcal{S}_n]q_n}M,\mathcal{S}_n = \begin{pmatrix}\mathcal{S}_\omega\\ \mathcal{S}_v\end{pmatrix}\]

T is the new configuration of the end effector frame, and Sn is the screw axis of joint n expressed in the fixed base frame. Here we can have two cases:

If joint n is revolute, that corresponds to a screw motion of zero pitch since there is no linear motion, then the angular part of the screw axis Sω ∈ ℝ3 is the unit vector in the positive direction of the joint axis n, and the linear part of the screw axis can be calculated by the cross product of the angular part and an, Sv = -Sω×an where an is any arbitrary point on joint axis n written in coordinates of the fixed base frame. Here, qn = θn is the joint rotation.

If joint n is prismatic, then the angular part of the screw axis is zero Sω = 0, and the linear part Sv ∈ ℝ3 is the unit vector in the direction of the positive translation. Here, qn = dn is the prismatic extension/retraction.

To understand the different types of robot joints, please refer to the lesson on the degrees of freedom of a robot.

Now assume that joint n-1 is allowed to vary. Then this has the effect of applying a screw motion to link n-1 (and by extension to link n because link n is connected to link n-1 via joint n).

Then the end effector frame undergoes a displacement of the form:

\[T = e^{[\mathcal{S}_{n-1}]q_{n-1}}e^{[\mathcal{S}_n]q_{n}}M\]

Continuing this reasoning and now allowing all the joints (q1 … qn) to vary, we can find the configuration of the end-effector frame relative to the base frame as the following matrix:

\[T(q) = e^{[\mathcal{S}_1]q_{1}}…\,e^{[\mathcal{S}_{n-1}]q_{n-1}} e^{[\mathcal{S}_n]q_{n}}M\]

This is called the Product of Exponentials formula that describes the forward kinematics of an n-dof open chain. This representation is the space form of the PoE formula because the screw axes are expressed in the fixed space frame. Consequently, the forward kinematics is a product of matrix exponentials, each corresponding to a screw motion. 

Note that there is also the body form of the PoE formula where the joint axes are screw axes that are expressed in the end-effector or body frame. We will not study this in this lesson since we think that it is basically the same as the space form, and one can easily deduce that by learning the space form.

To summarize, in order to calculate the forward kinematics of an open-chain manipulator using the space form of the PoE formula, we should first find the following elements:

  • the joint variables q1 … qn
  • the end-effector configuration M ∈ SE(3) when the robot is at its home position, meaning that all the joint variables are set to zero
  • the screw axes S1 … Sn expressed in the fixed base frame, corresponding to the joint motions when the robot is at its home position.

Now let’s talk about why we prefer the PoE formula to other approaches like Denavit-Hartenberg.

As you may know, Denavit-Hartenberg (D-H) is another convention for calculating the FK of open-chain robots, which requires a minimum number of parameters. For an n-joint robot, 3n numbers are required to describe the robot’s structure, and n numbers to describe the joint values.

PoE representation, however, isn’t minimal. Besides the n joint values, 6n numbers are required to describe the n screw axes. There are, however, advantages that outweigh the only disadvantage.

As opposed to D-H representation, link reference frames do not need to be defined, which is a huge advantage. All we need is the base frame and M. On the other hand, revolute and prismatic joints are treated the same, and the joint axes can intuitively be interpreted geometrically as screws.

A major disadvantage of D-H parameters is that link frames are assigned differently, and both link frames and D-H parameters should be given together to fully describe the robot’s forward kinematics.

We can conclude that there’s no compelling reason to prefer D-H parameters over PoE representation unless using a small number of parameters is very important.

We will see more advantages of PoE representation when studying velocity kinematics. 

Let’s now see some more examples.

Example: Forward Kinematics of UR5e 6R Robot Arm from Universal Robots

Consider the UR5e 6R robot arm from Universal Robots shown in the figure below:

ur5e robotic arm from universal robots
UR5e robotic arm from Universal Robots

Our goal is to determine the forward kinematics of this open-chain collaborative industrial robot. By following the steps outlined in this lesson, we can easily accomplish this.

All joints in this robot are revolute joints, so the vector of joint angles can be written as:

$$q = \begin{pmatrix}\theta_1\\ \theta_2\\ \theta_3\\ \theta_4\\ \theta_5\\ \theta_6\end{pmatrix}$$

Below is a figure of this robot in its zero position with the base and end-effector frames attached:

ur5e robot in its zero position - forward kinematics using screw theory
UR5e robotic arm in its zero position with all screw axes defined.

The screw axes in the robot’s zero position are chosen based on the positive rotation of the joints based on the right-hand rule (see the video version for the joint movements and their positive rotations). You can learn about the right-hand rule in the lesson below.

Note that W1 is the distance between the anti-parallel axes of joints 1 and 5.

Now it’s time to calculate M, which is the position and orientation of the tool frame relative to the base frame in the robot’s zero position:

$$M = \begin{pmatrix}1 & 0 & 0 & -L_1-L_2\\0 & 0 & -1 & -W_1-W_2\\0 & 1 & 0 & H_1-H_2\\0 & 0 & 0 & 1\end{pmatrix}$$

The next step is to calculate the coordinates of 3D arbitrary points on the joint axes at zero configuration with respect to the coordinates of the fixed base frame:

$$\begin{matrix}a_1 = \begin{pmatrix}0\\0\\0\end{pmatrix}, a_2 = \begin{pmatrix}0\\0\\H_1\end{pmatrix}, a_3 = \begin{pmatrix}-L_1\\0\\H_1\end{pmatrix}\\a_4 = \begin{pmatrix}-L_1-L_2\\0\\H_1\end{pmatrix}, a_5 = \begin{pmatrix}-L_1-L_2\\-W_1\\0\end{pmatrix}, a_6 = \begin{pmatrix}-L_1-L_2\\0\\H_1-H_2\end{pmatrix}\end{matrix}$$

Note that these points can easily be found on the screw axes using simple geometry.

Next, we will calculate the screw axis of each joint expressed in the base frame in the robot’s zero position. First, we calculate the rotation parts of the screw axes:

$$\begin{matrix}\mathcal{S}_{\omega_1} = \begin{pmatrix}0\\0\\1\end{pmatrix}, \mathcal{S}_{\omega_2} = \begin{pmatrix}0\\-1\\0\end{pmatrix}, \mathcal{S}_{\omega_3} = \begin{pmatrix}0\\-1\\0\end{pmatrix}\\ \mathcal{S}_{\omega_4} = \begin{pmatrix}0\\-1\\0\end{pmatrix}, \mathcal{S}_{\omega_5} = \begin{pmatrix}0\\0\\-1\end{pmatrix},\mathcal{S}_{\omega_6} = \begin{pmatrix}0\\-1\\0\end{pmatrix}\end{matrix}$$

Note that, for example, the rotational part of the screw axis of joint 4 is in the opposite direction of the y-axis of the base frame, and it is a unit vector.

Now that we have the rotational parts and the arbitrary points on the screw axes, we can find the linear parts of the screw axes by finding the cross product of the rotational part and the 3D arbitrary point:

$$\begin{matrix}\mathcal{S}_{v_1} = -\mathcal{S}_{\omega_1} \times a_1 = \begin{pmatrix}0\\0\\0\end{pmatrix}, \mathcal{S}_{v_2} = \begin{pmatrix}H_1\\0\\0\end{pmatrix}, \mathcal{S}_{v_3} = \begin{pmatrix}H_1\\0\\L_1\end{pmatrix}\\ \mathcal{S}_{v_4} = \begin{pmatrix}H_1\\0\\L_1+L2\end{pmatrix}, \mathcal{S}_{v_5} = \begin{pmatrix}W_1\\-L_1-L_2\\0\end{pmatrix}, \mathcal{S}_{v_6} = \begin{pmatrix}H_1-H_2\\0\\L_1+L_2\end{pmatrix}\end{matrix}$$

You can easily calculate this cross product using MATLAB. For instance, for the linear part of the joint 3 axis, we can write:

syms L1 L2 H1 H2 W1 W2
a3 = [-L1;0;H1];
Sw3 = [0;-1;0];
Sv3 = cross(a3,Sw3)

Stacking up the rotational part and the linear part will give us the screw axis.

Now we have all the necessary elements to find the forward kinematics of the UR5e robotic arm representing the position and orientation of the end-effector with respect to the base frame as:

$$T(\theta) = e^{\mathscr{S}_1 \theta_1} e^{\mathscr{S}_2 \theta_2} e^{\mathscr{S}_3 \theta_3} e^{\mathscr{S}_4 \theta_4} e^{\mathscr{S}_5 \theta_5} e^{\mathscr{S}_6 \theta_6} M$$

As an example for a visual representation of the forward kinematics of this robot, suppose that θ2 = -π/2 , and θ5 = π/2 with all other joint angles to be zero. Also, suppose that W1 = 109mm, W2 = 82mm, L1 = 425mm, L2 = 392, H1 = 89mm, and H2 = 95mm. Using the MATLAB function at the end of this lesson, we can find the configuration of the end-effector frame in the base frame as:

$$T_{06} = \begin{pmatrix}0 & 1 & 0 & -0.095\\-1 & 0 & 0 & -0.109\\0 & 0 & 1 & 0.988\\0 & 0 & 0 & 1\\ \end{pmatrix}$$

The visualization of this configuration is as follows (see the video version for the demo):

ur5e robotic arm forward kinemactis using screw theory - example configuration
UR5e robotic arm in example configuration (θ2 = -π/2 , and θ5 = π/2 with all other joint angles to be zero)

A question arises here: will we get the same configuration if the base frame is different?

To answer this question, we will use RoboDK to show that we’ll get the same configuration as above by selecting a different base frame (see the video version for the demo). We begin by selecting the following reference frame as the base frame:

ur5e robotic arm forward kinematics with different base frame in zero position
UR5e robotic arm with a different base frame in zero position

Using the same robot joint angles, the matrix representing the configuration of the end-effector frame relative to the base frame can be calculated as follows:

$$T_{06} = \begin{pmatrix}0 & -1 & 0 & 0.095\\1 & 0 & 0 & 0.109\\0 & 0 & 1 & 0.988\\0 & 0 & 0 & 1\\ \end{pmatrix}$$

This matrix gives the same configuration as the previous base frame (you can also confirm this by drawing both frames by hand):

UR5e robotic arm configuration using a different base frame
The choice of the base frame is arbitrary when calculating the forward kinematics.

This example shows that the choice of the base frame is arbitrary when calculating the forward kinematics. Similarly, the end-effector frame can also be chosen arbitrarily as long as it follows the right-hand rule. Typically, frames are chosen with their z-axis aligned in the direction of the joint’s positive movement.

Here, it’s noteworthy that 6-dof robotic arms are commonly referred to as general purple manipulators, and they are important for robotics and industrial applications since they have a minimum number of joints, allowing the end-effector to move a rigid body in all its degrees of freedom subject to only limits on the robot’s workspace (do you remember from the degrees of freedom lesson that a rigid body in space has 6 degrees of freedom?)

Let’s take a look at an example in which a prismatic joint is used.

Example: Forward Kinematics of KUKA KR5 SCARA R550 Z200

Consider the RRPR KUKA SCARA robot depicted in the figure below:

KUKA scara robot forward kinematics using screw theory - home position-2
KUKA KR5 SCARA R550 Z200 robot in zero position
KUKA scara robot forward kinematics using screw theory - home position-side view-2
KUKA KR5 Scara R550 Z200 robot in zero position – side view

As shown in the video version, this robot has three rotational degrees of freedom and one translational degree of freedom, which makes it a useful pick-and-place robot. The set of joint variables are q = (θ12,d34).

From the robot’s technical specs, we can calculate ℓ1 = 325mm, ℓ2 = 225mm, and ℓ0 = 46mm. Now following the steps to calculate the forward kinematics of this robot using screw theory, we can write the matrix M and the screw axes as:

$$M = \begin{pmatrix}1 & 0 & 0 & l_1+l_2\\0 & -1 & 0 & 0\\0 & 0 & -1 & l_0\\0 & 0 & 0 & 1\end{pmatrix}, \mathcal{S}_1 = \begin{pmatrix}0\\0\\1\\0\\0\\0\end{pmatrix}, \mathcal{S}_2 = \begin{pmatrix}0\\0\\1\\0\\-l_1\\0\end{pmatrix}, \mathcal{S}_3 = \begin{pmatrix}0\\0\\0\\0\\0\\1\end{pmatrix}, \mathcal{S}_4 = \begin{pmatrix}0\\0\\-1\\0\\l_1+l_2\\0\end{pmatrix}$$

Note that since one of the joints (3rd joint) is prismatic, the linear part of the screw axis is the unit vector representing the linear velocity when the linear speed is one. The direction of this linear velocity is in the z-axis direction of the base frame.

For educational purposes and using our MATLAB code, the configuration of the end-effector relative to the base frame for the set of joint variables q = (0,π/2,10mm,-π/2) can be found as:

$$T = \begin{pmatrix}-1 & 0 & 0 & 325\\0 & 1 & 0 & 225\\0 & 0 & -1 & 56\\0 & 0 & 0 & 1\end{pmatrix}$$

This configuration can be visualized as the following figure (see the video version for the demo):

KUKA scara robot forward kinematics using screw theory - sample configuration
Configuration of the end-effector of the KUKA KR5 Scara R550 Z200 robot relative to the base frame for the set of joint variables q = (0,π/2,10mm,-π/2).

The following code helps you to calculate the forward kinematics using the PoE formula:

function [R,p]=FK_PoE(theta,a,vel,jt,M)
    % this code caclulate the forward kinematics using the product of
    % exponentials PoE formula
    
    % function inputs:
    % theta: vector of joint angles
    % a: matrix of 3D arbitrary points on the joint axes at zero configuration
        % written in coordinates of the fixed base frame where each row belongs
        % to one point
    % vel: matrix of 3D joint actuation velocities at zero configuration, where each
    % row belongs to one joint and each row is a unit vector. For rotational
    % joints this is rotational velocity and for prismatic joints, this is
    % linear velocity
    % jt: a string of letters showing joint types, e.g. 'RRP'
    % M: Homogenous transformation matrix of end-effector w.r.t. base at zero configuration
    
    % outputs:
    % R is the rotation matrix of the end-effector w.r.t. base
    % p is the position of the end-effector w.r.t. base 
    %-------------------------------------------------------------------------    
    T=POE(theta,a,vel,jt);
    Tf=T*M;
    R=Tf(1:3,1:3);
    p=Tf(1:3,4);
end
% utility function ----------------------------------------------------
function T=POE(theta,a,vel,jt)
    T=eye(4,4);
    % number of joints
    n=length(theta);
    for ii=n:-1:1
        if jt(ii)=='R'
            vel_hat=[0, -vel(ii,3), vel(ii,2);...
                        vel(ii,3), 0, -vel(ii,1);...
                        -vel(ii,2), vel(ii,1), 0];
            e_vel_hat=eye(3,3)+vel_hat*sin(theta(ii))+vel_hat*vel_hat*(1-cos(theta(ii)));
        elseif jt(ii)=='P'
            vel_hat=zeros(3,3);
            e_vel_hat=eye(3,3);
        end
        if (jt(ii)=='R') & (ii>1)
            Sv=-transpose(cross(vel(ii,:),a(ii,:)));
        elseif (jt(ii)=='R') & (ii==1)
            Sv=[0;0;0];
        elseif jt(ii)=='P'
            Sv=vel(ii,:)';
        end
        t=(eye(3,3)*theta(ii)+(1-cos(theta(ii)))*vel_hat+(theta(ii)-sin(theta(ii)))*vel_hat*vel_hat)*Sv;
        e_zai=[e_vel_hat t;0 0 0 1];
        T=e_zai*T;
    end
end

For instance, for the UR5e forward kinematics at the given joint angles above, you can use the code as follows:

t1 = 0;
t2 = -pi/2;
t3 = 0;
t4 = 0;
t5 = pi/2;
t6 = 0;
theta = [t1;t2;t3;t4;t5;t6];
W1 = 109/1000;
W2 = 82/1000;
L1 = 425/1000;
L2 = 392/1000;
H1 = 89/1000;
H2 = 95/1000;
a = [0 0 0;
     0 0 H1;
     -L1 0 H1;
     -L1-L2 0 H1;
     -L1-L2 -W1 0;
     -L1-L2 0 H1-H2];
vel = [0 0 1;
       0 -1 0;
       0 -1 0;
       0 -1 0;
       0 0 -1;
       0 -1 0];
jt = 'RRRRRR';
M = [1 0 0 -L1-L2;
     0 0 -1 -W1-W2;
     0 1 0 H1-H2;
     0 0 0 1];
[R,p]=FK_PoE(theta,a,vel,jt,M)

That’s going to do it for today’s lesson. We hope that by now, you have a good understanding of calculating forward kinematics using screw theory for open-chain manipulators.

References: