You are on page 1of 31

Syrian Arab Republic

Higher Institute of Applied Science and Technology


Dep. of Electrical and Mechanical Systems

Modeling 2-R Serial Robotic Arm

A report for Seminar session

Student Name:
Hasan Ismail

Supervisors
Prof. Adel Alkafri
M.Sc. Jamil Antone Layous
Prof. Nada Mohanna

2023 - 2022
Contents
1 Introduction 4

2 Overview of Robotic Arms 5


2.1 Definition of Robotic Arms . . . . . . . . . . . . . . . . . . . . 5
2.2 Robotic Arms Applications . . . . . . . . . . . . . . . . . . . . 5
2.2.1 In The Industrial Field . . . . . . . . . . . . . . . . . . 5
2.2.2 In The Medical Field . . . . . . . . . . . . . . . . . . . 6
2.2.3 In The Field of Artificial Intelligence Systems . . . . . 6
2.3 Basic Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3.1 Degrees of freedom . . . . . . . . . . . . . . . . . . . . 7
2.3.2 Redundancy . . . . . . . . . . . . . . . . . . . . . . . . 8

3 Robotic Arms Kinematics 9


3.1 Forward Kinematics . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.1 Mathematical Formulation of Forward Kinematics . . . 10
3.2 Inverse Kinematics . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2.1 The General Inverse Kinematics Problem . . . . . . . . 12
3.2.2 Inverse Kinematics Redundancy . . . . . . . . . . . . 13
3.3 Differential Kinematics . . . . . . . . . . . . . . . . . . . . . . 13

4 Serial & Parallel Robotic Arms 14


4.1 Parallel Robotic Arms . . . . . . . . . . . . . . . . . . . . . . 14
4.2 Serial Robotic Arms . . . . . . . . . . . . . . . . . . . . . . . 15

5 2-R Serial Robotic Arm 16


5.1 Overview of 2-R Serial Arm . . . . . . . . . . . . . . . . . . . 16
5.2 Robot Kinematics . . . . . . . . . . . . . . . . . . . . . . . . . 17
5.2.1 Forward Kinematics . . . . . . . . . . . . . . . . . . . 17
5.2.2 Inverse Kinematics . . . . . . . . . . . . . . . . . . . . 18
5.3 Robot Simulation on MATLAB . . . . . . . . . . . . . . . . . 20
5.3.1 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . 20

6 Conclusion 22

A Basic MATLAB Codes used in Simulation 23


A.1 Installing rvctools on MATLAB . . . . . . . . . . . . . . . . . 23
A.2 Robotic Arm Functions . . . . . . . . . . . . . . . . . . . . . . 23
A.2.1 Calculating trajectory From one point to another in
Cartesian Space . . . . . . . . . . . . . . . . . . . . . . 23
A.2.2 Calculating Jacobian Matrix . . . . . . . . . . . . . . . 24

1
A.2.3 Calculating angular velocity . . . . . . . . . . . . . . . 24
A.2.4 Calculating 1th Degree trajectory From one point to
another in Joint Space . . . . . . . . . . . . . . . . . . 25
A.2.5 Calculating 3th Degree trajectory From one point to
another in Joint Space . . . . . . . . . . . . . . . . . . 25
A.2.6 Calculating End-effector coordinates using Forward Kine-
matics . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
A.2.7 Calculating Angles using Inverse Kinematics . . . . . . 26
A.3 Main Simulation Code . . . . . . . . . . . . . . . . . . . . . . 27

2
List of Figures
1 Robotic arm in manufacturing industry . . . . . . . . . . . . . 5
2 Man moves his robotic arms with his MIND . . . . . . . . . . 6
3 Table Tennis Timo Boll vs KUKA robot . . . . . . . . . . . . 7
4 Typical robot joints . . . . . . . . . . . . . . . . . . . . . . . . 8
5 Redundant KUKA Serial Manipulator Movement . . . . . . . 9
6 Configuring joint positions of a robot using forward or inverse
kinematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
7 Parallel Robots The High-Speed Robotics Platform . . . . . . 15
8 serial-robot-Arm . . . . . . . . . . . . . . . . . . . . . . . . . 16
9 2-DOF Serial Flexible Robotic Arm Link-2 . . . . . . . . . . . 16
10 Defining The 2-DOF Serial Robotic Arm in Space . . . . . . . 20
11 Plot The 1th Degree trajectory From one point to an- other
in Joint Space . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
12 trajectory tracking in xy space . . . . . . . . . . . . . . . . . . 21

3
1 Introduction
The term ”Robot” was used for the first time in the eighteenth century to
make toys that resemble humans or animals. These toys were called Robots.
Despite using this term ages ago, the birth of robots as we know them today
did not occur until the forties of the last century, coinciding with the emer-
gence and development of computers. Isaac Asimov, a scientist, and writer,
used it for the first time in the 1941s. After that, the development of robots
began at an accelerated rate.
Today’s robots are machines designed to carry out tasks that are typi-
cally performed by humans. They can be programmed to perform various
tasks, from simple actions like picking up objects to more complex ones like
performing surgery or exploring space. They consist of several components,
including sensors, actuators, and control systems. Sensors enable robots to
perceive their environment, while actuators allow them to perform physical
actions. The control system is the robot’s brain, allowing it to process data
from sensors and respond to them.
Robots can be categorized into several types based on their design and
functionality. Robots fall into various classifications, such as serial and par-
allel industrial robots utilized in manufacturing and assembly lines, social
robots used to engage with humans in social settings, and robotic arms.
Robotic arms are a type of serial manipulator. They consist of a series of
links connected by joints, allowing for relative motion between them. Due to
their precision, flexibility, and ability to perform repetitive tasks with high
accuracy, robotic arms have become ubiquitous in industrial and manufac-
turing settings. An example of a robotic arm is a 2-R serial arm.
2-R serial robotic arms consist of links connected by two revolute joints
that allow relative movement between them. Joints allow them to move in
two degrees of freedom. These arms are commonly used in pick-and-place
operations, assembly, and welding. And as technology advances, we will
likely see even more innovative applications for this kind of robotic arms in
the upcoming years.
In this research, we present a comprehensive analysis of the kinematics
and dynamics of a 2-R serial robotic arm in this report, including its mathe-
matical model, redundancy, and trajectory planning. We aim to understand
the behavior and performance of the 2-R serial robotic arm by making a
simulation for this kind of robotic arm using MATLAB. So, we can see the
factors which are affecting its performance.

4
2 Overview of Robotic Arms
In this section, we will provide an overview of robotic arms, discussing
their components, functionalities, and applications. Additionally, we’ll be
explaining some basic concepts in the design of robotic arms.

2.1 Definition of Robotic Arms


Robotic arms consist of a rotating and displacement joint that enables arm
movements. Electric motors and hydraulic or pulsation systems are used to
drive these joints. A microcontroller CPU guides the actuators. Then, it is
programmable to perform tasks in a specific sequence. To be able to produce
a mass of goods with quick and reliable performance, those arms are being
designed for use mainly by industry as well as in other applications[15].

2.2 Robotic Arms Applications


Robotic arms have found widespread use in manufacturing processes. In
this section, we will delve into the various applications of robotic arms, rang-
ing from assembly and welding to painting and packaging. We will give a
comprehensive understanding of its applications and their impact on modern-
day manufacturing.

2.2.1 In The Industrial Field


There was a need to use robotic arms in factories to help perform many
difficult tasks and repeated tasks, including transportation, welding, and
assembly tasks. After a while, the quality of the products proved that these
robots perform their work with accuracy and high quality[5].

Figure 1: Robotic arm in manufacturing industry

5
2.2.2 In The Medical Field
The importance of robotic systems lies in performing complex surgeries,
whether directly or remotely, such as brain, nerve, and open-heart opera-
tions. These operations are done through a remote-controlled robotic system.
Perhaps the most recent robotics innovation in that field is a robot doctor
who can communicate illness data to his/her attending physician, such as
Massachusetts University’s Ubot-7[3]. Also, among the medical applications
that have taken a great deal of attention are robot applications in the field
of disability. Scientists invented a robotic arm that senses nerve impulses
from the brain to carry out the necessary movement so that a person lives a
semi-normal life[2].

Figure 2: Man moves his robotic arms with his MIND

2.2.3 In The Field of Artificial Intelligence Systems


Artificial intelligence systems are among the modern, advanced technolo-
gies with multiple uses that depend mainly on intelligent recognition of the
external environment and interaction with it accordingly. AI systems were
employed to serve robot technology, which generated robotic systems that
can perform tasks based on available data in real-time, commands to motion
generators to move or rest as a direct response depending on the nature of
the robot and the level of intelligent handling of the event[7].

6
Figure 3: Table Tennis Timo Boll vs KUKA robot

2.3 Basic Concepts


In robotics, it is essential to have a solid understanding of the basic concepts
that underlie the design, control, and operation of robotic systems. Two of
the most critical concepts in robotics are degrees of freedom and redundancy.
In this section, we will discuss these fundamental concepts in detail.

2.3.1 Degrees of freedom


Degrees of freedom in a rigid body indicate the independent parame-
ters needed to describe its position and orientation in space. A rigid body
possesses six degrees of freedom, consisting of three translational and three
rotational degrees of freedom. The translational degrees of freedom allow the
body to move along the X, Y, and Z axes, whereas the rotational degrees of
freedom enable the body to rotate around these axes. The concept of degrees
of freedom is critical in physics and engineering since it provides a mathe-
matical framework for analyzing the motion and behavior of rigid bodies
in various applications, such as mechanical design, aerospace, and robotics.
Understanding the degrees of freedom of a rigid body allows engineers and
scientists to design systems that move and rotate precisely to achieve their
desired goals. Degrees of freedom are also relevant in complex systems study,
such as molecules and polymers, where the number of degrees of freedom can
be much greater than six[13].
To determine the number of degrees of freedom within a system, we have
applied the following general rule:

7
degrees of f reedom = (sum of f reedoms of the points)
− (number of independent constraints) (1)

This rule can be expressed in terms of the number of variables and inde-
pendent equations that describe the system:

degrees of f reedom = (number of variables)


− (number of independent equations) (2)

We use the same concept to define the degrees of freedom of a robot.


Where the robot’s degrees of freedom depend on the number and type of
joints it has as in Figure 4. A robot with a single joint has one degree of
freedom, while a robot with two joints has two degrees of freedom, and so
on[13].

Figure 4: Typical robot joints

2.3.2 Redundancy
Redundancy in robotic arms refers to the arm’s ability to achieve a desired
position or orientation in space, even if certain joints or actuators fail. A
redundant robotic arm has more degrees of freedom than the minimum re-
quired to perform a task. This redundancy can provide additional flexibility
and robustness to the system, allowing it to overcome unexpected obstacles
or changes in the environment. By adding redundant actuators, the robotic

8
arm can be more resistant to failures and errors, which is critical in appli-
cations where reliability and safety are important. Additionally, redundancy
can improve the accuracy and precision of the arm, making it more suitable
for tasks that require fine manipulation or control[9]. Overall, redundancy
is an important feature in robotic arms that enables them to operate in a
wide range of situations and perform complex tasks with greater efficiency
and reliability[4].

Figure 5: Redundant KUKA Serial Manipulator Movement

3 Robotic Arms Kinematics


One of the critical aspects of designing and controlling robotic arms is
their kinematics, which involves determining their position, velocity, and ac-
celeration. Kinematics can be further divided into two main types: forward
kinematics and inverse kinematics. In this section, we will explore the kine-
matics of robotic arms in more detail, focusing on both forward and inverse
kinematics. We will discuss the mathematical models used in these processes.
By understanding the kinematics of robotic arms, engineers and scientists can
design and control robotic systems that are precise, efficient, and reliable.

3.1 Forward Kinematics


Forward kinematics is a fundamental concept in the field of robotics,
specifically when it comes to the motion and positioning of robot arms. It
involves determining the position and orientation of the end effector (the tool
or gripper attached to the robot arm) based on the known lengths and joint
angles of the robot’s links. In forward kinematics, the transformation from
one joint to the next is calculated sequentially, starting from the base of the

9
robot arm. This process allows us to trace the trajectory of the end effector as
it moves through space. By utilizing geometric and trigonometric principles,
forward kinematics enables engineers and programmers to precisely control
the movement and positioning of robot arms, making it a crucial aspect of
robotic system design and operation[16].

3.1.1 Mathematical Formulation of Forward Kinematics


A robot arm with a total of n joints is accompanied by n + 1 links since each
joint serves as a connection point between two adjacent links. Specifically,
joint i links the i − 1th link to the ith link. As the respective joint i is
activated, it induces movement in the corresponding link i. Consequently,
the initial link, referred to as link 0, remains stationary and unaffected by
the activation of the joints. To describe the motion of each joint, a joint
variable, denoted as qi , is assigned. For a revolute joint, qi represents the
angle of rotation, while for a prismatic joint, it signifies the displacement of
the joint[16].

θi if joint i is revolute
qi = (3)
di if joint i is prismatic
To conduct kinematic analysis, we affix a coordinate frame (oi xi yi zi )
firmly to each link i. This implies that regardless of the robot’s movement,
the coordinates of any given point on link i remain unchanged when ex-
pressed in the coordinate frame specific to link i. Moreover, when joint i is
activated, both link i and its associated frame, (oi xi yi zi ), undergo a corre-
sponding motion. The frame o0 x0 y0 z0 , which is initially affixed to the robot’s
base, is commonly known as the inertial frame[16].
Let’s consider Ai as the homogeneous transformation matrix that repre-
sents the position and orientation of (oi xi yi zi ) relative to (oi−1 xi−1 yi−1 zi−1 ).
It’s important to note that the matrix Ai is not a constant value but changes
depending on the robot’s configuration. However, under the assumption that
all joints are either revolute or prismatic, Ai is solely influenced by a single
joint variable, denoted as qi . In other words,

Ai = Ai (qi ) (4)
By convention, the transformation matrix denoted as Tji is used to express
the position and orientation of (oj xj yj zj ) relative to (oi xi yi zi ). This matrix
serves as the homogeneous transformation matrix and is commonly referred
to as a transformation matrix[16]. We can see that

10
 Ai+1 Ai+2 . . . Aj−1 Aj if i < j
Tji = I if i = j (5)
−1
Tji if i > j
We can represent the position and orientation of the end-effector relative
to the inertial or base frame using a three-vector o0n , which provides the
coordinates of the end-effector frame’s origin with respect to the base frame.
Additionally, we utilize the 3x3 rotation matrix Rn0 . By combining these
elements, we define the homogeneous transformation matrix H
 0 0
Rn on
H= (6)
0 1
Then the position and orientation of the end-effector in the inertial frame
are given by:

H = Tn0 = A1 (q1 ) . . . An (qn ) (7)


 i−1 i−1 
Ri oi
∀i Ai = (8)
0 1
Hence,
 i i
Rj oj
Tji = Ai+1 Ai+2 . . . Aj−1 Aj = (9)
0 1
The matrix Rji represents the orientation of (oj xj yj zj ) with respect to
(oi xi yi zi ), specifically indicating the rotational relationship between the two
frames. It is derived from the rotational components of the A-matrices and
can be expressed as[16]:

Rji = Ri+1
i
. . . Rjj−1 (10)
The coordinate vectors oij are given recursively by the formula:

oij = oij−1 + Rj−1


i
.oj−1
j (11)
To sum up, Forward kinematics in robotic arms is the process of deter-
mining the end effector’s position and orientation based on the joint angles
and the arm’s geometric structure.

11
Figure 6: Configuring joint positions of a robot using forward or inverse
kinematics

3.2 Inverse Kinematics


Inverse kinematics is a crucial aspect of robotic arm control, focusing
on determining the joint angles required to position the end effector of the
robot arm in a desired location. Unlike forward kinematics, which calcu-
lates the end effector position based on given joint angles, inverse kinematics
tackles the inverse problem. It involves finding the joint configurations that
yield a specific end effector position. Solving inverse kinematics typically
involves employing mathematical techniques such as numerical methods, op-
timization algorithms, or closed-form solutions specific to the robot arm’s
structure and constraints. Inverse kinematics plays a vital role in tasks re-
quiring precise positioning or path planning for robot arms, enabling them
to interact with their environment and perform complex tasks with accuracy
and efficiency[16].

3.2.1 The General Inverse Kinematics Problem


The general problem of inverse kinematics is summarized in the following
way: with 4x4 homogeneous transformation matrix, it is desirable to be able
to identify relevant joint angles or related variables that would lead to an
appropriate end effector position and orientation.
 
R o
H= ∈ SE(3) (12)
0 1
with R ∈ SO(3), find (one or all) solutions of the equation

Tn0 (q1 , . . . , qn ) = H (13)

12
Where

Tn0 (q1 , . . . , qn ) = H (14)

Tn0 (q1 , . . . , qn ) = A1 (q1 ) . . . An (qn ) (15)


In this context, H denotes the desired position and orientation of the
end-effector, and our objective is to discover the specific values for the joint
variables q1 , . . . , qn that satisfy the equation Tn0 (q1 , . . . , qn ) = H.
Equation 14 results in twelve nonlinear equations in n unknown variables,
which can be written as

Tij (q1 , . . . , qn ) = hij , i = 1, 2, 3 j = 1, . . . , 4 (16)


where Tij , hij refer to the twelve nontrivial entries of Tn0 and H, respec-
tively [16].

3.2.2 Inverse Kinematics Redundancy


Inverse kinematics becomes particularly significant in redundant robot
arms, where the degrees of freedom exceed the necessary constraints to reach
a desired end effector position. Redundancy poses a challenge as there are
multiple possible joint configurations to achieve the same end effector pose.
Resolving redundancy in inverse kinematics involves optimizing criteria such
as minimizing energy consumption, avoiding obstacles, or optimizing ma-
nipulability. Efficiently addressing redundancy in robot arms allows for im-
proved task performance, flexibility, and adaptability in various operational
scenarios[8].

3.3 Differential Kinematics


Differential kinematics, also known as velocity kinematics, is a crucial
aspect of robot arm analysis that deals with the relationship between joint
velocities and end-effector velocities. It enables us to determine how changes
in joint angles or joint velocities affect the linear and angular velocities of
the end effector. By utilizing the Jacobian matrix, which relates the joint
velocities to the end-effector velocities, differential kinematics provides valu-
able insights into the manipulability and controllability of the robot arm. It
finds applications in trajectory planning, motion control, and obstacle avoid-
ance, allowing engineers to optimize the robot arm’s performance and ensure
precise and efficient movement in various tasks and environments[6].

13
This mapping is described by a Jacobian(J) matrix, which depends on
the manipulator configuration:
 

ve = e = J(q)q̇ (17)
we
Where, ve (End-effector velocity), q̇ (Joint velocity).
The Jacobian matrix J(q) in robotic arms is a mathematical tool used
to relate the velocities of the arm’s joints to the velocity of the end effector,
providing insights into the arm’s movement and control[1]:
 ∂y1 ∂y1

∂x1
· · · ∂xn
J (q) =  ... .. ..  (18)

. . 
∂ym ∂ym
∂x1
··· ∂xn

Here the Jacobian is a function of the joint angles and the kinematic
parameters of the robot.

4 Serial & Parallel Robotic Arms


In the field of robotics, two major architectures stand out when it comes
to the design and construction of robotic arms: serial and parallel configu-
rations. Serial and parallel robotic arms offer distinct advantages and have
different applications based on their inherent characteristics. This section
aims to provide an overview and comparison of these two architectures, ex-
ploring their key features, design considerations, and potential applications.

4.1 Parallel Robotic Arms


Parallel robotic arms, or parallel manipulators, represent a distinct archi-
tecture in robotic systems. Unlike their serial counterparts, parallel robotic
arms employ a configuration where multiple arms or chains connect the base
to the end effector. These chains work in parallel, with each arm having its
own joints and links. The design of parallel robotic arms offers several ad-
vantages, including high stiffness, enhanced payload capacity, and improved
accuracy. Due to their inherent mechanical structure, parallel robotic arms
excel in applications that require high force/torque transmission, such as
heavy-duty material handling, machining, and simulation systems. Addi-
tionally, their parallel arrangement provides improved rigidity and stability,
which can be advantageous in tasks where dynamic stability and vibration

14
control are critical. However, parallel robotic arms may face challenges re-
lated to workspace limitations, complex kinematics, and control algorithms.
Therefore, a thorough understanding of the specific requirements and trade-
offs is necessary when considering the implementation of parallel robotic arms
for various applications[12].

Figure 7: Parallel Robots The High-Speed Robotics Platform

4.2 Serial Robotic Arms


Serial robotic arms are a prevalent and versatile architecture widely em-
ployed in robotics. These arms consist of a sequential chain-like structure
where each joint connects to the next joint, leading to the end effector. Se-
rial robotic arms offer flexibility, precise control, and a wide range of motion.
They find applications in diverse fields, including manufacturing, assembly,
material handling, and even in intricate tasks such as surgical procedures.
Serial robotic arms can be designed with varying degrees of freedom, allowing
for customization to meet specific task requirements. They are capable of
performing complex motions and manipulations, making them indispensable
in industrial automation and robotic research. The kinematics, dynamics,
and control of serial robotic arms are extensively studied to optimize their
performance and enhance their capabilities[11].
In the next section, we will focus on a specific type of serial robotic arm,
namely the 2-R serial robotic arm, which is characterized by having two
revolute joints in its structure. We will delve into its kinematics, dynamics,
and models.

15
Figure 8: serial-robot-Arm

5 2-R Serial Robotic Arm


5.1 Overview of 2-R Serial Arm
A 2-DOF (degrees of freedom) serial robotic arm is a mechanical system
composed of two links connected by two rotational joints. This type of robotic
arm is often referred to as a planar or 2D arm since its motion is confined
to a single plane. The arm typically consists of a base or fixed link, which
serves as the arm’s foundation, and an end-effector or tool attached to the
second link[14].

Figure 9: 2-DOF Serial Flexible Robotic Arm Link-2

2-DOF serial robotic arms find applications in various fields, including


industrial automation, manufacturing, assembly, and even in some educa-
tional settings. They are suitable for tasks that require manipulation within

16
a two-dimensional space, such as pick-and-place operations, simple assembly
tasks, and object positioning[14].
In terms of design, 2-DOF robotic arms can be built using various mate-
rials, such as aluminum, steel, or even lightweight materials like carbon fiber,
depending on the required payload and desired flexibility. They can also in-
corporate sensors, such as encoders, to provide feedback on joint angles and
enable closed-loop control.
Overall, a 2-DOF serial robotic arm provides a simple yet versatile plat-
form for performing tasks in a two-dimensional workspace. Its compact size,
relative simplicity, and range of motion make it a popular choice for ap-
plications where precise positioning and manipulation are required within a
confined plane.
To control the movements of a 2-DOF robotic arm, kinematic equations
are used to relate the joint angles to the position and orientation of the end-
effector. These equations allow the arm to be programmed to follow specific
trajectories or execute predefined tasks accurately.

5.2 Robot Kinematics


5.2.1 Forward Kinematics

The Denavit-Hartenberg (DH) parameters are a set of parameters used


to determine the forward kinematics of a robotic arm. These parameters are
employed to derive the homogeneous transformation matrices that establish

17
the relationships between the various frames assigned to the structure of
the robot arm. In the case of a two-degree-of-freedom robotic arm, the DH
parameters are defined in the following manner[10]:

Link ai αi di θi
1 L1 0 0 θ1
2 L2 0 0 θ2

The derivation of the homogeneous transformation matrices for the 2-


DOF robotic arm depicted in Figure is performed in the following manner:
 
cosθ1 −sinθ1 0 L1 cosθ1
sinθ1 cosθ1 0 L1 sinθ1 
T10 = 
 0
 (19)
0 1 0 
0 0 0 1
 
cosθ2 −sinθ2 0 L2 cosθ2
sinθ2 cosθ2 0 L2 sinθ2 
T21 = 
 0
 (20)
0 1 0 
0 0 0 1
Therefore T20 can be derived as follows:

 
cos(θ1 + θ2 ) −sin(θ1 + θ2 ) 0 L1 cosθ1 + L2 cos(θ1 + θ2 )
sin(θ 1 + θ2 ) cos(θ1 + θ2 ) 0 L1 sinθ1 + L2 sin(θ1 + θ2 )
T20 =   (21)
 0 0 1 0 
0 0 0 1

The coordinates indicating the position of the end-effector of the manip-


ulator are expressed as:

Px = L1 cosθ1 + L2 cos(θ1 + θ2 ) (22)

Py = L1 sinθ1 + L2 sin(θ1 + θ2 ) (23)

5.2.2 Inverse Kinematics


The inverse kinematics of a robotic arm involves determining the joint
variables of the robot arm based on the given Cartesian coordinates of the
end-effector position. This problem can be solved using mathematical equa-
tions derived either algebraically or geometrically. The geometric approach is
generally considered easier, particularly for robot arms with a higher number

18
of degrees of freedom. In our specific case, we employed the geometric method
to solve the inverse kinematics equations for the 2-DOF robotic arm. To ob-
tain the solution for the elbow joint angleθ2 , we utilized the Pythagorean
theorem, which can be expressed as follows[10]:

Px 2 + Py 2 = L1 2 + L2 2 + 2L1 L2 cos(θ2 ) (24)

1
cos(θ2 ) = (Px 2 + Py 2 − L1 2 − L2 2 ) (25)
2L1 L2

sin(θ2 ) = ± 1−cos(θ2 )2 (26)
Therefore,

sin(θ2 )
θ2 = ± tan−1 (27)
cos(θ2 )
For The joint variableθ1 :

Px = (L1 + L2 cosθ2 ) cosθ1 − L2 sinθ1 sinθ2 (28)

Py = (L1 + L2 cosθ2 ) sinθ1 + L2 cosθ1 sinθ2 (29)


 
L1 + L2 cosθ2 −L2 sinθ2
∆= (30)
L2 sinθ2 L1 + L2 cosθ2

Px 2 + Py 2 = (L1 + L2 cosθ2 )2 + (L2 sinθ2 )2 (31)


 
L1 + L2 cosθ2 Px
∆sinθ1 = (32)
L2 sinθ2 Py
 
Px −L2 sinθ2
∆cosθ1 = (33)
Py L1 + L2 cosθ2

∆sinθ1 (L1 + L2 cosθ2 ) Py − L2 sinθ2 Px


sinθ1 = = (34)
∆ Px 2 + Py 2
∆cosθ1 (L1 + L2 cosθ2 ) Px + L2 sinθ2 Py
cosθ1 = = (35)
∆ Px 2 + P y 2
sinθ1 (L1 + L2 cosθ2 ) Py ± L2 sinθ2 Px
θ1 = tan−1 = tan−1 (36)
cosθ1 (L1 + L2 cosθ2 ) Px ± L2 sinθ2 Py

19
5.3 Robot Simulation on MATLAB
To analyze and simulate the behavior of the 2-R serial robotic arm, MAT-
LAB, a powerful numerical computing environment, is employed. MATLAB
provides a wide range of tools and functions for modeling, simulation, and
visualization, making it suitable for studying robotic systems.
The simulation involves implementing the forward and inverse kinematics
equations to determine the arm’s end-effector position based on the joint
angles and vice versa. This allows researchers to analyze the arm’s motion
and study how different joint configurations affect its workspace.

5.3.1 Procedure
First, we installed the ”rvctools” tool to manipulate the robotic arm on
the MATLAB program.
Secondly, we defined some of the functions that will benefit us in modeling
the robotic arm and will shorten the need to repeat the same code segments
in the main program.
Finally, leveraging the predefined variables and functions, a program was
developed to simulate the arm’s movement and modeling in various spatial
configurations. The results obtained from these efforts are summarized as
follows:

Figure 10: Defining The 2-DOF Serial Robotic Arm in Space

The appendix at the end of this document contains all the written code
segments.

20
Figure 11: Plot The 1th Degree trajectory From one point to an- other in
Joint Space

Figure 12: trajectory tracking in xy space

21
6 Conclusion
In conclusion, the research on the modeling of a 2-R serial robotic arm
provides a comprehensive understanding of robotic arms, their kinematics,
and the specific characteristics of the 2-R serial arm. The overview of robotic
arms presented the various types and applications of robotic arms, highlight-
ing their significance in industrial automation, manufacturing, and other
fields.
The study focused on the kinematics of robotic arms, which is crucial for
understanding the arm’s movement and positioning. By analyzing the kine-
matics equations, it was possible to determine the relationship between joint
angles, arm lengths, and end effector positions. This knowledge is fundamen-
tal for programming and controlling the robotic arm’s motion accurately.
Serial And parallel robotic arms were also discussed, providing insights
into their structures in robotic arm design.
The main focus of the research was the 2-R serial robotic arm. Its unique
design with two revolute joints and two links allows for efficient and precise
movement within a limited workspace. The kinematics equations specific to
the 2-R serial arm were derived and presented, enabling the calculation of
joint angles and end effector positions.
To visualize the theoretical findings and demonstrate the arm’s perfor-
mance, simulation on MATLAB was conducted. The provided appendixes
include the MATLAB codes used for the simulation, offering a practical im-
plementation of the 2-R serial robotic arm’s kinematics.
Overall, this research on the modeling of a 2-R serial robotic arm con-
tributes to the advancement of robotics by providing a thorough understand-
ing of robotic arm types, kinematics, and the specific features of the 2-R serial
arm. The derived equations and MATLAB simulation codes serve as valu-
able resources for further research, development, and application of robotic
arms in diverse industries

22
Appendices
A Basic MATLAB Codes used in Simulation
A.1 Installing rvctools on MATLAB
d i s p ( ’ Robotics , V i s i o n & C o n t r o l :
( c ) P e t e r Corke 1992 −2011 http : / /www. p e t e r c o r k e . com ’ )
tb = f a l s e ;
r v c p a t h = f i l e p a r t s ( mfilename ( ’ f u l l p a t h ’ ) ) ;

r o b o t p a t h = f u l l f i l e ( rvcpath , ’ robot ’ ) ;
i f e x i s t ( robotpath , ’ d i r ’ )
addpath ( r o b o t p a t h ) ;
tb = t r u e ;
startup rtb
end

v i s i o n p a t h = f u l l f i l e ( rvcpath , ’ v i s i o n ’ ) ;
i f e x i s t ( visionpath , ’ dir ’ )
addpath ( v i s i o n p a t h ) ;
tb = t r u e ;
startup mvtb
end

i f tb
addpath ( f u l l f i l e ( rvcpath , ’common ’ ) ) ;
addpath ( f u l l f i l e ( rvcpath , ’ s i m u l i n k ’ ) ) ;
end

c l e a r tb r v c p a t h r o b o t p a t h v i s i o n p a t h

A.2 Robotic Arm Functions


A.2.1 Calculating trajectory From one point to another in Carte-
sian Space

f u n c t i o n [Q, X, Q ] = C a r t e s i a n T r a j L i n e (T, dt , Xi , Xf )
t= 0 : dt :T;
N p o i n t s=l e n g t h ( t ) ;

23
Q=z e r o s ( N points , 2 ) ;
Q =z e r o s ( N points − 1 , 2 ) ;
%−−−−−−−−−−−−−−−−−−−−−−−−−

for i = 1: length ( t )
X( i , : ) = Xi + t ( i ) /T∗ ( Xf − Xi ) ;
end
for i = 1: length ( t )
Q( i , : ) = mgi (X( i , : ) , 1 ) ;
end

%−−−−−−−−−−−−−−−−−−−−−−−−−
f o r i =1: N points −1
Q ( i , 1 ) = (Q( i +1,1)−Q( i , 1 ) ) / dt ;
Q ( i , 2 ) = (Q( i +1,2)−Q( i , 2 ) ) / dt ;
end
end

A.2.2 Calculating Jacobian Matrix

function J = jacob ( qi )
a1 =100;
a2 =100;
J=[−a1 ∗ s i n ( q i (1)) − a2 ∗ s i n ( q i (1)+ q i (2)) , − a2 ∗ s i n ( q i (1)+ q i ( 2 ) ) ;
a1 ∗ c o s ( q i (1))+ a2 ∗ c o s ( q i (1)+ q i ( 2 ) ) ,
a2 ∗ c o s ( q i (1)+ q i ( 2 ) ) ] ;
end

A.2.3 Calculating angular velocity

function q = jacobi ( u )
% q = u(1:2)
% X’ = u ( 3 : 4 )
q1 = u ( 1 ) ; % Theta1
q2 = u ( 2 ) ; % Theta2
% Operational V e l o c i t i e s
X = u(3:4);
a1 =100;
a2 =100;
i f ( abs ( q2 ) <0.01)

24
q2=q2 + 0 . 0 1 ;
end
J = j a c o b ( [ q1 q2 ] ) ;
%a n g u l a r v e l o c i t i e s
q = ( Jˆ−1 ) ∗ X ;

A.2.4 Calculating 1th Degree trajectory From one point to an-


other in Joint Space

f u n c t i o n [Q, X, Q ] = J o i n t T r a j 1 d e g (T, dt , Qi , Qf )
t = 0 : dt :T;
S = length ( t ) ;
N points = S ;
Q = z e r o s ( N points , 2 ) ; % Angles
Q = z e r o s ( N p o i n t s − 1 , 2 ) ; % Angular v e l o c i t i e s
X = z e r o s ( N points , 2 ) ;
%c a l c u l a t e Q and X
%−−−−−−−−−−−−−−−−−−−−−−−−−
f o r i = 1: N points
Q( i , 1 ) = Qi ( 1 ) + t ( i ) / T ∗ ( Qf ( 1 ) − Qi ( 1 ) ) ;
Q( i , 2 ) = Qi ( 2 ) + t ( i ) / T ∗ ( Qf ( 2 ) − Qi ( 2 ) ) ;
X( i , : ) = mgd(Q( i , : ) ) ;
end

%−−−−−−−−−−−−−−−−−−−−−−−−−
%c a l c u l a t e a n g u l a r v e l o c i t i e s
f o r i = 1: N points − 1
Q ( i , 1 ) = (Q( i +1,1)−Q( i , 1 ) ) / dt ;
Q ( i , 2 ) = (Q( i +1,2)−Q( i , 2 ) ) / dt ;
end
end

A.2.5 Calculating 3th Degree trajectory From one point to an-


other in Joint Space

f u n c t i o n [ Q ,X, Q ] = J o i n t T r a j 3 d e g (T, dt , Qi , Qf )
t = 0 : dt :T;
S = length ( t ) ;
N points = S ;
Q = z e r o s ( N points , 2 ) ;

25
Q = zeros ( N points − 1 , 2 ) ;
X = z e r o s ( N points , 2 ) ;
s = zeros (1 , N points ) ;
f o r i = 1: N points
s ( i ) = 3 ∗ t ( i ) ˆ 2 / T ˆ 2 − 2 ∗ t ( i ) ˆ 3 / T ˆ 3;
end
%c a l c u l a t e Q and X
%−−−−−−−−−−−−−−−−−−−−−−−−−
f o r i = 1: N points
Q( i , 1 ) = Qi ( 1 ) + s ( i ) ∗ ( Qf ( 1 ) − Qi ( 1 ) ) ;
Q( i , 2 ) = Qi ( 2 ) + s ( i ) ∗ ( Qf ( 2 ) − Qi ( 2 ) ) ;
X( i , : ) = mgd(Q( i , : ) ) ;
end

%−−−−−−−−−−−−−−−−−−−−−−−−−
%c a l c u l a t e a n g u l a r v e l o c i t i e s
f o r i =1: N points −1
Q ( i , 1 ) = (Q( i +1,1)−Q( i , 1 ) ) / dt ;
Q ( i , 2 ) = (Q( i +1,2)−Q( i , 2 ) ) / dt ;
end

end

A.2.6 Calculating End-effector coordinates using Forward Kine-


matics

f u n c t i o n X = mgd( q )
a1 = 1 0 0 ;
a2 = 1 0 0 ;
x = a1 ∗ c o s ( q ( 1 ) ) + a2 ∗ c o s ( q ( 1 ) + q ( 2 ) ) ;
y = a1 ∗ s i n ( q ( 1 ) ) + a2 ∗ s i n ( q ( 1 ) + q ( 2 ) ) ;
X = [x y];

A.2.7 Calculating Angles using Inverse Kinematics

f u n c t i o n q = mgi ( x , Elbow )
a1 = 1 0 0 ;
a2 = 1 0 0 ;
q ( 2 ) = Elbow ∗ a c o s ( ( x ( 1 ) ˆ 2 + x ( 2 ) ˆ 2
− ( a2 ˆ2 + a2 ˆ 2 ) ) / ( 2 ∗ a1 ∗ a2 ) ) ;

26
C1 = ( ( x ( 1 ) ∗ ( a1 + a2 ∗ cos (q ( 2 ) ) )
+ x ( 2 ) ∗ a2 ∗ s i n ( q ( 2 ) ) ) / (x(1)ˆ2 + x ( 2 ) ˆ 2 ) ) ;
S1 = ( ( x ( 2 ) ∗ ( a1 + a2 ∗ cos (q ( 2 ) ) )
− x ( 1 ) ∗ a2 ∗ s i n ( q ( 2 ) ) ) / (x(1)ˆ2 + x ( 2 ) ˆ 2 ) ) ;
q ( 1 ) = atan2 ( S1 , C1 ) ;

A.3 Main Simulation Code


%%d e f i n e r o b o t i c arm

L ( 1 ) = Link ( [ 0 45 100 0 0 ] ) ;
L ( 2 ) = Link ( [ 0 0 100 0 0 ] ) ;
myR = S e r i a l L i n k (L ) ;
myR. t e a c h ( ) ;
X = mgd ( [ 0 0 ] ) ;
x = 100;
y = 100;
q = mgi ( [ x y ] , −1);
myR. p l o t ( q ) ;
%%

%% l i n e t r a j e c t o r y i n j o i n t s p a c e
qi = [0 , pi / 2 ] ;
q f = [− p i / 3 , 2 ∗ p i / 3 ] ;
dt = 0 . 1 ;
T = 2;
t0 = 0 ;
f o r t = 0 : dt :T
q = qi + t / T ∗ ( qf − qi ) ;
myR. p l o t ( q ) ;
end

%% l i n e t r a j e c t o r y i n j o i n t s p a c e with t r a j e c t o r y p l o t

t = 0 : dt :T;
[ Q, X, Q ] = J o i n t T r a j 1 d e g (T, dt , qi , q f ) ;
p l o t ( t , Q( : , 1 ) , t , Q( : , 2 ) ) ;
g r i d on ;
p l o t (X( : , 1 ) , X( : , 2 ) ) ;
for i = 1: length ( t ) − 1

27
myR. p l o t (Q( i , : ) ) ;
hold on ;
p l o t (X( i , 1 ) , X( i , 2 ) , ”k ∗ ” ) ;
a x i s ( [ 0 150 −150 1 5 0 ] ) ;
end

%% Three−o r d e r t r a j e c t o r y t r a c k i n g
i n j o i n t s p a c e with t r a j e c t o r y p l o t

qi = [0 , pi / 2 ] ;
q f = [− p i / 3 , 2 ∗ p i / 3 ] ;
dt = 0 . 1 ;
T = 2;
t0 = 0 ;
t = 0 : dt :T;
[ Q, X, Q ] = J o i n t T r a j 3 d e g (T, dt , qi , q f ) ;
p l o t ( t , Q( : , 1 ) , t , Q( : , 2 ) ) ;
g r i d on ;
p l o t ( t , X( : , 1 ) , t , X( : , 2 ) ) ;
p l o t ( t , Q( : , 1 ) , t , Q( : , 2 ) ) ;
g r i d on ;
h o l d on ;
plot ( t (1: length ( t ) − 1) , Q ( : , 1) , t (1: length ( t ) − 1) , Q ( : , 2 ) ) ;
for i = 1: length ( t ) − 1
myR. p l o t (Q( i , : ) ) ;
hold on ;
p l o t (X( i , 1 ) , X( i , 2 ) , ” ∗ ” ) ;
a x i s ( [ 0 150 −150 1 5 0 ] ) ;
end

%% t r a j e c t o r y t r a c k i n g i n xy s p a c e
Xi = [ 5 0 , 5 0 ] ;
Xf = [ 9 0 , 9 0 ] ;
T = 0.01;
dt = 0 . 0 0 1 ;
[ Q, X, Q ] = C a r t e s i a n T r a j L i n e (T, dt , Xi , Xf ) ;
for i = 1: length ( t ) − 1
myR. p l o t (Q( i , : ) ) ;
hold on ;
p l o t (X( i , 1 ) , X( i , 2 ) , ” ∗ ” ) ;
a x i s ( [ 0 150 −150 1 5 0 ] ) ; end

28
References
[1] Robotics. https://fl0under.github.io/robotics-notes/. Accessed May 8,
2023.

[2] Man moves his robotic arms with his mind: Groundbreaking
brain-controlled prosthetic attaches to implant in patient’s bone.
https://shorturl.at/lnCOR, 2016. Accessed May 7, 2023.

[3] ubot-7. https://www-robotics.cs.umass.edu/index.php/Robots/UBot-


7, 2017. Accessed May 6, 2023.

[4] Redrobco: Redundant robot control analysis


and control of kinematic redundant manipulators.
https://www.joanneum.at/en/robotics/reference-projects/finalized-
projects/redrobco-redundant-robot-control, 2018. Accessed May 7,
2023.

[5] Industrial robot manufacturing: How are robotic arms used?


https://shorturl.at/egpt2, 2023. Accessed May 6, 2023.

[6] D. Martins A. Campos, R. Guenther. Differential kinematics of serial


manipulators using virtual chains. https://shorturl.at/jmuO4, 2005. Ac-
cessed May 8, 2023.

[7] Evan Ackerman. Robots playing ping pong: What’s real, and what’s
not? kuka’s robot vs. human ping pong match looks to be more hype
than reality. https://shorturl.at/ITU18, 2014. Accessed May 7, 2023.

[8] Panagiotis K Artemiadis, Pantelis T Katsiaris, and Kostas J Kyri-


akopoulos. A biomimetic approach to inverse kinematics for a redundant
robot arm. Autonomous Robots, 29:293–308, 2010.

[9] Stefano Chiaverini, Giuseppe Oriolo, and Anthony A Maciejewski. Re-


dundant robots. Springer Handbook of Robotics, pages 221–242, 2016.

[10] Nasr M Ghaleb and Ayman A Aly. Modeling and control of 2-dof robot
arm. International Journal of Emerging Engineering Research and Tech-
nology, 6(11):24–31, 2018.

[11] Ashitava Ghosal. Kinematics of serial manipulators. Department of


Mechanical Engineering, Indian Institute of Science, Bangalore, 2015.

29
[12] Samir Lahouar, Said Zeghloul, and Lotfi Romdhane. Parallel manipu-
lator robots design and simulation. In Proceedings of the 5th WSEAS
international conference on System science and simulation in engineer-
ing, pages 358–363, 2006.

[13] Kevin M Lynch and Frank C Park. Modern robotics. Cambridge Uni-
versity Press, 2017.

[14] YD Patel and PM George. Performance measurement and dynamic


analysis of two dof robotic arm manipulator. Int. J. Res. Eng. Technol,
2(9):77–84, 2013.

[15] Bilal Safdar. Theory of robotics arm control with plc. 2015.

[16] Mark W Spong, Seth Hutchinson, and Mathukumalli Vidyasagar. Robot


modeling and control. John Wiley & Sons, 2020.

30

You might also like