# Robot Manipulation Control with Inverse and Forward Kinematics

April 23, 2021 by Anish Devasia## Learn how to control robotic arms more concisely with forward and inverse robotic kinematics techniques.

#### What is the Kinematic Chain?

Donald L. Pieper invented the 321 kinematic chain. It is used in most robotic arms with high Degrees of Freedom (DoF) and is made of intersecting revolute joints.

The Stanford arm was one of the first models of this design. It had six degrees of freedom from two revolute joints, a prismatic joint and a spherical joint. Most robotic arms used in industry are advanced iterations of the Stanford arm.

*The Stanford arm. Image used courtesy of Stanford University*

An engineer can use forward kinematics and inverse kinematics to figure out the positions of end effectors and manipulate the robotic arm.

### Forward Kinematics

In any kinematic chain, from the base of the robotic arm, different links are serially connected with revolute links or prismatic joints. The end effector or tooltip is attached at the end of the last link. Forward kinematics can calculate the position and orientation of the end effector with joint variables.

**Figure 1**: Representative image of kinematic chain showing Denavit Hartenberg parameters and reference frames. Information used courtesy of S. Kucuk and Z. Bingul

**Figure 1**: Representative image of kinematic chain showing Denavit Hartenberg parameters and reference frames. Information used courtesy of S. Kucuk and Z. Bingul

The Denavit-Hartenberg method is the commonly used method for the forward kinematics model. It uses four parameters at each axis to define a system. They are:

- a
_{i-1}representing the link length - α
_{i-1}denotes the link twist - d
_{i}stands for link offset - θ
_{i}for the joint angle

Denavit-Hartenberg’s model is used when there are multiple reference frames in a system. Different reference frames can be placed at each joint. Z_{i} is pointing in the direction of rotation at the joints or the direction in which the joint slides to and from. Denavit-Hartenberg parameters are decided after the axes of coordinate frames are determined at each joint.

Suppose coordinate frames and DH parameters are clearly marked. The link length a_{i-1} is measured as the length between the axes Z_{i} and Z_{i-1} along the X_{i-1} axis. α_{i-1} is the angle between the same two Z axes measured along the X_{i} axis.

d_{i} is the distance between X_{i-1} and X_{i} measured along the Z_{i} axis, and θ_{i} is the angle between X_{i-1} and X_{i}. The general Transformation matrix T^{ii-1} for a link can be written as follows.

T^{ii-1}=R_{x}(a_{i-1}) D_{x}(a_{i-1})R_{z}(θ_{i})Q_{i}(d_{i})

Similarly, the transformation matrix for the reference frames at each joint can be calculated, TT^{0}_{1}, T^{1}_{2},... The transformation matrix of the end effector in relation to the base can be calculated by multiplying the transformation matrix at each joint.

T^{base}_{end-effector }= T^{0}_{1}T^{1}_{2...}T^{n-1}_{n}

This transformation matrix will give p_{x}, p_{y}, and p_{z}, the position coordinates of the end-effector.

### Inverse Kinematics

Calculating the position of the end-effector with forward kinematics is not sufficient for controlling robotic arms. We need to calculate how to reach the desired state of the arm from the current state by reconfiguring the kinematic links. The calculations for it are referred to as inverse kinematics.

Inverse kinematics can be solved using the geometric solution approach or the algebraic solution approach. Let's take a brief look at the two approaches.

### Geometric Solution Approach

In this method, the joint space is divided into multiple two-dimensional planes and trigonometrically finding solutions in each plane.

**Figure 2:** For example, consider a manipulator with two degrees of freedom. Information used courtesy of S. Kucuk and Z. Bingul

**Figure 2:**For example, consider a manipulator with two degrees of freedom. Information used courtesy of S. Kucuk and Z. Bingul

This can be simplified to a simple geometric problem, as shown below.

**Figure 3:** Now, simple geometry can be applied to calculate the parameters. Information used courtesy of S. Kucuk and Z. Bingul

**Figure 3:**Now, simple geometry can be applied to calculate the parameters. Information used courtesy of S. Kucuk and Z. Bingul

However, it gets far too complex and time-consuming to calculate when robotic arms with higher degrees of freedoms are involved.

In some robotic arms, the manipulator only operates in two dimensions. In other robotic arms, it operates in three-dimensional space. Keeping track of the different two-dimensional planes with respect to each other becomes tedious with a higher number of joints.

### Algebraic Solution Approach

In forward kinematics, the transformation matrix for the end effector to the base is found by multiplying all the transformation matrices at joints.

T^{base}_{end-effector }= T^{0}_{1}T^{1}_{2...}T^{n-1}_{n}

For six-axis robots with six degrees of freedom, the equation becomes:

T^{0}_{6 }=T^{0}_{1}T^{1}_{2}T^{2}_{3}T^{3}_{4}T^{4}_{5}T^{5}_{6}

To find the inverse kinematic solution for the first joint, the inverse matrix of the transformation matrix T^{0}_{1} (which is [T^{0}_{1}]^{-1}) to both sides of the equation above.

[T^{0}_{1}]^{-1}T^{0}_{6 }=_{ }[T^{0}_{1}]^{-1}T^{0}_{1}T^{1}_{2}T^{2}_{3}T^{3}_{4}T^{4}_{5}T^{5}_{6}

For a robotic arm with six degrees of freedom, 12 algebraic equations need to be solved to get the joint space parameters of one joint. Similarly, the joint space parameters for all six joints can be found.

It takes a long time to solve it manually. Today with access to advancing computing power, algorithms can solve it in a fraction of a second. This makes it simpler than the geometric solution approach in modern-day applications.

For a kinematic chain, forward kinematics is to calculate the end-effector position in relation to the base. The Denavit-Hartenberg parameters are used for mathematical calculations as it has variables to represent rotational and translational parameters.

The transformation matrix for each joint can be individually calculated and multiplied to obtain the T^{end-effector}_{base.} This final matrix gives the position coordinates of the end effector.

**Figure 4:** Inverse kinematics is used to find the joint space parameters when Cartesian parameters are known. This is essential to manipulate the end effect by inducing different movements to the different joints.

**Figure 4:**Inverse kinematics is used to find the joint space parameters when Cartesian parameters are known. This is essential to manipulate the end effect by inducing different movements to the different joints.

In simple terms, forward kinematics is used to convert variables in joint space (Denavit-Hartenberg parameters) to Cartesian coordinates, and inverse kinematics is used for the reverse operation.

Using these kinematic methods can help engineers understand how to control robot arms more carefully.

0 Comments