You are on page 1of 7

PID control dynamics of a robotic arm manipulator with two degrees of freedom.

David I. Robles G.

david.robles@lasallistas.org.mx
August 17, 2012

Abstract
This paper presents a basic example of PID control applied to a robotic manipulator arm with two DOF (degrees of freedom), as well as the design of the dynamic model, explaining in detail each step so that in future work, we can increase the diculty level regardless of DOF of the robot. Also shown how to introduce the PID controller parameters to the equation of the dynamics of the robot, left as future work the implementation of a real-time control of these variables. Keywords: PID control, Dynamic model, Robotic manipulator arm.

Conventional robot control methods depend heavily upon accurate mathematical modelling, analysis, and synthesis. Dynamic modelling of manipulators is a very active eld of research, it's can be used to investigate the system responses and system properties, like nding the stability of the system. Actually the manipulators use proportional-derivative controllers (PD) or proportional-integral-derivative controllers (PID) in closed-loop systems in order to reach the desired congurations.

The proportional-integral-derivative (PID) control has simple structure and clear physical meanings for its three gains. The control performances are acceptable in the most of industrial processes. Most robot 1 Introduction manipulators employed in industrial operations are The robot arm manipulators in recent years had controlled by PID algorithms independently at each a slight growth in the industry. Because in stan- joint [3]. dard industrial the controllers don't include the In practice, the tuning of PID controllers is easier non-linearities between the joints of the robot and for robots whose transmission system includes rethe problem of modelling the dynamics and motion control arise the complications of the system when duction mechanisms such as gears or bands. The use computing the inertia tensor of a moving rigid of these reductions eectively increases the torque or body. The purpose of robot arm control is to force produced by the actuators, and therefore, these maintain the dynamic response of a computer-based are able to drive links of considerably large masses. manipulator in accordance with some pre specied Many control algorithm such as computer torque system performance and goals. Most of the robot manipulators are driven by electric, hydraulic, or method, optimal control, variable structure control pneumatic actuators, which apply torques (or forces, (VSC), neural networks (NNs) and fuzzy system have in the case of linear actuators) at the joints of the been proposed by many researchers to deal with this robot. problem. Our proposal is to use an approach of an 1

David I. Robles G.

Control de Procesos y Robtica

adaptive tuning methods: These are for automated There are two approaches to dynamic robot model, on-line tuning based on real-time identication. the direct and inverse dynamic model.
1.1 Dynamic model

The direct dynamic model expresses the tempo-

The dynamic model of a robot is the relationship between the movement and the forces involved in the robot. This establishes the mathematical relationship between the location of the robot joint variables, dened by its coordinates or location of its end, its derivatives (velocity and acceleration), the forces or torques applied to the joints and the dimensional parameters of the robot.

ral evolution of the robot joint coordinates as a function of the forces and torques involved (t) = f ( (t)).

The inverse dynamic model determines the

forces and torques required to achieve a joint evolution of the coordinates determined (t) = g((t)).

There is also another alternative approach for obtaining the model using the Lagrangian formulation This model relies heavily on the established bal- based on energetic considerations, that is therefore ance of forces in Newton's second law (equation 1) or the dierence between kinetic energy (KE ) and poits equivalent for rotational movements, the so-called tential energy (PE ), this formulation greatly facililaw of Euler (equation 2). tates the obtaining of a more complex model of a robot. This equation is dened as d (1) F = (mv)
dt L(q(t), q(t)) = KE (q(t), q(t)) PE (q(t)) d T = I = I + (I) dt

(3)

With the Lagrangian L, we can solve the EulerLagrange equation which relies on the partial derivaThus, in the simplest case of a robot with one link shown in Figure (1), the balance of forces-torques tive of kinetic and potential energy properties of mechanical systems to compute the equations of motion would result in the following equation: and is dened as follow
M gLcos = I d2 dt2 = M L2 + M gLcos F = d L L dt

(2)

(4)

where F is the external force acting on the generalized coordinate, represents the torque applied to the robot and L is the Lagrangian equation of the motion. The kinetic energy equation is dened as
KE = 1 mv 2 2

(5)

Figure 1: Model of the link with concentrated mass. August 17, 2012

where m is the mass of link and v is the the angular velocity of the joint. For simplicity, the mass of each link is supposed to be punctual and located at the end of the link. The potential energy equation is dened as

Maestra en Ciencias rea Cibertrnica

David I. Robles G.

Control de Procesos y Robtica


1.2 PID control

Considering the nonlinear equation that are derive Where g is the gravity and l is the projection of from Euler-Lagrange equation (12), the control inthe position vector of the link. put variable F which represents the torque applied to the robot, is unknown, (we assumed that the conIn the simplest case of a robot shown in gure (1) sidered robot actuators were ideal sources of torques we obtain the following dynamic model and forces). However it's requires a control in the torque applied of the joints to reach a nal position. 1 (7) Therefore we use the classical linear PID law as shown KE = I 2 2 below; where I is the inertia tensor I = M L2 . Also
t

PE = mgl

(6)

PE = M gh = M gLsen

(8)

F = Kp e + Ki
0

e( )d + Kd e

(13)

and substituting with the Lagrangian equation (3) where e = q d q , q d is desired joint angle, Kp , Ki we obtained the following expression. and Kd are proportional, integral and derivative gains of the PID controller, respectively. This PID control law can be expressed via the following equations. L(q(t), q(t)) = KE (q(t), q(t)) PE (q(t)) (9) 1 F = Kp e + Kd e + L(q(t), q(t)) = M L2 2 M gLsen 2 (14) Now we can calculate the force applied to the The integral action of the PID control law (14) ingeneralized coordinate using the equation Eulertroduces an additional state variable that is denoted Lagrange here by and whose time derivative is = Ki e. The L closed-loop equation is obtained by substituting the = M gLcos control action F from (14) in the robot model (12). L 2 = ML (10)
d L = M L2 dt M (q) + C(q, q) + g(q) = Kp e + Kd e + q = Ki e, (0) = 0

(15)

and nally we get the torque applied to the joint.


F = M L2 + M gLcos

T T eT e

(11)

which may be written in terms of the state vector T , as


Whatever the method is chosen to obtain the dynamic model of the robot, it has the following form of a nonlinear equation
F = M (q) + C(q, q) + g(q) q
n

(16) The equilibrium of the equation above, if any, have where q R represents the link positions. n is T joint number or degrees of freedom, M (q) is the in- the form T eT eT = T 0T 0T T where ertia matrix, C(q, (q)) = {ckj } Rnxn represents centrifugate force, g(q) is vector of gravity torques 1 = Ki M (q d )q d + C(q d , qd )qd + g(q d ) (17) and F Rn is control input. August 17, 2012 Maestra en Ciencias rea Cibertrnica

(12)

e d e e = d q M (q)1 [Kp e + Kd e + Ki dt e C(q, q)q g(q)

David I. Robles G.

Control de Procesos y Robtica

must be a constant vector. Certainly, for to be a constant vector, if the desired joint position q d is time-varying, it may not be arbitrary but should have a very particular form. One way to obtain a q d for which is constant, is by solving the dierential equations
d dt q qd
d

calculating the kinetic and potential energy. However, we don't know the velocity but we know that the derivative of an position respect to time is the velocity. So we dene the position in the end of the link using the variables we already know, in other words, we can put
x1 = L1 sin1 y1 = L1 cos1 x2 = L1 sin1 + L2 sin(1 + 2 ) y2 = L1 cos1 + L2 cos(1 + 2 )

qd M (q d )1 F0 C(q d , qd )qd g(q d )

(19)

(18)
qd 0 qd 0
2n

Then substituting in the equation of kinetic energy we obtain the following expression
KE = 1 1 1 1 M1 x2 + M1 y1 + M2 x2 + M2 y2 (20) 1 2 2 2 2 2 2 2

where F0 1 = K i F0 .

is a constant vector. This way

PID control dynamics of a robotic arm manipulator

and by simplication.
KE = 1 1 2 2 (M1 + M2 )L2 1 + M2 L2 1 + M2 L2 1 2 1 2 2 2 2 1 2 2 + M2 L2 2 + M2 L1 L2 cos2 (1 2 + 1 ) 2 2

For this experiment, what we want to control with the PID is the force applied to the robot to take it to a (21) desired position using as parameter the error between And Potential energy is the actual and the desired coordinate. To develop the dynamic model we will consider the robot arm manipulator with two degrees of freedom as shown in PE = M1 gL1 cos1 + M2 g(L1 cos1 + L2 cos(1 + 2 )) Figure 2, where M 1 = M 2 = 1 and L1 = L2 = 1. (22) So we can now form the Lagrangian equation (3).
1 1 2 2 (M1 + M2 )L2 1 + M2 L2 1 + M2 L2 1 2 1 2 2 2 2 1 2 2 + M2 L2 2 + M2 L1 L2 cos2 (1 2 + 1 ) 2 2 M1 gL1 cos1 + M2 g(L1 cos1 + L2 cos(1 + 2 )) L=

(23) The next step is to form the Lagrange-Euler equation (4) with the Lagrangian (L) we already know, in order to calculate the force applied to the robot. Figure 2: Two-link planar manipulator.
F1,2 = L d L dt 1,2 1,2

(24)

So, the dynamic equations after simplications beFirst we need to solve the Lagrangian equation (3) come August 17, 2012 Maestra en Ciencias rea Cibertrnica

David I. Robles G.

Control de Procesos y Robtica

however, the physical torque inputs to the system are


F1 = ((M1 + M2 )L2 + M2 L2 + 2M2 L1 L2 cos2 )1 1 2 +(M2 L2 + M2 L1 L2 cos2 )2 M2 L1 L2 sin2 (21 2 + 2 )
2 2

f 1 f 2

= M (q)

f1 f2

(30)

(M1 + M2 )gL1 sin1 M2 gL2 sin(1 + 2 ) The error signals of the system are

(25)

e(1 ) = 1f 1

F2 = (M2 L2 + M2 L1 L2 cos2 )1 + M2 L2 2 2 2 M2 L1 L2 sin(2 )1 2 M2 gL2 sin(1 + 2 )

(26)

e(2 ) = 2f 2

(31)

So, we can describe the motion of the system by the equation (12),
q= M (q) = 1 2 D1 D3 D2 D4

where f is the nal positions. For the experiment, the nal position is given by
1f 2f =
2 2

(32)

and for the initial position is given by


0 = 2
2

(33)

where
D1 = ((M1 + M2 )L2 + M2 L2 + 2M2 L1 L2 cos2 ) 1 2 D2 = (M2 L2 + M2 L1 L2 cos2 ) 2 D3 = M2 L2 + M2 L1 L2 cos2 2 D4 = M2 L2 2
2 M2 L1 L2 sin2 (21 2 + 2 ) M2 L1 L2 sin2 1 2

with this information, we can design the general structure of PID controller for any input using the classical linear law (13). So, the complete system equations with control would be
q = M (q)1 [C(q, q) g(q)] + F

(34)

with
f1 f2 Kp1 (1f 1 ) Kd1 1 + Ki1 2 + K21 Kp2 (2f 2 ) Kd2 e(1 )dt e(2 )dt

C(q, q) =

F =

g(q) =

(M1 + M2 )gL1 sin1 M2 gL2 sin(1 + 2 ) M2 gL2 sin(1 + 2 ) F = F1 F2

(35) Recalling the physical actual torques(30). However in order to apply all controls of Proportional-DerivativeIntegral actions, a extra state is added for each angle to resemble the integration inside the computer:
x1 = x2 = e(1 )dt x = 1f 1 e(2 )dt x = 2f 2

Having the system equation, we can have


q = M (q)
1

[C(q, q) g(q)] + F

(27)

(36)

with (28) So, we decoupled the system to have the new (nonphysical) input
F = M (q)1 F F = M (q)F F = f1 f2

So, the system equations are


1 2 x1 = 1f f x2 = 2f f = M (q)1 [C(q, q) g(q)] + F

(29)

(37)

August 17, 2012

Maestra en Ciencias rea Cibertrnica

David I. Robles G.

Control de Procesos y Robtica

Results and Conclusions

Our rst approach to control the robotic manipulator arm is by trial and error, the two parameters of the controllers will be tuned manually to obtain the best performance. The best performance of the controller parameters values are shown below
Kp1 = 15 Kd1 = 7 Ki1 = 10 Kp2 = 15 Kd2 = 10 Ki2 = 10

Figure 5: Torque of Theta 1.

As shown in the gures (3) and (4), the position error reaches zero at a considerably fast time,

Figure 6: Torque of Theta 2. Figure 3: Theta 1 error.

By the experiments, we can notice how Kp is related to direct error and to speed of evolution, Kd is related to speed of interaction with change in states and Ki is related to overall error cancellation. However the slightest change in the parameters of the controller produces more overshoots and oscillations and are highly sensitive to initial and nal positions. As future work is proposed to use other techniques, such as fuzzy controller systems that works only with the position of the angle and torque response as well as an online controller with auto tuning of the parameters Kp , Kd and Ki

Figure 4: Theta 2 error.


the force or torque applied can be seen in Figures (5) and (6), slight overshoot or peaks but stabilize quickly

References
[1] Reyes, Corts, F. (2012) MATLAB Aplicado a st Robtica y Mecatrnica (1 Edition). Mxico City. Alfaomega.

August 17, 2012

Maestra en Ciencias rea Cibertrnica

David I. Robles G.

Control de Procesos y Robtica

[2] Barrientos, A. Pein, Luis, F. Balaguer, C. Aracil, R. (2007) Fundamentos de Robtica (2nd Edition). Mxico City. McGrawHill. [3] M.W.Spong and M.Vidyasagar (1989) Robot Dynamics and Control Canada. John Wiley Sons Inc. [4] R. Kelly, V. Santibez and A. Lora (2005) Control nd of Robot Manipulators in Joint Space (2 Edition). Springer.

August 17, 2012

Maestra en Ciencias rea Cibertrnica

You might also like