Open access peer-reviewed chapter

# Kinematics of Serial Manipulators

Written By

Ivan Virgala, Michal Kelemen and Erik Prada

Submitted: February 12th, 2020 Reviewed: June 8th, 2020 Published: July 11th, 2020

DOI: 10.5772/intechopen.93138

From the Edited Volume

## Automation and Control

Edited by Constantin Voloşencu, Serdar Küçük, José Guerrero and Oscar Valero

Chapter metrics overview

View Full Metrics

## Abstract

This book chapter deals with kinematic modeling of serial robot manipulators (open-chain multibody systems) with focus on forward as well as inverse kinematic model. At first, the chapter describes basic important definitions in the area of manipulators kinematics. Subsequently, the rigid body motion is presented and basic mathematical apparatus is introduced. Based on rigid body conventions, the forward kinematic model is established including one of the most used approaches in robot kinematics, namely the Denavit-Hartenberg convention. The last section of the chapter analyzes inverse kinematic modeling including analytical, geometrical, and numerical solutions. The chapter offers several examples of serial manipulators with its mathematical solution.

### Keywords

• algorithm
• inverse kinematics
• Jacobian
• manipulator
• optimization
• redundant
• robot

## 1. Introduction and basic definitions

In the following sections, this chapter will deal with direct and inverse kinematics of open-chain multibody systems consisting of rigid bodies. The whole problematics is analyzed from the view of robotics. Each manipulator or mechanism investigated in this chapter will be of serial kinematic structure (open chain).

Open-chain multibody systems are mechanically constructed by connecting a set of bodies, called links, by means of various types of joints. In general, the joints can be passive or active. The joints, which are moved by actuators, are active joints.

In general, from the view of robotics, there are two tasks in kinematics:

• Forward kinematics—the forward kinematics problem represents relationship between individual joints of investigated robot and end-effector.

• Inverse kinematics—the problem of inverse kinematics is as follows: given a desired configuration of end-effector of robot, find the joint angles that achieve that configuration.

Before these terms are explained and demonstrated by some study cases, we have to mention the basic definitions, necessary for the further analyses.

Degrees of freedom (DOF): is the smallest number of coordinates needed to represent the robot configuration. Thus, the number of DOF equals to the dimension of configuration space.

Joint space: Let us define all the joint variables in a vector q = q 1 q 2 q n T Q R N . The set Q we call the so-called joint space and it contains all the possible values, which joint variables may acquire.

Workspace: Workspace is a subset of the Euclidean space E , in which the robot executes its tasks. From the view of robotics, workspace is the set of all the points that mechanism may reach in Euclidean space E by end-effector. The workspace can be categorized as follows [1, 2]:

Maximal workspace—it is defined as locations that can be reached by end-effector at least with one orientation.

Inclusive-orientation workspace—it is defined as locations that can be reached by end-effector with at least one orientation among a range of orientations (maximal workspace is particular case).

Constant-orientation workspace—it is defined as location that can be reached by the end-effector with fixed orientation of joints.

Total-orientation workspace—it is defined as location that can be reached by the end-effector with any orientation.

Dexterity workspace—it is defined as location that can be reached by the end-effector with any orientation and without kinematic singularities.

Task space–space of positions and orientations of the end-effector frame. The workspace is a subset of task space that the end-effector frame can reach [3].

## 2. Rigid body motion

Rigid motion of an object is a motion that preserves distance between points [4]. Rigid body is a set of particles such that the distance between any two particles remains constant in time, regardless of any motions of the body or forces exerted on the body. If we consider p and q as two points on rigid body, while rigid body moves, p and q must satisfy p t q t = p 0 q 0 = constant , see Figure 1.

Let us consider an object, described as a subset O of R 3 . Then a motion of object (rigid body) is represented by mapping f t : O R 3 . This mapping describes how the points of this object move as a function of time, relative to some fixed coordinate system.

Let the inertial reference frame be O = x r y r z r and i r , j r , k r represent unit vectors of the reference frame. The vector p can be expressed with respect to inertial reference frame O = x r y r z r by the following equation

p = p xr i r + p yr j r + p zr k r E1

where p = p x p y p z T R 3 . Coordinates of vector p can be also expressed as its projections in directions of individual unit vectors as scalar product. In order to find the relation, the vector p needs to be expressed in coordinates O 1 = x 1 y 1 z 1

p xr = i r p = i r p x 1 i 1 + i r p y 1 j 1 + i r p z 1 k 1 p yr = j r p = j r p x 1 i 1 + j r p y 1 j 1 + j r p z 1 k 1 p zr = k r p = k r p x 1 i 1 + k r p y 1 j 1 + k r p z 1 k 1 E2

which can be rewritten in matrix form

p xr p yr p zr = i r i 1 i r j 1 i r k 1 j r i 1 j r j 1 j r k 1 k r i 1 k r j 1 k r k 1 p x 1 p y 1 p z 1 E3

that is p b = R r 1 p 1 . The meaning of this term is as follows. Coordinates of the vector p expressed in O 1 = x 1 y 1 z 1 are computed to O = x r y r z r so that they are left multiplied by transformation matrix R r 1 .

As can be seen in Figure 2, coordinate system x 0 , y 0 , z 0 is rotated with respect to coordinate system x r , y r , z r by angle q around the axis z r . By consideration of previous equations; and by consideration of the facts that scalar product of two perpendicular vectors equals zero, scalar product of two parallel unit vectors is one, and scalar product of concurrent unit vectors is cos α ; and by assuming that cos π 2 ± α = sin α , that is

i T i = 1 , j T j = 1 , k T k = 1
i T j = 0 , j T k = 0 , k T i = 0

one can obtain the following rotation matrix

R x = 1 0 0 0 cos α sin α 0 sin α cos α E4

where R x is a rotation matrix for rotation around the x-axis by angle α . Subsequently, rotation matrices can be also be expressed for rotation around y-axis and z-axis

R y = cos β 0 sin β 0 1 0 sin β 0 cos β E5
R z = cos γ sin γ 0 sin γ cos γ 0 0 0 1 E6

Since rotation matrix R is an orthogonal matrix, for this reason

R T R = I 3 E7

where I 3 is a 3 × 3 identity matrix. Considering the case when there is displacement of local coordinate system and at the same time also its rotation, it would be expressed as

x r y r z r = R axis , angle x 1 y 1 z 1 + p x p y p z E8

Eq. (8) represents a system of three equations, which will be extended by fourth equation 1 = 0 + 0 + 0 + 1, which is

x r y r z r 1 = p x R axis , angle p y p z 0 0 0 1 x 1 y 1 z 1 1 E9

## 3. Forward kinematics

The forward kinematic model determines the position and orientation of the end-effector relating to base frame of the mechanism or to global coordinate system (GCS).

### 3.1 Open kinematic chain

We will focus on robots, which contain a set of links connected together by joints. The joints are usually revolute or prismatic or they can be more complex, such as socket joint or ball joint [5]. Within this chapter will be considered only revolute and prismatic joints, which have only a single degree-of-freedom motion. Let us consider a mechanism with N links connected together by N 1 joints. The i -th joint connects link i 1 to link i. The number of the joints starts with 1 and ends with N 1 . The next consideration for the following mathematical model is that the first link is connected to the base fixed to inertial reference frame, while the last link is free and able to move.

The i-th joint is associated with joint variable q i , while q i may contain θ i and d i for revolute and prismatic joints, respectively. The local coordinate frame is attached to each link, so to i-th link is attached to I i frame, I i = O i x i y i z i . When a mechanism performs any motion in its workspace, the coordinates of each point on i-th link are constant with respect to their coordinate frame I i = O i x i y i z i .

Let A i be a homogeneous transformation matrix, which holds position and orientation of frame I i = O i x i y i z i with respect to I i 1 = O i 1 x i 1 y i 1 z i 1 . It should be noticed that values of matrix A i are not constant, but they change with changing configuration of the mechanism. In general, a homogeneous transformation matrix expressing the position and orientation of I j = O j x j y j z j with respect to I i = O i x i y i z i is called a transformation matrix T i j . We can also define the following matrix

H = R 0 n o 0 n 0 1 E10

where R 0 n is a 3 × 3 rotation matrix with and o 0 n is a 3 × 1 vector expressing position and orientation of end-effector (the last point of mechanism) with respect to inertial reference frame (base of mechanism). Eq. (10) can then be written as

H = T 0 n = i = 1 N A i E11

while A i equals

A i = R i 1 i o i 1 i 0 1 E12

### 3.2 Denavit–Hartenberg convention

For the computation of forward kinematics for open-chain robot according to Eq. (11), a general approach was derived in order to determine the relative position and orientation of two consecutive links. This approach determines two frames attached to two links (rigid bodies) and computes the coordinate transformations between them [6].

For utilization of the Denavit-Hartenberg convention, some rules need to be observed. Let us consider Figure 3. Let axis i represent the axis connecting link i 1 and link i + 1 . In order to define link frame i, the procedure is as follows. First of all, the axis z i and axis z i 1 are chosen. Next, origin O i is located at the intersection of axis z i with the common normal to axes z i and z i 1 . By this step be get points O i and O i . The common normal of these two axes is a minimum distance between them. Subsequently, the axis x i is chosen along the common normal to axes z i 1 and z i in the direction from joint i to the joint i + 1 . In the last step, axis y i is chosen so as to complete a right-handed frame.

After these steps, the link frames have been established and now the position and orientation of frame i with respect to frame i 1 can be determined by following DH parameters [7]:

• a i : distance between the points O i and O i

• d i : distance between O i 1 and O i along the axis z i 1

• α i : angle between the axes z i 1 and z i about axis x i (positive direction—counter-clockwise rotation)

• ϑ i : angle between axes x i and x i 1 (positive direction—counter-clockwise rotation)

It should be also noted that parameters a i and α i are always constant, because they depend on the geometric aspect of mechanism. Considering the two other parameters d i and ϑ i , depending on the joint type, one is constant and other one may change as follows:

• Revolute joint: ϑ i is the joint variable and d i is constant

• Prismatic joint: d i is the joint variable and ϑ i is constant

In general, six parameters are necessary in order to describe the position and orientation of a rigid body in the 3D space. Based on previously mentioned facts, we can say about DH convention that only four parameters are required by assuming that the axis x i intersects z i 1 , and that axis x i is perpendicular to z i 1 .

#### 3.2.1 Example of forward kinematics using the Denavit-Hartenberg convention

Let us consider some kind of industrial robot, namely SCARA (Selective Compliance Assembly Robot Arm) robot, which has RRP structure. Its kinematic structure is shown in Figure 4.

Considering the basic principles of the Denavit-Hartenberg convention introduced in the previous section, we are able to introduce D-H parameters, see Table 1.

1 L1 0 d1 q1
2 L2 0 0 q2
3 0 π d2 + q3 0
4 0 0 0 q4

### Table 1.

Denavit-Hartenberg parameters.

Based on DH parameters, which are obvious from Figure 4, particular homogeneous transformation matrices can be established.

A 1 0 = 1 0 0 0 0 1 0 0 0 0 1 d 1 0 0 0 1 cos q 1 sin q 1 0 0 sin q 1 cos q 1 0 0 0 0 1 0 0 0 0 1 1 0 0 L 1 0 1 0 0 0 0 1 0 0 0 0 1 E13
0 A 1 = cos q 1 sin q 1 0 L 1 cos q 1 sin q 1 cos q 1 0 L 1 sin q 1 0 0 1 d 1 0 0 0 1 1 A 2 = cos q 2 sin q 2 0 0 sin q 2 cos q 2 0 0 0 0 1 0 0 0 0 1 1 0 0 L 2 0 1 0 0 0 0 1 0 0 0 0 1 E14
1 A 2 = cos q 2 sin q 2 0 L 2 cos q 2 sin q 2 cos q 2 0 L 2 sin q 2 0 0 1 0 0 0 0 1 2 A 3 = 1 0 0 0 0 cos π sin π 0 0 sin π cos π d 2 + q 3 0 0 0 1 E15
A 4 3 = cos q 4 sin q 4 0 0 sin q 4 cos q 4 0 0 0 0 1 0 0 0 0 1 E16

So, the final transformation matrix is

T 4 0 = 0 A 2 1 A 2 2 A 3 3 A 4 E17
T 4 = 0 p x R p y p z 0 0 0 1 E18

By vector o 4 0 = p x p y p z T is defined position of end-effector of SCARA manipulator with respect to its base inertial reference frame.

## 4. Inverse kinematics

The solution exists only if the given end-effector position and orientation are in dexterous workspace of the solved mechanism. While the forward kinematic model is expressed as

x = f q E19

where f is a function defined between joint space R n and workspace R m , which maps the joint position variables q R n to the position/orientation of the end-effector of mechanism, the inverse kinematic model is based on

q = f 1 x E20

where q R n and x R m . In the case of the forward kinematic model, end-effector position and orientation are computed for various kinds of mechanisms like manipulators, in a unique manner, for example, by above-mentioned transformation matrices. The inverse kinematic problem is more complex and finding the solution could be in many cases very complicated. While forward kinematics has a closed-form solution, an inverse kinematics in most cases does not have a closed-form solution. A forward kinematic model has a unique solution, while an inverse kinematic model may have multiple solutions or infinite number of solutions, especially for kinematically redundant mechanisms. In order to obtain a closed-form solution, there are two main approaches, namely algebraic approach and geometric approach.

### 4.1 Closed-form solution of inverse kinematics

Let us consider a two-link mechanism moving in the 2D plane, see Figure 5.

Considering the forward kinematic model, while the angles of joints ϑ 1 and ϑ 2 are given, the aim is to find the position of end-effector x E = x y T R m . The forward kinematic model can be easily determined by the following equations

x = l 1 cos ϑ 1 + l 2 cos ϑ 1 + ϑ 2 E21
y = l 1 sin ϑ 1 + l 2 sin ϑ 1 + ϑ 2 E22

Now, the inverse kinematic problem is to find angles ϑ 1 and ϑ 2 , while the end-effector position x and y are given by vector x E = x y T R m .

c = x 2 + y 2 E23
α = atan 2 y x E24
ϑ 2 = ± arccos x 2 + y 2 L 1 2 L 2 2 2 L 1 L 2 E25
β = arccos L 1 2 L 2 2 + c 2 2 L 1 c E26
ϑ 1 = α β E27

As can be seen in Figure 5, the presented configuration of the mechanism has two solutions in inverse kinematics. These two solutions are based on signum in Eqs. (25) and (27).

## 5. Differential kinematics

### 5.1 Analytical Jacobian

In order to describe the relation between joint angles and end-effector configuration, often the relation between the joint and end-effector velocities is used. Let us consider a set of coordinates x R m , their velocity is x ̇ = d x / dt R m . Then, we can apply Eq. (19). Then, one obtains

x ̇ = f q q d q dt = J q q ̇ E28
J q = x 1 q 1 x 1 q n x m q 1 x m q n E29

where J q R m × n is the analytical Jacobian matrix, which is very often used in kinematics and dynamics of robotic systems. Jacobian reflects differences between joint and configurations space of the investigated mechanism. In robotics, Jacobian is often used for several purposes such as for the definition of the relation between joint and configuration space, definition of the relation between forces/torques between spaces, the study of kinematic singularities, the definition of numerical solution for inverse kinematic problem, and the study of manipulability properties. We can look at Jacobian from a different perspective. Particular Jacobian columns represent the influence of i-th joint on the end-effector velocity.

The following example will demonstrate the derivation of analytical Jacobian for a three-link mechanism (Figure 6).

In order to utilize Eq. (29), we need to define position of point E = x E y E T R 2 .

x E = L 1 cos q 1 + L 2 cos q 1 + q 2 + L 3 cos q 1 + q 2 + q 3 E30
y E = L 1 sin q 1 + L 2 sin q 1 + q 2 + L 3 sin q 1 + q 2 + q 3 E31

Assuming Eqs. (30) and (31), Jacobian according to Eq. (29) will be matrix J q R 2 × 3

J q = x E q 1 x E q 2 x E q 3 y E q 1 y E q 2 y E q 3 E32

where the elements of the Jacobian matrix are

x E q 1 = L 1 sin q 1 L 2 sin q 1 + q 2 L 3 sin q 1 + q 2 + q 3 x E q 2 = L 2 sin q 1 + q 2 L 3 sin q 1 + q 2 + q 3 x E q 3 = L 3 sin q 1 + q 2 + q 3 y E q 1 = L 1 cos q 1 + L 2 cos q 1 + q 2 + L 3 cos q 1 + q 2 + q 3 y E q 2 = L 2 cos q 1 + q 2 + L 3 cos q 1 + q 2 + q 3 y E q 3 = L 3 cos q 1 + q 2 + q 3

### 5.2 Geometric Jacobian

Besides analytically expressing the Jacobian, we can express it by a geometric approach. To establish function f q in closed-form, a symbolic formalism is necessary, which could be difficult from the view of implementation. For this reason, a different way of Jacobian expression, the so-called geometric Jacobian, was developed. The geometric Jacobian can be obtained by consideration of rotational velocity vector ω . Let us consider link according to Figure 6. The Jacobian can be expressed as

J = J v J ω = J v 1 J vn J ω 1 J ωn E33

The first term expresses the effect of q ̇ 1 on linear velocity v and the second term expresses the effect on the rotational velocity ω . Thus,

v = J v 1 q ̇ 1 + + J vn q ̇ n ω = J ω 1 q ̇ 1 + + J ωn q ̇ n E34

That is, the analytical Jacobian differs from the geometrical Jacobian for the rotational part. Considering the revolute joint, the i-th column of Jacobian can be computed as

J vi J ωi = z 0 i 1 × p 0 n p 0 i 1 z 0 i 1 E35

For prismatic joint, the i-th column of Jacobian can be computed as

J vi J ωi = z 0 i 1 0 E36

where p 0 n is the end-effector position defined in transformation matrix T 0 n defined in the previous section. Next, p 0 i 1 is the position of frame I i 1 = O i 1 x i 1 y i 1 z i 1 , defined in transformation matrix T 0 i 1 . Finally, z 0 i 1 is the third column of rotation matrix R 0 i 1 , while R 0 i 1 = R 0 1 q 1 R 1 2 q 2 R i 2 i 1 q i 1 .

The following example will demonstrate the derivation of geometric Jacobian for a two-link mechanism (Figure 7).

J q = z 0 × p 2 p 0 z 1 × p 2 p 1 z 0 z 1 E37

where p 0 = 0 0 0 , p 1 = L 1 cos q 1 L 1 sin q 1 0 , p 2 = L 1 cos q 1 + L 2 cos q 1 + q 2 L 1 sin q 1 + L 2 sin q 1 + q 2 0 and rotational axes are z 0 = z 1 = 0 0 1 . By solving Eq. (37), we get

J q = L 1 sin q 1 L 2 sin q 1 + q 2 L 2 sin q 1 + q 2 L 1 cos q 1 + L 2 cos q 1 + q 2 L 2 cos q 1 + q 2 0 0 0 0 0 0 1 1 E38

Now, the Jacobian is a 6 × 2 matrix and its maximum rank is 2. That is, at most two components of angular/linear end-effector velocity can be independently assigned. In this case, when orientation is not required, only first two rows are considered.

### 5.3 Kinematically redundant manipulators

The next approach to inverse kinematic solution we want to focus on is numerical solutions. Nevertheless, many times, it is hard to find a closed-form solution for inverse kinematics; the basic kinematics of industrial robots have developed an approach to solve it. The problems arise with nonconventional kinematic structures, especially with kinematically redundant manipulators. A kinematically redundant manipulator has more number of DOFs than is absolutely necessary to perform the desired task. For example, conventional industrial robot has usually six DOFs, by which it is able to reach any point in its workspace. By adding an additional DOF, this robot becomes kinematically redundant due to this additional DOF.

A numerical solution is usually used when a closed-form solution for q does not exist or is difficult to find. In this section, we will focus on kinematically redundant mechanisms. Considering the dimension of joint space n and dimension of task space m , for kinematically redundant mechanisms n > m . The level of redundancy can be expressed by r = n m . Kinematic redundancy is used for many tasks such as kinematic singularities avoidance, obstacle avoidance, joint limits avoidance, increasing the manipulability in specified directions, minimizing the energy consumption, minimum of motion torques, optimizing execution time, etc. As can be seen, kinematic redundancy allows many optimization tasks to be solved. On the other hand, kinematic redundancy brings some disadvantages as well; for example, a greater structural complexity of construction caused by many of DOFs (mechanical, actuators, sensors), which have an influence on final cost of this kind of mechanism. Next field of potential disadvantages is the field of control, due to complicated algorithms for inverse kinematic computation or motion control. From this reason redundant manipulators could be difficult in real-time control.

There are many approaches within numerical solution of inverse kinematics, which are still in focus of research. Most approaches deal with Jacobian matrix in order to find a linear approximation to the inverse kinematic problem. Among the most used of them are damped least squares (DLSs), Jacobian transpose, and damped least squares with singular value decomposition (SVD) [8, 9].

Another kind of approach is the approach based on Newton methods [6]. The aim of these algorithms is to find the final configuration of joints with focus on minimization problem. For this reason, the final motion of robot is smooth. This family of methods includes methods such as Powell’s method [10] or Broyden, Fletcher, Goldfarb and Shanno (BFGS).

A very well-known and used method for inverse kinematics of kinematically redundant mechanisms is the so-called cyclic coordinate descent (CCD) algorithm [11]. The CCD method is a very simple and at the same time a very strong method. It is a heuristic iterative method with low computational cost per iteration. Next very know heuristic iterative method is FABRIK (Forward And Backward Reaching Inverse Kinematics) [12, 13]. The FABRIK method minimizes the system error by adjusting each joint angle one at a time.

Most of inverse kinematics numerical methods could be divided into two classes: linearization algorithms and minimization algorithms. Concerning the linearization algorithms, the idea is piecewise linearization of nonlinear inverse kinematic problem, which is based on the Jacobian matrix. An example of this kind of method is the Jacobian transpose method. In minimization algorithms, the idea is to formulate some cost function, which will be minimized, for example cyclic coordinate descent algorithm. Besides the mentioned methods, there are many other such as pseudoinverse methods, such as the Levenberg–Marquardt damped least squares methods, quasi-Newton and conjugate gradient methods, neural network and artificial intelligence methods.

The basic technique is based on Eq. (39)

x ̇ = J q q ̇ E39

The above relation can be inverted to so-called Jacobian control method

q ̇ = J q x ̇ E40

which leads to joint velocity vector q with minimum norm. The term J represents the Moore-Penrose pseudoinverse given by J = J T J J T 1 for kinematically redundant mechanisms where m < n J J = I or by J = J T J 1 J T for m > n J J = I .

A very common method on which the solution is based is the Newton-Rhaphson method. The Newton-Rhaphson method is a root-finding algorithm that produces approximations of the roots of a real-valued function. The method starts with differentiable function f defined for a real variable x , derivative of function f , and initial guess x 0 for a root of function f . If these assumptions are satisfied and initial guess is close, then

x 1 = x 0 f x 0 f x 0 E41

Talking about numerical motion optimization of kinematically redundant mechanisms, there are two approaches. The first approach deals with local methods, which are solved typically online, and the second one with global methods, which require quantity of computation. For this reason, the global methods are computed usually offline.

One of the commonly used local methods is the family of null-space methods. This method uses the extension of Eq. (40) and gives

q ̇ = J q x ̇ + I J J q ̇ 0 E42

where q ̇ 0 R n is an arbitrary joint space velocity vector, chosen according to desired behavior; so it is chosen for optimization purposes. Next, I R n × n is the identity matrix. The term I J J represents the orthogonal projection matrix in the null space of J , J q x ̇ is orthogonal to I J J q ̇ 0 . For this reason, q = 0 . Physically, this term corresponds to self-motion, where the combined joints motion generates no motion in the task space (no motion of end-effector). So, the term I J J is symmetric and idempotent ( I J J 2 = I J J ). Also, it ensures I J J = I J J . The inverse kinematic solution expressed by Eq. (42) is equivalent to solving a quadratic programming (QP) problem based on H q ̇ = min q ̇ 1 2 q ̇ q ̇ 0 T W q ̇ q ̇ 0 subjected to x ̇ = J q q ̇ .

Now the question is, how the vector q ̇ 0 can be chosen. One of the basic ways to choose it is the so-called projected gradient method q ̇ 0 = q H q . Supposing that x ̇ = 0 , that is, the mechanism performs only self-motion, it can be written q ̇ = I J J q H ; so, I J J q H = 0 is a necessary condition of constrained optimality. Based on these facts, an objective function can be chosen for some optimization of motion:

• Manipulability—maximize the distance from kinematic singularities

H q = det J q J T q E43

• Joint limit avoidance—minimize the distance from the middle of joints range

H q = 1 2 i = 1 n q i q i q M , i q m , i 2 E44

where q i q m , i q M , i and q i = q M , i q m , i 2 .

• Obstacle avoidance—maximize the minimum distance to obstacle

H q = min a robot b obstacle a q b 2 E45

where a q represents points on investigated mechanism and b represents points on the obstacle.

Example: Let us consider a planar six-link robot connected by six revolute joints. All links have the same length L = 100 mm . The purpose of the simulation is path tracking (circle form) described by matrix X path = x d y d R m × p , where p is the number of geometric points of the desired path, while x d = 2.5 L + L cos φ , y d = L sin φ , φ 0 2 π assuming the step of φ increase to be 0.2. That is, x d = x 1 x p R p and y d = y 1 y p R p . From the matrix X path will be in each path point determined the desired point e p = x p y p T R m . Since, there is consideration of planar task with focus on end-effector position, the task space is m = 2 . The expected solution assumes only primary solution without any secondary tasks. For inverse kinematic solution, damped least squares method, which avoids many of pseudoinverse method’s problems, will be used. This method is also known as the Levenberg–Marquardt method, which arises from cost function J q x 2 + λ 2 q 2 where λ R is a non-zero scalar constant. By minimizing this term, one obtains

q = J T J J T + λ 2 I 1 x E46

where I R m × m is the identity matrix. The simulation will work according to the following algorithm.

Algorithm: Inverse kinematic model for 6-link manipulator.

1: Set desired path for end-effector by matrix X path and parameters such as L , λ .

2: FOR step = 1 p .

3:    Set the desired position of end-effector from X path e p = x p y p T R m

4:    WHILE x actual e p

5:        Compute Jacobian

6:        Compute x actual = x act y act T R m

7:        Compute q = q + J T J J T + λ 2 I 1 x

8:        q = q

9:    END WHILE

10: END FOR

The results of the simulation can be seen in Figures 8 and 9. Figure 8 presents the motion of planar robot. The aim is to tracking of path with circle shape (green color) by end-effector of the robot. The robot has a fixed frame in point [0,0]. The initial position of all joints is q = 0 0 0 0 0 0 T .

During the simulation, no restriction such as joint limit was considered. The simulation was done with a tolerance ± 5 mm. Figure 9 presents the variation of individual robot joints during the path tracking.

Example: Let us consider a planar 20-link robot connected with revolute joints. The links have the same length L = 16.75 mm . The aim is to move the end-effector from its initial position to the end position by tracking the desired path. We will consider two cases. The first one considers free robot environment, the second one considers obstacles in the robot environment. The second solution will also consider kinematic singularities avoidance task and joint limit avoidance task.

Now, let us consider the cost function dealing with all mentioned secondary tasks [10].

H = J q ̇ x ̇ 2 + J c q ̇ x c 2 + J L q ̇ x L 2 + ρ q ̇ 2 E47

After mathematical adjustment, we get the final formula for kinematic control

q ̇ = J T WJ + J c T W c J c + J L T W L J L + W s 1 J T W x ̇ E48

where W , W c , W L , and W s are in our case 20 × 20 weight matrices of primary task, obstacle avoidance task, joint limit avoidance task, and kinematic singularities avoidance task, respectively. The setting of weight matrices is subjective. For example, if obstacle avoidance task should have higher priority above primary task by 100 times, the matrix W c would consist of values 100 while W consist of values 1.

Let us consider individual secondary tasks. The joint limit avoidance task deals with the range of motion of individual manipulator links. How many joints will have their limit range is up to us. Of course, in real robots, usually all joints are limited in their motion. There are several ways on how to model the range of joint motion. In this case, an approach with changing of value of weight variable W li based on joint position will be used. If the joint is in admissible range, the value of the weight variable is set to be zero. When the joint reaches the boundary of its range motion, the value of the weight variable increases. When the joint reaches a value outside its admissible range, the value of the weight variable increases to its maximum. This approach can be expressed by Eq. (49)

W li = W w q i < q imin W w 2 1 + cos π q i q imin ρ i q imin q i q imin + ρ i 0 q imin + ρ i < q i < q imax ρ i W w 2 1 + cos π q imax q i ρ i q imax ρ i q i q imax W w q i > q imax E49

The value of the weight variable has to be set for every joint of the manipulator that needs to be limited in the range of motion. Individual weight variables W li where i 0 N are parts of the final weight matrix of the joint limit avoidance task W l R n × n . The final weight matrix W l is the diagonal matrix [14]:

W l = W l 1 W l 2 W l 3 W ln E50

The weight matrix W l is used with the corresponding Jacobian matrix J L R n × n . The Jacobian matrix for the joint limit avoidance task is J L = e / q . If a particular joint does not consider the joint limit avoidance task, the value of J L is set to be zero; otherwise it is set to be one. The limit of all joints in motion of the manipulator investigated in this study is set to be ±100°. Different way of joint limit control is according to above mentioned Eq. (44).

During the obstacle avoidance task, the control system investigates the relation between manipulator links and obstacles in their environment. In general, this task can be solved from two views. At first, one group of obstacles can represent static obstacles or other robots in an investigated environment. The second group of obstacles can be represented by dynamic obstacles, which means that these obstacles change their position relating to global reference system in the time. Of course, the second group of obstacles is more difficult from the view of control in comparison with static obstacles. It is more difficult especially in the cases of requirements for real-time control [15].

The aim of obstacle avoidance is to prevent the collision between any part of the manipulator and potential obstacles, other robots, or collision with itself. Again, there are many methods on how to control robot motion at a safe distance from other objects, regardless of whether the obstacles have regular or irregular shape. For simplification, the irregular shapes are usually replaced by appropriate regular shape. This simplification can also significantly simplify the mathematical model and obtaining the numerical solution can be faster and the solution more stable. One of the methods on how to simplify irregular shapes is to replace all irregular shapes by a cylinder, with the obstacle being situated in the center of the cylinder, see Figure 10. The diameter of the cylinder determines the distance of influence of this obstacle.

At first, we set the coordinate of an obstacle in the task space as s o . The projection of the line from the i-th joint of the manipulator link to the center of a cylinder (obstacle) on the i-th link is:

p i = e i T s 0 s i E51

The coordinate of the link point with potential to get into collision is:

s ci = s i + p i e i E52

The distance between the potential point of collision and the center of the cylinder is:

d ci = s ci s 0 E53

Subsequently, the unit vector of the potential point of collision can be given by:

u i = s ai s 0 d ci E54

Now, the Jacobian matrix for the obstacle avoidance task can be given. The i-th row of the Jacobian matrix can be expressed as

J ci = u i T J s ci E55

where matrix J s ci is:

J s ci = s ci q E56

The Jacobian matrix J c consists of submatrices J ci . The dimension of the Jacobian matrix is J c R c × c , where c represents the number of manipulator links that could collide with the obstacles.

For numerical simulation, we will use following algorithm: Inverse kinematic model for 20-link manipulator [14].

Algorithm: Inverse kinematic model for 20-link manipulator

1: CYCLE WHILE 1

2:   Determination of new required vector x d R m from the matrix of planned path P R r × 2

3:   CYCLE WHILE 2

4:      Computation of Jacobian matrix J (damped least squares method)

5:   Determination of actual end-effector position in the task space x R m with actual generalized variables q R n

6:      Computation of general equation

q ̇ = J 1 WJ + J c 1 W c J c + J l 1 W l J l + W s 1 J T W x ̇

7:      q = q previous + q ̇ dt

8:      q previous = q

9:      IF x d = x THEN

END CYCLE WHILE 2

ELSE

CYCLE WHILE 2 continues

END IF

10:  END CYCLE WHILE 2

11: END CYCLE WHILE 1

In Figure 11 can be seen the simulation of motion of a 20-link manipulator, which moves in free environment without any obstacles. This case also does not consider any joint limit avoidance task. The aim is to move the end-effector of manipulator by predefined path (green color).

Figure 12 depicts a different situation. A 20-link manipulator moves according to predefined path between four obstacles. The solver also assumes joint limit avoidance task for all 20 joints. From this figure can be seen the difference in “self-motion” in joint space, while it does not affect the motion of end-effector in task space. The end-effector always tracks the same path (by neglecting end-effector orientation).

The second case is significantly difficult from the view of computational complexity in comparison with the case without any constraints in motion.

## 6. Conclusion

This chapter was focused on forward and inverse kinematics of open-chain mechanisms, namely manipulators with serial kinematic structures. We have introduced rigid motion and subsequently we have focused on forward kinematics. The chapter presents a kinematic model of SCARA by the well-known Denavit-Hartenberg convention. Within inverse kinematics was introduces several methods, including analytical, geometrical, and numerical. The last section dealt with modeling of kinematically redundant planar robots. At first, we introduced a six-link planar robot with focus on numerical solution using DLS. The last example presented a 20-link redundant manipulator moving between the obstacles. The solution includes, besides the primary solution, secondary tasks such as singularity avoidance, joint limit avoidance, and obstacle avoidance.

## Acknowledgments

The authors would like to thank to Slovak Grant Agency VEGA 1/0389/18 “Research on kinematically redundant mechanisms” and to KEGA 018TUKE-4/2018 “Implementation of new technologies and education methods in area of controlling systems for improvement of educational level and practical experiences of graduate students of Mechatronics study program” and also to KEGA 030TUKE-4/2020 “Transfer of knowledge from the field of industrial automation and robotics to the education process in the teaching program mechatronics.”

## References

1. 1. Li XJ, Cao Y, Yang DY. A numerical-analytical method for the computation of robot workspace. In: The Proceedings of the Multiconference on “Computational Engineering in Systems Applications”. Beijing; 2006. pp. 1082-1086. DOI: 10.1109/CESA.2006.4281805
2. 2. Dash AK, Chen IM, Yeo SH, Yang G. Workspace generation and planning singularity-free path for parallel manipulators. Mechanism and Machine Theory. 2005;40(7):776-805. DOI: 10.1016/j.mechmachtheory.2005.01.001
3. 3. Lynch KM, Park FC. Modern Robotics – Mechanics, Planning, and Control. Cambridge University Press; 2017. ISBN: 9781107156302
4. 4. Murray RM, Li Z, Sastry SS. A Mathematical Introduction to Robotic Manipulation. United States, Boca Raton, Florida: CRC Press; 1994. ISBN-13: 978-0849379819
5. 5. Trebuňa F, Virgala I, Pástor M, Lipták T, Miková Ľ. An inspection of pipe by snake robot. International Journal of Advanced Robotic Systems. 2016;13(5). DOI: 10.1177/1729881416663668
6. 6. Kucuk S, Bingul Z. Inverse kinematics solutions for industrial robot manipulators with offset wrists. Applied Mathematical Modelling. 2014;38(7–8):1983-1999. DOI: 10.1016/j.apm.2013.10.014
7. 7. Siciliano B, Sciavicco B, Villani L, Oriolo G. Robotics: Modeling, Planning and Control. Springer; 2009. ISBN: 978-1-84628-641-4. DOI: 10.1007/978-1-84628-642-1
8. 8. Wampler CW. Manipulator inverse kinematic solutions based on vector formulations and damped least-squares methods. IEEE Transactions on Systems, Man, and Cybernetics: Systems. 1986;16(1):93-101
9. 9. Baillieul J. Kinematic programming alternatives for redundant manipulators. In: Proceedings of the IEEE International Conference on Robotics and Automation. St. Louis, MO, USA; 1985. pp. 722-728
10. 10. Powell MJD. A Hybrid Method for Nonlinear Equations. Gordon & Breach Science Publishers, Inc.; 1970
11. 11. Wang L-CT, Chen CC. A combined optimization method for solving the inverse kinematics problems of mechanical manipulators. IEEE Transactions on Robotics and Automation. 1991;7(4):489-499
12. 12. Aristidou A, Lasenby J. FABRIK: A Fast, Iterative Solver for the Inverse Kinematics Problem. Amsterdam, Netherlands: Elsevier; 2010. Submitted to Graphical Models
13. 13. Kelemen M, Virgala I, Lipták T, Miková Ľ, Filakovský F, Bulej V. A novel approach for a inverse kinematics solution of a redundant manipulator. Applied Sciences. 2018;8:2229
14. 14. Virgala I, Lipták T, Miková Ľ. Snake robot locomotion patterns for straight and curved pipe. Journal of Mechanical Engineering. 2018;68(2). DOI: 10.2478/scjme-2018-0020
15. 15. Fahini F. Autonomous Robots – Modelimg, Path Planning, and Control. Springer; 2009. ISBN: 978-0-387-09537-0. DOI: 10.1007/978-0-387-09538-7

Written By

Ivan Virgala, Michal Kelemen and Erik Prada

Submitted: February 12th, 2020 Reviewed: June 8th, 2020 Published: July 11th, 2020