Beruflich Dokumente
Kultur Dokumente
A thesis presented to
the faculty of
In partial fulfillment
Master of Science
Bibhrajit Halder
August 2002
This thesis entitled
BY
Bibhrajit Halder
Jae Lew
Dennis Irwin
This thesis presents feedback control algorithm for a robotic crane carrying a suspended
varying load. A controller based on swing angle feedback method is proposed and its
performance is compared with Proportional and Derivative (PD) and full state feedback
controllers. The proposed controller suppresses the swing motion of the load while the
crane carries the load to a desired position. The analysis includes the nonlinear dynamics
of the crane and two-dimensional swing motion of the load. A simulation study is
performed under various load condition to show the effectiveness of the swing angle
feedback controller. The proposed controller is successfully implemented on the test bed
Page
TITLE .................................................................................................................................1
APPROVAL .......................................................................................................................2
ABSTRACT........................................................................................................................3
1.3 SUMMARY..........................................................................................................16
CHAPTER 6. CONCLUSION........................................................................................85
6.1 CONCLUSION......................................................................................................85
6.2 CONTRIBUTION..................................................................................................87
REFERENCES.................................................................................................................89
LIST OF TABLES
LIST OF FIGURES
Figure 2.7: Simulation results of the system with FSF controller .....................................32
Figure 2.8: Simulation results of the system with FSF controller (LQR method).............34
Figure 2.9: Simulink diagram of the system with swing angle feedback control..............36
Figure 2.10: Simulation results of the system with swing angle feedback controller .......37
Figure 4.3: Simulink diagram of the system with swing angle feedback controller..........59
Figure 4.4: X-axis oscillation under various payloads using PD controller ......................61
Figure 4.5: Y-axis oscillation under various payloads using PD controller ......................61
Figure 4.6: First joint angle q1 under various payloads using PD controller.....................62
9
Figure 4.7: Second joint angle q2 under various payloads using PD controller ................62
Figure 4.8: X-axis oscillation under various payloads using FSF control (PPM) .............63
Figure 4.9: Y-axis oscillation under various payloads using FSF control (PPM) .............63
Figure 4.10: Joint angle q1 under various payloads using FSF control (PPM)..................64
Figure 4.11: Joint angle q2 under various payloads using FSF control (PPM)..................64
Figure 4.12: X-axis oscillation under various payloads using FSF control (LQR) ...........65
Figure 4.13: Y-axis oscillation under various payloads using FSF control (LQR) ...........65
Figure 4.14: Joint angle q1 under various payloads using FSF control (LQR)..................66
Figure 4.15: Joint angle q2 under various payloads using FSF control (LQR)..................66
Figure 4.16: X-axis oscillation under various payloads using SAF controller ..................67
Figure 4.17: Y-axis oscillation under various payloads using SAF controller ..................67
Figure 4.18: Joint angle q1 under various payloads using SAF control.............................68
Figure 4.19: Joint angle q2 under various payloads using SAF control.............................68
Figure 5.5: The Simulink diagram of the system with SAF ..............................................77
Figure 5.6(a): X-axis oscillation for payload 1kg with SAF and PD controller ................79
Figure 5.6(b): Y-axis oscillation for payload 1kg with SAF and PD controller................79
Figure 5.7: Comparison of joint angle q1 with PD control for payload 1kg......................80
10
Figure 5.8: Comparison of joint angle q1 with SAF controller for payload 1kg ...............80
Figure 5.9: Comparison of joint angle q2 with PD control for payload 1kg......................81
Figure 5.10: Comparison of joint angle q2 with SAF controller for payload 1kg .............81
Figure 5.11(a): X-axis oscillation for payload 2.3 kg with SAF and PD controller ..........82
Figure 5.11(b): Y-axis oscillation for payload 2.3 kg with SAF and PD controller..........82
Figure 5.12: Comparison of joint angle q1 with PD control for payload 2.3 kg................83
Figure 5.13: Comparison of joint angle q1 with SAF controller for payload 2.3 kg .........83
Figure 5.14: Comparison of joint angle q2 with PD control for payload 2.3 kg................84
Figure 5.15: Comparison of joint angle q2 with SAF controller for payload 2.3 kg .........84
11
LIST OF SYMBOLS
ζ, : Damping ratio
K : Gain matrix
m3 : Mass of payload
I1 : Moment of inertia of first link with respect to the mass center of link 1
g : Gravitational constant
T : Kinetic energy
V : Potential energy
Ts : Settling time
ωn : Swing frequency
13
CHAPTER 1: INTRODUCTION
1.1 Motivation
Cranes are widely used in industry to transport heavy loads. For example, on the
construction site, harbor, or warehouse, it is often found that a crane carries a suspended
load to the point of interest. However, the swing motion of the load often limits its
operational efficiency and safety. To reduce the swing motion of the load, the crane
This problem is popularly known as anti-swing control of the crane system and it
has drawn the interest of control engineers for a long time. The controller should be able
to handle a wide range of payloads without prior knowledge, which is the typical scenario
of an industrial crane.
with three other different linear controllers, to handle a wide range of payloads. The three
other controllers are, Proportional and Derivative (PD) controller based on root locus
method and full state feedback controller based on pole placement method and Linear
Quadratic Regulator (LQR) method. The results of all four controllers are compared
The swing angle feedback controller has advantages over the other controllers under
various payload conditions. First, the proposed controller adds an extra feedback loop to
damp out the swing. This extra feedback loop is independent of the payloads. Thus it is
more robust under various payloads. Second, it can be easily implemented to an existing
industrial system.
researchers have worked on this issue of anti-swing control of the crane system. Their
work can be divided into largely two groups: open loop and closed loop control.
The open loop methods, such as low pass filter, symmetric acceleration profile [1],
and input shaping [2] [3], are intended not to excite the swing motion. They are simple to
implement but cannot suppress swing motion caused by external disturbances. They also
On the other hand, the closed loop method of swing motion provides the ability to
eliminate existing swing motion and rejects disturbances at the cost of an extra sensor.
Ho-Hoon Lee et al. [4] have developed a closed-loop controller based on root locus
crane based on two degree of freedom swing angle. But he linearized his dynamic
15
equation to find the decoupled control law. The new decoupled control law can’t work
Wen. B et al. [5] developed the closed-loop controller based on the LQR method.
Chi-Chen Cheng and Cheng-Yi Chen et al. [6] derived a control law using the
feedback linearization technique. This method addresses the issue of varying payloads.
J.A. Mendez et al. [7] have proposed a more complex neural network based self-tuning
controller. Both M. Mahfouf et al. [8] and A. Benhidjep et al. [9] developed a fuzzy logic
based controller. The analysis and implementation of all the above controllers are limited
Ji sup Yoon et al [10] designed several anti-swing controllers using both open-loop
and closed-loop approaches. In order to develop more effective and robust controller he
freedom linear overhead crane. Also, the crane dynamics is often ignored and considered
only as a controlled velocity source, which may not hold under heavy load. In addition, it
often requires an exact model of the overall system and cannot maintain swing control
1.3 Summary
Cranes are popularly used in industry to carry heavy loads. It is found that the swing
in the suspended load limits the operational efficiency. To reduce the swing motion,
Different control methods are applied to design a controller to suppress the swing
motion of a load suspended from a two link robotic arm. A simple one-directional
overhead crane system is considered to illustrate the dynamic behavior of the system.
Four different controllers, namely, PD controller based on graphical root locus method,
pole placement controller, LQR controller and swing angle feedback controller, are
designed for the simple overhead crane system. First, the simulation results for each
controller are obtained. The simulation study demonstrated that the significant damping
effect was obtained using angle feedback controller. The swing angle feedback controller
also performs better under various payloads. The analysis on a simple one-directional
overhead crane helps to better understand the dynamic behavior of the system under
different controllers.
derived using Lagrange’s Equation. With few assumptions, the actual dynamic model is
To demonstrate the proposed swing angle feedback controller and compare it with
others, experiments were performed on a test bed at the Mechanical Engineering Control
Laboratory, Ohio University. Figure 1.1 shows the actual test bed. Two motors are
mounted at each active joint. An aluminum rod is attached at the end of two link robotic
arm, which swings as the links moves. The experimental results match closely with the
simulation results.
simple overhead crane system, shown in Figure 2.1, consists of a cart of M, and a
pendulum with payload, m. The cart represents the tip position of the robotic arm. The
control objective is to move the cart from position ‘1’ to position ‘2’, with minimum or
possibly zero swing angle, θ. This simple overhead crane is used in the following
analysis to illustrate the dynamic behavior of the system under various controllers,
namely, PD controller, full state feedback controller and finally swing angle feedback
controller.
1 2
M M
m
m
The dynamic model of the simple overhead crane system has been derived using
Newtonian mechanics. The pendulum l is considered as a rigid link and its length is
assumed to be constant. x denotes the distance of the cart from it’s initial position, in X
coordinate. The system dynamics of Figure 2.1 are shown in Equations (2.1) and (2.2).
where M denotes the mass of the cart in Kg , m denotes the mass of payload at the end of
the pendulum, in Kg, &x& denotes the acceleration of the cart, θ denotes the swing angle,
θ& denotes the velocity of the swing angle, θ&& denotes the acceleration of the swing angle,
F denotes the applied force in Newton, g stands for acceleration due to gravity, and l
sin θ ≅ θ and cos θ ≅ 1 , the system Equations (2.1) and (2.2) may be linearized as
follows:
Equations (2.3) and (2.4) are used as the dynamic model of the cart and pendulum
To represent Equations (2.3) and (2.4) in a state space form, four states have been
X& 1 0 1 0 0 X 1 0
&
X 2 = 0 0 mg / M 0 X2 1/ M
+ [F ] ( 2.5)
X& 0 0 0 1 X 3 0
3
X& 4 0 0 − g ( M + m) / Ml 0 X 4 − 1 / Ml
X
1
x 1 0 0 0 X 2 0
=
θ 0 0 1 0
+ 0 [F ] (2.6)
3
X
X
4
21
M=2 kg, m=1 kg, l =1 m, to get the A, B and C matrixes in numerical values.
0 1 0 0 0
0 0 0.5
0 4.9 1 0 0 0
A= , B= , C=
0 0 0 1 0 0 0 1 0
0 0 − 14.7 0 − 0.5
The D matrix is a (2x1) zero matrix; it physically represents the part of input, which
The system described by Equation (2.5) and Equation (2.6) has only one control
input, but has two states, x andθ, to be controlled. In the following sections, open-loop
response of the system will be discussed and controllers will be designed for the system.
22
To get the open-loop response of the system, a unit step input and an impulse input
have been applied to the system. Figure 2.2 shows the impulse response of the system,
and Figure 2.3 shows the step response of the system. It is observed that the cart
also observed that there is no damping in the swing motion of the pendulum. Its natural
The control objective is to determine the control inputs, F, such that the oscillation
in the pendulum damps out as quickly as possible while the cart moves from position ‘1’
In this section, four different controllers will be designed. The first controller is a
PD control based on root locus method. Root locus method is a graphical method to
design the closed loop pole locations. The second controller is a full-state feedback
control based on pole placement method. In this method, poles of closed-loop system are
placed at desired locations by means of choosing the appropriate state feedback gain
matrix. The third controller is another full-state feedback control based on Linear
proposed. In this method, an extra angle feedback loop has been added to the existing PD
2.4.1 PD controller
An iterative root locus analysis is used to find a unique set of values for proportional
constant, kp, and derivative constant, kd, to maximize the damping of the system. The root
locus method is a graphical method for determining the location of all closed-loop poles
as the parameter is changed from zero to infinity. This method yields the closed loop pole
In the following, three different cases have been considered, first a low kp/kd ratio,
second medium kp/kd ratio and finally high kp/kd ratio. To change the kp/kd ratio, the kd
value keeps constant and the kp value has been changed. For low kp/kd ratio, a low kp
value has been chosen. A medium kp value has been chosen to get a medium kp/kd ratio.
Finally, a high value of kp has been chosen to get high kp/kd ratio. The root-locus plots for
the three different cases are shown in Figure 2.4(a), (b) and (c). It can be observed in the
root locus plot that the maximum damping for low kp value is restricted below .15. As the
kp value increases, kp/kd value increases and the poles moves to the left hand side. That
increases the maximum damping to .37. As kp/kd ratio increases, the two poles move
towards the imaginary axis, which in turn decreases the damping ratio. From this
graphical method, the kp and kd value are chosen for medium kp/kd value.
25
Figure 2.4(a): Poles for low kp/kd Figure 2.4(b): Poles for medium kp/kd
2.5.
It can be observed from Figure 2.5 that only the cart position, x, has been used for
the feedback loop. The PD controller only controls the position of the cart and has no
control over the swing motion of the pendulum. This can be observed in the Simulink
was performed for payloads 1 kg (nominal), 10 kg and 0.1 kg. The same controller has
C o m p a r i s o n o f c a rt p o si ti o n f o r th r e e d if f e r e n t p a y lo a d s
1.4
1.2
1
Position of cart in meter
0.8
P o s i ti o n o f c a rt w i th p a y lo a d 1 k g
P o s i ti o n o f c a rt w i th p a y lo a d . 1 k g
0.6
P o s i ti o n o f c a r t w i th p a y lo a d 1 0 k g
0.4
0.2
0
0 5 10 15 20
T im e in s e c
S w i n g a n g le f o r d i ff e r e n t p a y loa d s
0.6
S w i n g a n gle f or p ay lo ad 1 0 k g
0.4
0.2
Swing angle in radian
-0 .2
-0 .4
-0 .6
S wi n g a n g le f o r p a y lo a d 1 k g S w i n g a n g le f o r p ay lo ad 0 .1 k g
-0 .8
0 5 10 15 20
T I m e i n s ec
the system. But as discussed earlier and is shown in Figures 2.4(a), (b) and (c), there is a
It is observed from Figure 2.6 that the overhead crane system with PD control
remains stable under various payload conditions. To find the stability criterion of the
system with PD control, Routh-Horiwitz criterions have been used. The linear dynamic
model of the system is given in Equations (2.3) and (2.4). Laplace transformation has
( M + m) s 2 X ( s ) + mls 2θ ( s ) = F ( s ) (2.7)
ls 2θ ( s ) + s 2 X ( s ) + gθ ( s ) = 0 (2.8)
Equation (2.9)
In order to use Routh-Horiwitz criterion, Equation (2.9) has been written by taking the
mgk d g
a1 = Ml , a 2 = k d l , a 3 = mg + k d l , and a 4 =
k p l + mg
It is observed that all the four terms are positive, regardless of the weight of payload,
for positive kp and kd value. It proves that the system with PD controller remains stable
In the next section, full state feedback control using pole placement method has been
discussed where the closed loop poles can be placed anywhere in the S-plane to achieve
It has been observed that the open loop system is marginally stable as open loop
system poles are on the imaginary axis of the S-plane. In this section a full state feedback
(FSF) control using pole placement method, will be presented. It is shown in Section 2.2
that the system is completely controllable. As the open loop system is fully controllable,
the poles of closed loop system are placed at desired location by full state feedback gain
matrix. The control law with the gain matrix K given as: U=r-KX, r represent the
reference input. A settling time of 5 sec and percent overshoot of 5% are chosen to decide
the desired dominant closed-loop pole location. The other two poles are selected 10 times
of the dominant pole (ME 601). The desired closed-loop pole locations in S-plane are
given as follows:
P1 = −2.0 + 3.46i
P2 = −2.0 − 3.46i
P3 = −20.0
P4 = −21.0
Ackerman’s formula ([11] Page 782-784) has been used to get the appropriate state
feedback gain matrix based on the desired closed loop pole locations. The value for the
controller desired poles. Ten times has been taken, to ensure that observer should have
faster work rate then controller, so that the observed values of the states are
160 1650
11030 295250
L=
0 140
30 6270
The simulation results for pole placement controller are shown in Figure 2.7. The
state feedback gain matrix is designed based on payload 1 kg. But the same gain matrix is
used for payload 0.1 kg and 10 kg also. It can be observed in Figure 2.7 that the system
It can be observed that the values of the gain matrix are very high. The gain matrix
controls the input force to the system. A very high value of the gain matrix requires a
large force input into the system. Implementing such a controller for practical purposes
needs a lot of energy and sometime it is not possible to generate a large force. To avoid
this problem, in the next section, full state feedback control will be designed using LQR
method.
32
-1
-2
-3
0 2 4 6 8 10
Time in s ec
0. 1
Swing angle in radian
-0.1
-0.2
S wi ng a ngle with pay loa d 0. 1 kg : da shed line
-0.3
S wing angle with pay load 10 kg: D otted line
-0.4
0 5 10 15 20
Time in s ec
(LQR) ([11] Page 841-844, [12]) has been considered to design the full state feedback
controller. In pole placement method, the state feedback gain matrix has been calculated
purely based on desired closed loop pole location, without any physical insight of the
system. In LQR method, the state feedback gain matrix is calculated by minimizing the
∞
J = ∫(X QX + U T RU ) dt
T
(2.11)
0
definite Hermitian or real symmetric matrix. The matrices Q and R determine the relative
importance of the error and the expenditure of the input energy. The choice of Q and R
allows the relative weighting of individual state variables, inputs as well the control
outputs. Both Q and R are taken as a unit matrix to give equal importance to all the states.
By taking Q and R as unit matrix the values of feedback gain matrix, K, are given as
In Figure 2.8, the simulation results for FSF controller using LQR method are
shown. It has been observed that LQR controller works satisfactory for payload 1 kg. For
R e s u lts f o r L Q R c o n tr o lle r
1.4
1.2
1
Position of cart in meter
0.8
P o s i ti o n o f c a r t w i th p a y lo a d 1 k g : S o li d lin e
0.6
P o s i ti o n o f c a rt w i th p ay lo a d 0 . 1 k g : D a s h e d li n e
0.4 P o s i ti o n o f c a r t w i th p a y lo a d 1 0 k g :D o t te d lin e
0.2
0
0 5 10 15 20
Tim e in s e c
R e s u lt s f o r L Q R m eth o d
0. 2
0 .0 5
- 0 .0 5
-0 .1
- 0 .1 5
-0 .2
0 5 10 15 20
Tim e in s e c
Figure 2.8: Simulation results of the system with FSF controller (LQR method)
35
2.4.4 Swing Angle Feedback Controller
In this section, the controller has been designed based on swing angle feedback
method. To damp out the swing motion of the pendulum an extra angle feedback loop is
feedback of swing velocity into the acceleration of the cart as given in Equation (2.12)
[10] .
where ks is the feedback gain for swing angle and ζ is a desired damping ratio and
g
, ω n (= ) ,is the swing frequency of the suspended loads. In Figure 2.9 a Simulink
l
diagram of the system with swing-angle feedback controller has been shown. Substituting
Equation (2.12) into Equation (2.4) gives the controlled dynamic system as follows:
Equation (2.13) is a damped second order system and by choosing the value of k s the
damping ratio can be assigned to rapidly damp out swing to zero. The value for k s has
been calculated using the system parameter values. The value of k s is shown in Equation
(2.14).
x = k s ∫ θ dt (2.15)
This new x is added with the reference x and the result goes to the PD block. The
Simulink diagram of the system with angle feedback control is shown in Figure 2.9.
Figure 2.9: Simulink diagram of the system with swing angle feedback control
In Figure 2.10, the simulation results have been shown. It can be observed that the
Figure 2.10: Simulation results of the system with swing angle feedback controller
38
considered and a dynamic model of the system is derived. The non-linear dynamic model
A line diagram of the four-degree of freedom robotic crane system given in figure
measured in radian. The angle q1 is the rotation of the first link with respect to the fixed
axis. The angle q2 is the rotation of the second link with respect to the first link. Another
link, l, is attached at the end of the second link and it swings both in X and Y directions.
The swing-angle of link l in X and Y directions, θx and θy, are straight from sensor
(Euler’s angle) measured in radian. There are two active joints, A and B and one passive
joints C. A payload has been attached at the end of the link l. The payload swings along
The dynamic model of this system is derived based on a newly defined two-
Lagrange’s Equation.
In deriving the dynamic model of the system the following assumptions have been made:
(2) The link, l, is considered rigid and constant and has very small mass compared to
payload.
(3) The moment of inertia of payload is being neglected and is treated as a point mass.
For this four-degree of freedom system four generalized coordinates are chosen as
follows:
q1 , q2 , θ x andθ y , where q1, q2, θx and θy are defined as the first and second joint angles and
d ∂T ∂T ∂V
− + =τ (3.1)
dt ∂q& ∂q ∂q
T and V, the kinetic and potential energy of the system as defined above, and q
represents the generalized coordinate system. τ , represents the input torque. In order to
use Lagrange’s Equation, the various terms of the system are represented in terms of the
x g1 = l g1 cos( q1 ) (3.4)
y g1 = l g1 sin( q1 ) (3.5)
y m = y + l sin(θ y ) (3.9)
2 2 2 2
T = .5(l g1 q&1 + m1 v g1 + l g 2 ( q&1 + q& 2 ) 2 + m 2 v g 2 + m 3 v m ) (3.11)
2 2
The terms v g1 and v g 2 represents the velocity square of the mass center of the
2
first and second link, respectively. The term v m represents the velocity square of the
payload mass.
The velocities of the mass center of the first link in X and Y-axis have been
calculated. The square of the velocities in X and Y-axis has been added to get the
velocity square of the mass center of the first link. The steps are shown in the following
equations.
2 2 2
v g1 = l g1 q&1 (3.14)
42
The same steps have been performed for second link, l2, to calculate the velocity
square of the mass center of the second link. It is given in the following equations:
2 2 2
v g 2 = l1 q&12 + l g 2 ( q&1 + q& 2 ) 2 + 2l g 2 l1q&1 ( q&1 + q& 2 ) cos( q2 ) (3.17)
The velocity of the payload mass has been calculated in the same way and it is
given as follows:
vm = l1 q&112 + l2 (q&1 + q&2 )2 + 2q&1 (q&1 + q&2 )l1l2 cos(q2 ) + l 2θ&x cos2 θ y
2 2 2 2
(3.20)
The three velocity square terms are substituted into the kinetic energy equation,
The kinetic and potential energy terms from Equations (3.20) and (3.21) substitute
into Lagrange’s Equation, Equation (3.1). Symbolic MATLAB have been used to
compute the dynamic model of the system after computing kinetic and potential energy
terms in the Lagrange’s Equation. The nonlinear dynamic model of the system is
represented in the matrix notation. The matrix notation of the model is shown in Equation
(3.22),
where
q = [q1 q2 θ x θ y ]
T
τ = [τ 1 τ 2 0 0]T
and
The details of, F1, F2, F3, F3, F4, C1, C2, C3 and C4 are described in the MATLAB
The nonlinear dynamic model of the robotic system, given in Equation (3.22) has
(3.23)
where q is the joint coorinates [q1T,q2T]T; θ is the swing angle coordinates [θxT,θyT]Τ;
τ is the joint torque; Mr is the inertia matrix of the robot itself; Cr is the nonlinear matrix
due to centrifugal and Coriolis force without the load; M rl and M l / r are the coupling inertia
matrices; C rl and C l / r are the coupling nonlinear terms due to carrying a load; and Kl is
the swing stiffness matrix due to the gravity. Detailed description of each term can be
expressed as
− β s − β 5 s12 β 4 c1 + β 5 c12 β 0
M rl ( q ) = 4 1 Ml = 6
− β 5 s12 β 5 c12 0 β 6
45
Where
ci = cos(qi), si = sin(qi)
α1 = I 1 +m1 l g1 2+m2l12 α2 = I 2 + m2 l g 2 2
α3 = m2 l g 2 l1,
β1 = m 3 l 1 2 , β2 = m 3 l 2 2
β3 = m 3 l 1 l2 , β4 = m 3 l 1 l
β5 = m3 l2l, β6 = m 3 l 2 .
Term αi is defined to represent the dynamic parameters of the robot in a simpler form and
Mr (q) + Mp/ r (q) Mrl (q)q&& Cr (q, q&) 0 0 q τ
+ + = (3.24)
MTrl (q) Ml θ&& Cl (q, q&) 0 Kl θ 0
46
In the next section, Equation (3.24) will be used as the dynamic model of the
system to design the various controllers. To design the pole placement and LQR
controller, a linear state space dynamic model of the system is needed. The nonlinear
C ( q, q& )
term in Equation (3.24), r , has been neglected by assuming a very slow motion
Cl ( q, q& )
of the system. The velocity and acceleration of first and second link and the payload
becomes negligible for slow motion of the system. After neglecting the nonlinear term of
The constant coefficients of the four second-order differential equations have been
obtained for the nominal position of the system. The nominal position of the system is
described as follows:
Payload = 1 kg.
47
To expresses the four second-order differential equations given in Equation (3.25)
To get the numeric values of matrixes, A, B, C and D the system parameters used in
0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 0 1 0 0
A= B=
0 0 −2.75 2.75 0 0 0 0 4.19 −5.10
0 0 −6.49 6.49 0 0 0 0 −5.10 17.95
0 0 −9.02 0.85 0 0 0 0 0.23 0.552
0 0 0.85 −9.02 0 0 0 0 −.23 −0.552
1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0
C=
and
D=
0 0 1 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0
The state-space form of linear dynamic model of the two link robotic crane with
four- degree-of-freedom suspended load system will be used in the next section to design
In the last section, the dynamic model of a two-link robotic crane with a two-
dimensional suspended load has been derived. The derived nonlinear dynamic model has
been linearized with a few assumptions and expressed in a state-space form. Equations
(3.25) and (3.26) in the last section show the linear and state space form of the system. In
Chapter 2, different controllers, namely PD based on the graphical root locus method, full
state feedback based on the pole placement and LQR methods and angle feedback have
system. In this section, design of the same four controllers for a two-link robotic crane
controller under three different payload conditions, as 1 kg, 0.1 kg and 10 kg, will be
shown in simulation results. The simulation is done under the nonlinear model, although
the controllers are based on the linear model. For simulation, a third order trajectory for
discussed. Second, a third-order trajectory will be applied as a desired trajectory for the
The control objective is to determine the control inputs, such that the oscillation in
pendulum damps out as quickly as possible while joint angles q1 and q2 follow the
desired path. To control such a system is difficult. First, the number of inputs to the
system is less than the number of outputs. The system has two inputs, and four outputs,
q1, q2, qx, and qy, which must be controlled. Second, the system is nonlinear. The inertia
matrix and the nonlinear term vary as time and configuration change.
1) Settling time for the joint angles, Ts, has to be less than 8 sec.
2) Percent overshoot, P.O for the joint angles, has to be less than 10%.
3) Damping ratio for the swing angles, ζ, has to be more than 0.5.
In this section, the design of the four controllers for the dynamic system derived in
4.2.1 PD Controller
A PD controller has been designed using the graphical root locus method [14]. This
design methodology allows choosing the unique set of values of proportional and
derivative constants (Kp and Kd) to maximize the performance of the single input single
output (SISO) system. As mentioned in Section (4.1), the two-link robotic crane system
has two inputs and four outputs. Considering the system is decoupled, a separate PD
controller has been designed for each link. The torque ς1 has been controlled for the first
link, l1, and torque ς2 has been controlled for the second link, l2.
An iterative root locus method has been used for each link to get the value of the
constants. The values of constants for the first link are given as follows:
Kp1= 21
Kd1=1.8
52
The values of constants for the second link are given as follows:
Kp2= 15
Kd2=1
Figure (4.1) shows the simulation diagram of the system with PD control.
In this section, the design of the full state feedback controller using the pole
placement method will be presented. It is observed that the open-loop two-link robotic
crane system is marginally stable. It can also been observed that the open loop system is
fully controllable. To choose the desired pole location, the ITAE method has been used.
A 6th order polynomial has been used to choose the desired pole position. The polynomial
S6+3.25 ωn. S5+6.6 ωn2. S4+8.6 ωn3. S3+7.45 ωn4. S2+3.95 ωn5. S+ ωn6 =0 (4.1)
The value, ωn, has been selected as .415 to satisfy the desired control objective as given
in section (4.1).
Using Ackerman’s formula, the state feedback gain matrix (APPENDIX B) has been
calculated as follows:
The simulation diagram of the system with full state feedback controller is shown in
Figure 4.2.
In this section, a full-state feedback controller has been designed using an optimal
Linear Quadratic Regulator (LQR) method ([11] Page 841-844, [12]). In LQR method,
the state feedback matrix is calculated by minimizing the performance index, J, as given
in Equation (4.2).
∞
J = ∫(X QX + U T RU ) dt
T
(4.2)
0
The matrix Q and R are the weighting matrices. The choice of Q and R allows the relative
weighting of individual state variables. No standard method has been followed to choose
the Q and R matrix for this system. Instead, the simulation has been performed using
different values of Q and R matrix, and the values of Q and R matrix are chosen based on
the simulation performances. The Q and R matrix that have been used finally are given as
follows:
15 0 0 0 0 0 0 0
0 12 0 0 0 0 0 0
0 0 10 0 0 0 0 0
0 0 0 10 0 0 0 0
Q = 1 0
0 0 0 0 5 0 0 0 R=
0 0 0 0 0 5 0 0 0 1
0 0 0 0 0 0 5 0
0 0 0 0 0 0 0 5
56
The feedback gain matrix, K, have been calculated using the above Q and R matrix. The
MATLAB function “are” has been used to solve the Algebraic Riccati Equation and the
The simulation diagram of the system with the full-state feedback control has been given
in Figure (4.2). While using the LQR method, the same diagram has been used with the
above K values.
A swing-angle feedback controller has been described in this section. In this method
additional feedbacks loop being used with a PD controller. The PD controller controls the
motion of tip position of the two-arm manipulator. The desired tip position movement is
to move from a specific point ‘1’ to point ‘2’in X-Y plane. The desired tip position of the
Controlling the torque of the motors at each joint controls the two-joint angles.
In the swing-angle feedback method, an additional loop has been added to the PD
controller to take care of the load oscillation. The additional loop is designed by
57
implementing a feedback of load oscillation velocity into the acceleration of the tip
X&& K 1 0 θ&x
&& = 0
K 2 θ& y
(4.3)
Y
where X and Y axis of the tip position of the robot and K1 = K 2 =2lζωn , l is the length of
In order to implement Equation (4.3), the dynamics relation between tip position,
namely X- axis and Y-axis position, and the load oscillation, namely θx and θy, is derived.
Lagrange’s equation is used to derive the coupling dynamics. Considering the small
swing angles the linear system dynamics has been given as follows:
The last two equations of Equation (4.4) are two decoupled equations separately
representing the relationship between the X coordinate of the tip position and the load
oscillation in X direction and Y coordinate of the tip position and load oscillation in Y
58
direction. Substituting Equation (4.3) in those equations gives the controlled dynamic
system as follows:
g
θ&&x + 2ζwnθ&x + θ =0 (4.5)
l
Equations (4.5) and (4.6) are damped second order system and by adequately
choosing the value of K1 and K2, the damping ratio, ζ, can be assigned to rapidly damp out
Equations (4.5) and (4.6) are independent of the payload. This makes the swing
angle feedback control robust under various payload conditions. In this method, by
adding an additional loop a decision has been made using the feedback of payload
oscillation.
59
Figure (4.3) shows the Simulink diagram of the system with the swing angle feedback
controller.
Figure 4.3: Simulink diagram of the system with the swing angle feedback controller
In this section, a third-order polynomial trajectory has been calculated and used as
the desired trajectory of the system to perform the simulation. The simulation results
using each controller under various payload conditions have been shown.
The desired path in the X-Y plane for the tip position of the two-link robot is
given below:
The desired tip position has been converted to desired joint angles using inverse
kinematics [13]. The simulation results have been performed under various payloads
Figures (4.4), (4.5), (4.6) and (4.7) represent the simulation results using PD
controller. It can be observed that although the tip position has been controlled
satisfactorily using PD controller but the swing angle of the payload doesn’t damp out
satisfactorily.
Figure (4.8), (4.9), (4.10) and (4.11) represent the simulation results for full state
feedback control using pole placement method. In this case only two payload conditions
have been performed as it is observed that the system becomes unstable for payload 10
kg.
Figures (4.12), (4.13), (4.14) and (4.15) represent the simulation results for full state
feedback control using LQR method. Figures (4.16), (4.17), (4.18) and (4.19) represent
Figure 4.6: First joint angle q1 under various payloads using PD controller
Figure 4.7: Second joint angle q2 under various payloads using PD controller
63
Figure 4.8: X-axis oscillation under various payloads using FSF control (PPM)
Figure 4.9: Y-axis oscillation under various payloads using FSF control (PPM)
64
Figure 4.10: Joint angle q1 under various payloads using FSF control (PPM)
Figure 4.11: Joint angle q2 under various payloads using FSF control (PPM)
65
Figure 4.12: X-axis oscillation under various payloads using FSF control (LQR)
Figure 4.13:Y-axis oscillation under various payloads using FSF control (LQR)
66
Figure 4.14: Joint angle q1 under various payloads using FSF control (LQR)
Figure 4.15: Joint angle q2 under various payloads using FSF control (LQR)
67
Figure 4.16: X-axis oscillation under various payloads using SAF controller
Figure 4.17: Y-axis oscillation under various payloads using SAF controller
68
Figure 4.18: Joint angle q1 under various payloads using SAF control
Figure 4.19 Joint angle q2 under various payloads using SAF control
69
An experimental study was performed with the test bed located in the Mechanical
Engineering Laboratory 015, Stocker Center, Ohio University. The system is a two-
This chapter describes the test bed setup, model verification, and experimental results
5.1.1 Hardware
The test bed is shown in Figure 5.1. It consists of one fixed rigid link, two moving
rigid links and a pendulum at the end of the second moving link. The first and second
moving links connect with the fixed link and first moving link respectively. Both joints
are rotational joints powered by DC motors. These joints are called active joints. The
pendulum attaches at the end of the second link by two pin joints. It allows the pendulum
to swing both in the X and Y directions. Two encoders are attached at each pin joint to
The manipulator consists of two 0.285m- long metal links and two DC motors.
Each DC motor is s PITTMAN GM9000 Series with 19.7:1 gear ratio and equipped with
an optical encoder at the motor side to measure absolute joint angles. The encoder is an
5.1.2 Software
A MultiQ board with a Pentium 233 Computer controls the test bed. The sampling
rate is chosen at 500 Hz. The D/A converter of MultiQ board converts the digital to
analog (D/A) by a 12-bit unsigned binary. An input of –5 volts maps zero and +5 volts
maps to 212-1=4095. The encoder data is decoded in the MultiQ board in quadrature and
joint displacements and sent through a D/A board to the amplifiers, which drive the
motors of the joints. MATLAB/Simulink are used to write the program, and WinCon ver
3.2 is used for conversion to C language and communication with the MultiQ board.
The data flow in the system is shown in the block diagram in Figure 5.2. The
computer, using different controllers calculates the input torques, τ1 and τ2. The inputs to
the computer are the encoder values of the joint angles q1 and q2 and swing angles of the
payload, θx and θy. A D/A converter converts the input torques. The converted torques,
τ1D/A and τ2D/A are proportional to the input torques by the following relation:
(5volts ) − (−5volts )
KD / A = = 0.00244volts
212
72
The actual torques applied to the motors, τ1m and τ2m are proportional to the
converted torque, τ1D/A and τ2D/A respectively. The proportional factor for this case is Kt
which is the torque constant of the motor. The DC motor in the experiment has a torque
constant, Kt= .04585 N. m; hence, the relationship between the input torques and the
The encoder data from the encoder has been converted. The encoders attached on
the motor with a 19.7:1 gear ratio, have 500 CPR and the encoder data is decoded in
quadrature. Hence, the conversion factor for the encoder of the motor has been calculated
as:
1 1
K encodermotor = .(2πrad ). = 1.595 × 10− 4
4 (500CRV ).19.7
The conversion factor of the encoders for the swing motion of the payload has been
calculated as
1 1
K encodermotor = .(2πrad ). = 3.1415 × 10−3
4 (500CRV )
73
The conversion factors are needed for a comparison between the simulation results
Before applying the various controllers on the test bed, model verification has been
performed. Model verification has been performed in order to validate the derived
dynamic model of the system. For the same input to the system, the outputs from the
for the tip position of the robotic arm. The trajectory is defined in terms of the X and Y-
axis positions taking the first joints as (0, 0) position. The trajectory starts at (0.57, 0)
goes to position (0 .45, -0.33) in 5 seconds, waits in that position for 5 seconds and then
goes to the final position (0.45, 0.33) in 7 seconds. A forward kinematics ([13]) block is
used to calculate the desired joint angles, q1, q2, in order to follow the desired trajectory.
This desired trajectory has been used as the reference path for both the dynamic model
and the test bed. Second, separate PD controllers are used for each joint. The Kp and Kd
value chosen for first PD controller are Kp= 12, Kd= 1.2 and for the second PD controller
are Kp=7, Kd= 0.8. The same PD controller is used for dynamic model and the test bed.
Figure 5.3 shows the Simulink diagram for the model verification. It can be observed
from Figure 5.3 that the two joint angles are compared.
75
Figure 5.4 (a) shows the comparison of first joint angle from the dynamic model
and the test bed. Figure 5.4 (b) shows the comparison of the second joint angle from the
dynamic model and the test bed. It can observe from the two figures that the dynamic
model outputs are reasonably close to the actual test bed output. This validates the
derived dynamic model of the system. In the next section, the experimental results with
In this section the experimental results are shown. The following results are
shown:
The same desired trajectory has been used in the experiments as used for the model
verification. The values of Kp, Kd are also kept the same. The Simulink diagram is shown
in Figure 5.5.
It can be observed from Figure 5.5 that the integrator block for the angle feedback
loop has been removed. During the experiments it has been found that the system
performs better without the integrator block. This makes the angle feedback loop a simple
The experimental results with a payload of 1 kg are shown in Figures 5.6, 5.7, 5.8,
5.9 and 5.10. In Figures 5.6(a) and (b) it can be observed that the swing motion of the
payload damp out better with angle feedback than with the PD controller. Figures 5.7 and
5.8 compare the actual and desired first joint-angle position with PD controller and angle
feedback controller respectively. It is observed that the actual first joint angle follows the
desired path satisfactorily with both controllers. Figure 5.9 and Figure 5.10 compares the
actual and desired second joint-angle position with the PD controller and angle feedback
controller, respectively.
Figures 5.11, 5.12, 5.13, 5.14 and 5.15 show the experimental results for a payload
of 2.3kg. To increase the payload, an extra load of 1.3 kg has been attached at the end on
the pendulum link. The experimental results show that the angle feedback controller
works satisfactorily under different payloads as well. In Figures 5.11(a) and (b), the
comparisons of swing angle with the PD and with angle feedback controller have been
shown. Figures 5.12 and 5.13 compare the desired and actual first joint-angle with two
controllers. Figures 5.14 and 5.15 compare the desired and actual second joint-angle with
two controllers.
79
Figure 5.6(a): X-axis oscillation for payload 1kg with SAF and PD controller
Figure 5.6(b): Y-axis oscillation for payload 1kg with SAF and PD controller
80
Figure 5.7: Comparison of joint angle q1 with PD control for payload 1kg
Figure 5.8: Comparison of joint angle q1 with SAF controller for payload 1 kg
81
Figure 5.9: Comparison of joint angle q2 with PD control for payload 1kg
Figure 5.10: Comparison of joint angle q2 with SAF controller for payload 1kg
82
Figure 5.11 (a): X-axis oscillation for payload 2.3 kg with SAF and PD controller
Figure 5.11 (b): Y-axis oscillation for payload 2.3 kg with SAF and PD controller
83
Figure 5.12: Comparison of joint angle q1 with PD control for payload 2.3 kg
Figure 5.13: Comparison of joint angle q1 with SAF controller for payload 2.3 kg
84
Figure 5.14: Comparison of joint angle q2 with PD control for payload 2.3 kg
Figure 5.15: Comparison of joint angle q2 with SAF controller for payload 2.3 kg
85
CHAPTER 6: CONCLUSION
6.1 Conclusion
To reduce the anti-swing motion of the crane system under various payloads, four
different controllers have been designed and simulated. The four controllers are as
follows:
has been derived using Lagrange’s Equation. Simulation results using all the four
controllers under various payloads have been performed. Their results have been
The PD control of the tip position of the two-link robotic crane has limitations in
reducing the swing motion of the payloads. The maximum damping by the PD control
has been determined using an iterative graphical root locus analysis. The maximum
damping by the PD control is not sufficient enough to get a desired system response.
The full state feedback controller can be designed only for the linear model. The
dynamic model derived for the system has been linearized and then pole placement and
the LQR controller have been derived. The simulation results show that with the pole
placement controller the system becomes unstable for payload 10kg. The LQR controller
also fails to perform satisfactorily under different payloads. This implies poor robustness.
The swing-angle feedback controller with the PD controller is able to damp out the
swing motion in the payloads. It also performs satisfactorily under different payloads.
The PD and angle feedback controller have been implemented experimentally and the
experiment results resemble the simulation results (Figure 5.4 (a) and (b)). The
6.2 Contribution
1) The overall dynamic model of the two link robotic crane with a two-degree-of-
freedom swing system has been derived. The derived dynamic model has been
3) The swing angle feedback controller has been proposed after analyzing the other
controllers.
4) The proposed control method has been implemented on the Ohio University test
1) Experiments were performed with a PD and swing angle feedback controller. The
results of the two controllers have been presented. Experiments with the advanced
2) The encoder was used to measure the swing motion of the payload. It was not
accurate enough to get high resolution. A more accurate sensor or other sensor
3) Mechanical improvement of the robot is suggested for better results. Due to the
slip in the active joints accurate results couldn’t be obtained. The controller might
4) To handle the different payloads, a robust controller can be designed using the H∞
method.
89
Reference
[1] Yoon,J.S.,el, Various Control Schemes for Implementation of the Anti-Swing Crane.
[2] Noakes, M. W., R.L. Kress, and G.T. Appleton. Implementation of Damped-
Oscillation Crane Control for Existing AC induction Motor-Driven Cranes. in ANS Fifth
[3] Parker, G.G.,et al. Experimental Verification of a Command Shaping Boom Crane
[5] John T. Wen, Dan O. Popa, Gustavo Montemyor and Perter L. Liu, Human Assisted
[6] Chi-Cheng Cheng and Cheng-Yi-Chen, Controller Design for an Overhead Crane
system with Uncertainty, Control Eng. Practice , vol .4,no. 5, pp. 645-653, 1996
Neural Self-Tuning Controller to an Overhead Crane, Neural Comput & Applic 1999.
[8] M. Mahfouf, C. H. Kee, M. .F. Abbod and D. A Linkens, Fuzzy Logic-Based Anti-
swing Control Design for Overhead cranes, Neural Comput & Applic 2000.
[9] A. Benhidjep and G.L. Gissinger, Fuzzy Control of an Overhead Crane Performance
Comparison with Classic Control, Pergamon, Control Eng. Practice, vol. 3. No. 12, pp.
1687-1696, 1995
90
[10] Ji Sup Yoon, Byung Suk, Various Control Schemes for Implementation of the Anti-
[13] John J. Craig. Introduction to Robotics Mechanics and Control, second edition.
[14] Richard C. Dorf and Robert H. Bishop. Modern Control Systems, eighth edition.
91
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FILENAME: Dynamic model
% WRITTEN BY: Bibhrajit Halder
% Ohio university
%
% COMMENTS ON CODE STRUCTURE: This derive the dynamic model of the four
degree of freedom robotic crane
% sytem in sybolic and numeric output.
%
%
%
% ORIGINAL DATE WRITTEN: 17 JULY 2001 - Ohio University
% DATE OF LAST MODIFICATION: 26 JULY 2001
%
%
%
%
%%%%%%%%%%%%%%%%% START OF CODE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc;
clear;
syms l1 l2 l3 m1 m2 m3 lg1 lg2 g1 g2 q1 q2 qx qy dq1 dq2 dqx dqy g ddq1 ddq2 ddqx
ddqy x1 x2 x3 x4 x5 x6 x7 x8 T11 o1 o2
vg2_s=(l1*l1)*(dq1*dq1)+(lg2*lg2)*(dq1+dq2).^2+2*lg2*l1*dq1*(dq1+dq2)*cos(q2);
v3_s=l1.^2*dq1.^2+l2.^2*(dq1+dq2).^2+2*dq1*(dq1+dq2)*l1*l2*cos(q2)+l3.^2*dqy.^2
+l3.^2*dqx.^2*(cos(qy)).^2
-2*l3*l1*dq1*dqx*sin(q1)*cos(qx)*cos(qy)+ 2*l3*l1*dq1*dqy*sin(q1)*sin(qx)*sin(qy)
-
2*l3*l2*(dq1+dq2)*dqx*sin(q1+q2)*cos(qx)*cos(qy)+2*l3*l2*(dq1+dq2)*dqy*sin(q1+
q2)*sin(qx)*sin(qy)
+2*l3*l1*dq1*dqy*cos(q1)*cos(qy)+2*l3*l2*(dq1+dq2)*dqy*cos(q1+q2)*cos(qy);
92
%Potential Energy%
V=m3*g*l3*(1-cos(qx)*cos(qy));
%Kinetic Energy%
T=.5*(g1*(dq1.^2)+m1*vg1_s+g2*(dq1+dq2)^2+m2*vg2_s+m3*v3_s);
t1=diff(T,q1);
t2=diff(T,q2);
t3=diff(T,qx);
t4=diff(T,qy);
v1=diff(V,q1);
v2=diff(V,q2);
v3=diff(V,qx);
v4=diff(V,qy);
L=T-V;
%For q1%
a1=diff(T,dq1);
a11=diff(a1,dq1);
a12=diff(a1,dq2);
a13=diff(a1,dqx);
a14=diff(a1,dqy);
f11=simple(a11);
f12=simple(a12);
f13=simple(a13);
f14=simple(a14);
b11=diff(a1,q1);
b12=diff(a1,q2);
b13=diff(a1,qx);
b14=diff(a1,qy);
g11=simple(b11);
g12=simple(b12);
g13=simple(b13);
g14=simple(b14);
% for q2%
a2=diff(T,dq2);
a21=diff(a2,dq1);
a22=diff(a2,dq2);
a23=diff(a2,dqx);
a24=diff(a2,dqy);
f21=simple(a21);
f22=simple(a22);
f23=simple(a23);
f24=simple(a24);
b21=diff(a2,q1);
93
b22=diff(a2,q2);
b23=diff(a2,qx);
b24=diff(a2,qy);
g21=simple(b21);
g22=simple(b22);
g23=simple(b23);
g24=simple(b24);
% for qx
a3=diff(T,dqx);
a31=diff(a3,dq1);
a32=diff(a3,dq2);
a33=diff(a3,dqx);
a34=diff(a3,dqy);
f31=simple(a31);
f32=simple(a32);
f33=simple(a33);
f34=simple(a34);
b31=diff(a3,q1);
b32=diff(a3,q2);
b33=diff(a3,qx);
b34=diff(a3,qy);
g31=simple(b31);
g32=simple(b32);
g33=simple(b33);
g34=simple(b34);
%for qy
a4=diff(T,dqy);
a41=diff(a4,dq1);
a42=diff(a4,dq2);
a43=diff(a4,dqx);
a44=diff(a4,dqy);
f41=simple(a41);
f42=simple(a42);
f43=simple(a43);
f44=simple(a44);
b41=diff(a4,q1);
b42=diff(a4,q2);
b43=diff(a4,qx);
94
b44=diff(a4,qy);
g41=simple(b41);
g42=simple(b42);
g43=simple(b43);
g44=simple(b44);
% The M matrix is
%The C matrix%
C=[C1;C2;C3;C4];
% The G matrix
G=[v1;v2;v3;v4];
ms1=-inv(Ms);
fn=ms1*(csl+Gs);
fn1=inv(Ms)*T11;
q1=sym('x(1)');q2=sym('x(2)');qx=sym('x(3)');qy=sym('x(4)');dq1=sym('x(5)');dq2=sym('
x(6)');dqx=sym('x(7)');dqy=sym('x(8)');
fn4=subs(fn1)
96
APPENDIX B: MATLAB file for controller
% Ohio university
% robotic crane system, with two torque as the control inputs. The four outputs are two
motor angle
% MODIFICATION HISTORY:
0;0 0 -6.4917 6.4917 0 0 0 0;0 0 -9.0216 .8549 0 0 0 0;0 0 .8549 -9.0216 0 0 0 0];
p=ctrb(a,b);
rankp=rank(p);
q=obsv(a,c);
rankq=rank(q);
poles=eig(a)
disp('As all the poles are non-negative, but there are two zero poles so the system are
merginaly stable')
wn=3.2;
num=wn^6;
g=tf(num,den);
des9=pole(g)
des1=[des9' -4 -4.3]
98
k1=place(a,b,des1)
a1=a-b*k1;
poles=eig(a1)
t=[0:.1:20];
u= [ones(size(t))'];
step(a,b,c,d);
[y,x]=lsim(a,b,c,d,u,t);
figure;
%input correction%
r1=-pinv(b)*a1*[.8;1.6;0;0;0;0;0;0]*u';
r2=-pinv(b)*a1
[Y,X]=lsim(a1,b,c,d,r1,t);
plot(t,Y)
99
%Finding K matrix using LQR method%
bb=b*b';
[k2,s2,e2] =lqr(a,b,Q,R)
%q=are(a,bb,eye(8,8));
% LQR simulation%
[y1,x1]=lsim(a2,b,c,d,r5,t);
hold on;
plot(t,y1)
zoom;