Modeling and Control of 2-DOF Robot Arm
Modeling and Control of 2-DOF Robot Arm
Modeling and Control of 2-DOF Robot Arm
ABSTRACT
This paper presents a Modeling, Simulation and Control of a Two Degree of Freedom (2-DOF) robot
arm.This Work is taken from the Final Year capstone project. First The Robot specifications , Robot
Kinematics with Denavit-Hartenberg parameters (DH)for Forward kinematics and Inverse Kinematicsof 2-
DOF robot armwere presented. Then The dynamics of the 2-DOF robot arm was studied to derive the
equations of motion based on Eular-Lagrange Equation of motion. A Control Design was performed using
PID controller for the modeling and control Technique. The models has been done based on
Matlab/Simulink software.
Keywords: Robotics, 2-DOF Robot arm, Kinematic, Dynamic, PID Control and Modeling.
Robot Kinematics
Forward Kinematics
The Forward kinematics of a robotic arm is
determined a group of parameters called
Denavit-Hartenberg (DH) parameters which
used for deriving the homogenous
transformation matrices between the different
frames assigned on the robot arm structure. The
DH parameters for a two degree of freedom
robotic arm are defined as follows:
Figure 1. Two degree of freedom Robot Arm
Table 1. DH-parameters for the 2-DOF robotic arm
Link ai αi di 𝜽𝒊
1 L1 0 0 𝜃1
2 L2 0 0 𝜃2
The homogenous transformation matrices for the 2-DOF robotic arm shown in Figure(1) are derived
as follows:
cos 𝜃1 − sin 𝜃1 0 𝐿1 cos 𝜃1
𝟎 sin 𝜃1 cos 𝜃1 0 𝐿1 sin 𝜃1
𝟏𝑻 = (1)
0 0 1 0
0 0 0 1
cos 𝜃2 − sin 𝜃2 0 𝐿2 cos 𝜃2
𝟏 sin 𝜃2 cos 𝜃2 0 𝐿2 sin 𝜃2 (2)
𝟐𝑻 =
0 0 1 0
0 0 0 1
Using the Eq. (1) and (2), the homogenous transformation matrix 02𝑇can be derived as follows:
cos(𝜃1 + 𝜃2 ) − sin(𝜃1 + 𝜃2 ) 0 𝐿1 cos 𝜃1 + 𝐿2 cos(𝜃1 + 𝜃2 )
𝟎 sin(𝜃1 + 𝜃2 ) cos(𝜃1 + 𝜃2 ) 0 𝐿1 sin 𝜃1 + 𝐿2 sin(𝜃1 + 𝜃2 )
𝟐𝑻 = ( 3)
0 0 1 0
0 0 0 1
Therefore, can be derived either algebraically or
𝑛𝑥 𝑜𝑥 𝑎𝑥 𝑝𝑥 geometrically. The geometrical approach is
𝑹
𝑛𝑦 𝑜𝑦𝑎𝑦 𝑝𝑦 considered to be much easier for robot arms of
𝑯𝑻 = 𝑛𝑧 𝑜𝑧 𝑎𝑧 𝑝𝑧 (4) high degrees of freedom. In our Case, we solved
0 0 0 1 the inverse kinematics equations for the 2-DOF
𝟎 𝑹
robotic arm shown in Figure(2) using the
𝟐𝑻 =𝑯 𝑻 (5) geometrical method.
From Eq. (5), the position coordinates of the
manipulator end-effector is given by:
𝑃𝑥 = 𝐿1 cos 𝜃1 + 𝐿2 cos(𝜃1 + 𝜃2 ) (6)
𝑃𝑦 = 𝐿1 sin 𝜃1 + 𝐿2 sin(𝜃1 + 𝜃2 ) (7)
And the end-effector's orientation matrix is
defined by the first three rows and three
columns of the transformation matrix in Eq.(3).
Inverse Kinematics
The inverse kinematics of a robotic arm is a
solution of finding the robot arm joint variables
of given the position Cartesian coordinates of Figure 2. Two degree of freedom Robot Arm Inverse
the end-effector. The mathematical equations Kinematic
used to solve the inverse kinematics problem From Figure2, a mathematical equation for
solving the elbow joint angle 𝜽2 can be derived arm: Eular-Lagrange method and Newten-Eular
using Pythagoras theorem as follows: method. in this work , We used the Eular-
Lagrange method which depends on calculating
𝑝𝑥 2 + 𝑝𝑦 2 = 𝐿1 2 + 𝐿2 2 + 2𝐿1 𝐿2 cosθ2 (8) the total Kineatic and Potential Energies of the
1 robot arm to determine the Lagrangian (ℒ) of
cosθ2 = (𝑝𝑥 2 + 𝑝𝑦 2 − 𝐿1 2 − 𝐿2 2 ) (9)
2𝐿1 𝐿2 the whole system in order to calculate the force
or torque applied of each joint.With the
sinθ2 = ± 1 − cosθ2 2 (10) Lagrangianℒ, we can solve the Euler- Lagrange
equation which relies on the partial derivative of
Therefore, kinetic and potential energy properties of
sin θ2 mechanical systems to compute the equations of
𝜃2 = ± 𝑎𝑡𝑎𝑛 (11)
cos θ2 motion and is defined as follow:
For The joint variable 𝜃1 : 𝑑 𝜕ℒ 𝜕ℒ
F= − (21)
𝑑𝑡 𝜕 𝜃 𝜕𝜃
𝑝𝑥 = (𝐿1 + 𝐿2 cosθ2 ) cosθ1 − 𝐿2 sinθ1 sinθ2 (12)
where F is the external force acting on the
𝑝𝑦 = 𝐿2 sinθ2 cosθ1 + (𝐿1 + 𝐿2 cosθ2 )sinθ1 (13)
generalized coordinate, represents the torque
𝐿1 + 𝐿2 cosθ2 −𝐿2 sinθ2 applied to therobot and ℒ is the Lagrangian
∆= (14)
𝐿2 sinθ2 𝐿1 + 𝐿2 cosθ2 equation of the motion, given in Eq.(22)
𝑝𝑥 2 + 𝑝𝑦 2 = (𝐿1 + 𝐿2 cosθ2 )2 + (𝐿2 sinθ2 )2 (15) ℒ 𝑞 𝑡 ,𝑞 𝑡 = 𝐾𝐸 𝑞 𝑡 , 𝑞 𝑡 − 𝑃𝐸 𝑞 𝑡 (22)
𝐿1 + 𝐿2 cosθ2 𝑝𝑥 To solve the Lagrangian Eq.(22),we need first to
∆sinθ1 = (16)
𝐿2 sinθ2 𝑝𝑦 calculate the kinetic Energy 𝐾𝐸 and potential
Energy 𝑃𝐸 as follow:
𝑝𝑥 −𝐿2 sinθ2
∆cosθ1 = (17) 1
𝑝𝑦 𝐿1 + 𝐿2 cosθ2 𝐾𝐸 = 𝑚𝑥 2
2
∆sin θ1 𝐿1 +𝐿2 cos θ2 𝑝 𝑦 −𝐿2 sin θ2 𝑝 𝑥
sinθ1 = = (18) 𝑃𝐸 = 𝑚𝑔𝑙
∆ 𝑃𝑥 2 +𝑝 𝑦 2
∆cos θ1 𝐿1 +𝐿2 cos θ2 𝑝 𝑥 +𝐿2 sin θ2 𝑝 𝑦 The velocity is determined by taking the
cosθ1 = = (19) derivative of the position respect to time. so the
∆ 𝑝 𝑥 2 +𝑝 𝑦 2
position in the end of the link is known using
sin θ1 𝐿1 +𝐿2 cos θ2 𝑝 𝑦 ±𝐿2 sin θ2 𝑝 𝑥
𝜃1 =𝑎𝑡𝑎𝑛 = 𝑎𝑡𝑎𝑛 (20) known familiar variables :
cos θ1 𝐿1 +𝐿2 cos θ2 𝑝 𝑥 ±𝐿2 sin θ2 𝑝 𝑦
𝑥1 = 𝐿1 𝑠𝑖𝑛𝜃1
ROBOT DYNAMICS
𝑦1 = 𝐿1 cos 𝜃1
The dynamic model of a robot is concerned with
the movement and the forces involved in the 𝑥2 = 𝐿1 𝑠𝑖𝑛𝜃1 + 𝐿2 sin
(𝜃1 + 𝜃2 ) (23)
robot arm and establishes a mathematical
𝑦2 = 𝐿1 cos 𝜃1 + 𝐿2 cos(𝜃1 + 𝜃2 )
relationship between the location of the robot
joint variables and the dimensional parameters Then substitute in the kinetic's energy equation:
of the robot. There are two methods for 1 1 1 1
𝐾𝐸 = 𝑚1 𝑥1 2 + 𝑚1 𝑦1 2 + 𝑚2 𝑥2 2 + 𝑚2 𝑦2 2 (24)
performing the dynamics equations of a robot 2 2 2 2
After simplification,
1 2 1 2 1 2 2
𝐾𝐸 = (𝑚1 + 𝑚2 )𝑙1 2 𝜃1 + 𝑚2 𝑙1 2 𝜃1 + 𝑚2 𝑙2 2 𝜃1 𝜃2 + 𝑚2 𝑙2 2 𝜃2 + 𝑚2 𝑙1 𝑙2 𝑐𝑜𝑠𝜃2 𝜃1 𝜃2 + 𝜃1 (25)
2 2 2
(s ) Kt
G speed (s ) (34)
V in (s ) (La J m )s (R a J m bm La )s (R abm K t K b )
2
𝐵 𝑞 + 𝐶 𝑞 , 𝑞 + 𝑔 𝑞 = 𝐾𝑃 𝑒 + 𝐾𝐷 𝑒 + 𝜉 (37) −π 2
θo = π
From the system'smodel Eq.(30), we can have 2
𝑞 = 𝐵(𝑞)−1 −𝐶 𝑞 , 𝑞 − 𝑔 𝑞 +𝐹 (38) so, in our case:
with 𝑓1 = 𝐾𝑃1 θ1𝑓 − θ1 + 𝐾𝐷1 𝜃1 + 𝐾𝐼1 𝑒(𝜃1 ) 𝑑𝑡
−1 𝑓2 = 𝐾𝑃2 θ2𝑓 − θ2 + 𝐾𝐷2 𝜃2 + 𝐾𝐼2 𝑒(𝜃2 ) 𝑑𝑡
𝐹=𝐵 𝑞 𝐹 ⇔ 𝐹=𝐵 𝑞 𝐹 (39)
so, we decoupled the system to have the new However, the complete system equations with
(non-physical)input control would be
𝑓 𝑞 = 𝐵(𝑞)−1 −𝐶 𝑞 , 𝑞 − 𝑔 𝑞 +𝐹 (43)
𝐹= 1 (40)
𝑓2 with
however, the physical torque inputs to the 𝑓1 𝐾𝑃1 θ1𝑓 − θ1 + 𝐾𝐷1 𝜃1 + 𝐾𝐼1 𝑒 𝜃1 𝑑𝑡
𝐹= = (44)
system are 𝑓2 𝐾𝑃2 θ2𝑓 − θ2 + 𝐾𝐷2 𝜃2 + 𝐾𝐼2 𝑒 𝜃2 𝑑𝑡
𝑓θ1 𝑓 recalling the physical actual torques
=𝐵 𝑞 1 (41)
𝑓θ2 𝑓2
𝐹θ1 𝑓
=𝐵 𝑞 1 (45)
The error signals of the system are 𝐹θ2 𝑓2
e θ1 = θ1𝑓 − θ1 RecallingEq.(32) and Eq.(38), gives:
e θ2 = θ2𝑓 − θ2 (42)
𝜉1 = 𝐾𝐼1 𝑒 𝜃1 𝑑𝑡 ⇔ 𝜉1 = 𝐾𝐼1 𝑒1
where θ𝑓 is the final positions. The final
position is given by 𝜉2 = 𝐾𝐼2 𝑒 𝜃2 𝑑𝑡 ⇔ 𝜉2 = 𝐾𝐼2 𝑒2 (46)
θ1𝑓 π So, the system equations are
= −π2
θ2𝑓 𝜉1 = 𝐾𝐼1 𝑒1
2
and the initial position is given by 𝜉2 = 𝐾𝐼2 𝑒2
θ1 𝐾𝑃1 θ1𝑓 − θ1 + 𝐾𝐷1 𝜃1 + 𝜉1
= 𝐵(𝑞)−1 −𝐶 𝑞 , 𝑞 − 𝑔 𝑞 + (47)
θ2 𝐾𝑃2 θ2𝑓 − θ2 + 𝐾𝐷2 𝜃2 + 𝜉2
SIMULATION AND RESULTS
Approximate mathematical models can be
obtained and then simulated in combination
with the designed control law, for providing a
more realistic validation of the system behavior
and control performance. First we made a
mathematical model of the PMDC motor to
determine the transfer function and then start the
simulation of the actuator system without
controller using MATLAB /Simulink as shown
in Figure (3)to study the system performance Figure3. Step Response of PMDC without controller.
and then improving the design by adding PID
Controller as shown in Figure(4)and(5) for a
more realistic validation of the system
performance.
The system reaches steady state value of 0.778
rad/s in 1.27 s, with small overshoot and the
system response is very fast as shown in
Figure(3), so we need to add controller to
improve the system behavior. PID controller
simulinkis built to control the angular speed at a
desired set point value (𝐾𝑎,𝑡 = 1)and improving
the system performance as illustrate in Figure4. Figure 4. Simulink model of the actuator
system(PMDC).
We have noticed from Figure(5) and (6) that the After tuning by trial and error we got with the
system is second order system (Under damped) PID controller values :kp=40, ki=13,kd=5for the
and the values of the controller are getting with best performance, Also we have noticed from
PID tuning by trial and error with system Figure(8) that the position error reaches at a
characteristicsvalues for the best performance considerable time to zero steady-state of
and behavior:𝐾𝑝 =13, 𝐾𝑖 =39, 𝐾𝑑 =1.056, OS (%) constant input.
< 5, settling time < 2 sec, steady-state error <1%
and 𝐾𝐷𝐶 = 1.
with change in states and 𝐾𝑝1 is related to By the experiment, we got that the slightest
overall error cancellation. change in the controller parameters yields more
overshoots and oscillations due to highly
We have seen in the Figures (10) and (11) that sensitive to initial and final positions.
the position error reaches zero at a reasonably
fast time.
Automation and Systems, (IJCAS), Vol.2, Simulation and Control of 2-R Robot. Global
No.1, pp.12-18, 2013 Journal of Researches in Engineering, Volume
[6] Aalim M. Mustafa & A AL-SAIF, Modeling, 14, 2014.
Citation: Nasr M. Ghaleb and Ayman A. Aly, "Modeling and Control of 2-DOF Robot Arm", International
Journal of Emerging Engineering Research and Technology, 6(10), pp.24-31
Copyright: © 2018 Nasr M. Ghaleb. This is an open-access article distributed under the terms of the
Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in
any medium, provided the original author and source are credited.