Modeling 2-R Serial Robotic Arm - Hasan - Ismail - Final - Report
Modeling 2-R Serial Robotic Arm - Hasan - Ismail - Final - Report
Student Name:
Hasan Ismail
Supervisors
Prof. Adel Alkafri
M.Sc. Jamil Antone Layous
Prof. Nada Mohanna
2023 - 2022
Contents
1 Introduction 4
6 Conclusion 22
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.
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].
6
Figure 3: Table Tennis Timo Boll vs KUKA robot
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:
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].
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].
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:
Rji = Ri+1
i
. . . Rjj−1 (10)
The coordinate vectors oij are given recursively by the formula:
11
Figure 6: Configuring joint positions of a robot using forward or inverse
kinematics
12
Where
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.
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].
15
Figure 8: serial-robot-Arm
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.
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
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
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]:
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 :
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:
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
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
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
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
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 ;
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
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
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];
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 ) ;
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.
[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.
[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.
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.
[15] Bilal Safdar. Theory of robotics arm control with plc. 2015.
30