eml6934_ramin_shamshiri_project1_part1

24
1 Ramin Shamshiri EML 6934, Nonlinear control systems EML 6934, Nonlinear Control Systems Final project Spring 2010 Instructor: Dr. W. Dixon Tracking Control of a Robot Manipulator with uncertainties and disturbances RAMIN SHAMSHIRI UFID#: 9021-3353 Due: 05.April.2010

Upload: raminshamshiri

Post on 16-Apr-2015

4 views

Category:

Documents


1 download

DESCRIPTION

EML6934_Ramin_Shamshiri_Project1_Part1

TRANSCRIPT

Page 1: EML6934_Ramin_Shamshiri_Project1_Part1

1 Ramin Shamshiri EML 6934, Nonlinear control systems

EML 6934, Nonlinear Control Systems

Final project

Spring 2010

Instructor: Dr. W. Dixon

Tracking Control of a Robot Manipulator

with uncertainties and disturbances

RAMIN SHAMSHIRI

UFID#: 9021-3353

Due: 05.April.2010

Page 2: EML6934_Ramin_Shamshiri_Project1_Part1

2 Ramin Shamshiri EML 6934, Nonlinear control systems

I. Problem Overview

The objective of this project was to design and

simulate the performance of a tracking controller for

a two-link robot manipulator shown in Fig. 1, with

uncertain system parameters, and in the presence of

bounded disturbances.

Figure 1. Two link robot setup

II. Dynamic Model

The dynamics associated with the two-link robot are

given by (1),

𝜏1

𝜏1 =

𝑝1 + 2𝑝3𝑐2 𝑝2 + 𝑝3𝑐2

𝑝2 + 𝑝3𝑐2 𝑝2 π‘ž 1π‘ž 2

+ βˆ’π‘3𝑠2π‘ž 2 βˆ’π‘3𝑠2 π‘ž 1 + π‘ž 2

𝑝3𝑠2π‘ž 1 0 π‘ž 1π‘ž 2

+ 𝑓𝑑1 00 𝑓𝑑2

π‘ž 1π‘ž 2 +

π‘ž 1π‘ž 2

(1)

where 𝑝1 = 3.473 π‘˜π‘”.π‘š2 , 𝑝2 = 0.196 π‘˜π‘”.π‘š2 ,

𝑝3 = 0.242 π‘˜π‘”.π‘š2 , 𝑓𝑑1 = 5.3 π‘π‘š. 𝑠𝑒𝑐 , 𝑓𝑑2 =1.1 π‘π‘š. 𝑠𝑒𝑐 , π‘ž1 , π‘ž2 denotes the angular position of

the robot links, 𝑐2 = cos(π‘ž2), 𝑠2 = sin(π‘ž2), 𝜏1 and

𝜏2 represents torque control inputs.

The Euclidean position of the endpoints of the second

robot link is denoted by π‘₯ β‰œ [π‘₯1 π‘₯2] which is

related to the joint space through the following

kinematic relationship

π‘₯ = 𝐽 π‘ž π‘ž (2)

Where the manipulator Jacobian 𝐽 π‘ž ∈ ℝ2Γ—2 is

given by (3)

𝐽 π‘ž =

βˆ’π‘™1 sin π‘ž1 βˆ’ 𝑙2 sin π‘ž1 + π‘ž2 βˆ’π‘™2 sin π‘ž1 + π‘ž2

βˆ’π‘™1 cos π‘ž1 + 𝑙2 cos π‘ž1 + π‘ž2 𝑙2 cos π‘ž1 + π‘ž2

(3)

The link lengths 𝑙1 , 𝑙2 of the robot are selected as

𝑙1 = 𝑙2 = 0.5π‘š

III. Control Objective

To design tracking controllers for the following two

tasks;

1. The robot tracks the desired joint space trajectory

given by

π‘žπ‘‘ = cos 𝑑 cos 𝑑 𝑇 (4)

2. The robot tracks the desired task space trajectory

given by

π‘₯𝑑 = 0.5sin 𝑑 1 𝑇 (5)

Assume that the system parameters 𝑝1 , 𝑝2 , 𝑝3 , 𝑓𝑑1,𝑓𝑑2 are unknown bounded positive constants (except

for the EMK case where these constants are exactly

known). Design and implement the following

controllers to achieve the control objective:

1. Exact Model Knowledge (EMK) controller.

2. Adaptive controller.

3. Sliding mode controller.

4. High gain controller.

In each case, comment on how the bounded

disturbance πœπ‘‘ = 2 sin 𝑑 0.5 sin 𝑑 𝑇 affects the

stability of the system.

Page 3: EML6934_Ramin_Shamshiri_Project1_Part1

3 Ramin Shamshiri EML 6934, Nonlinear control systems

IV. Project Report

Abstract

The objective of this project was to design and

simulate a tracking controller to track a desired

trajectory given by π‘žπ‘‘ = π‘π‘œπ‘  𝑑 π‘π‘œπ‘  𝑑 𝑇 for a

two-link robot manipulator with uncertain system

parameters, and in the absence and presence of

bounded disturbances. Four different controllers

were designed for the manipulator in the presence of

uncertain system parameters (except the EMK

controller, where the system is exactly described).

Simulation of the controllers and manipulator were

done in MATLAB SIMULINK and adaptive estimates

(where necessary) obtained. The Lyapunov stability

analysis for each controller was performed. Finally,

the controllers were compared against each other

based on their performance and control effort.

Report summary

The exact model knowledge controller showed the

best stability result (GES), compared with all other

controllers. It also had low control effort. In this

approach, all the nonlinearities that exist in the

system are known exactly, thus we used feedback

linearization to cancel them. The problem with this

design is that we can never model a physical system

perfectly to have exact knowledge of the system

parameters. In addition to that, when disturbances are

introduced in the system, the controller will lose its

perfect performance and result in a globally

uniformly ultimately bounded stability. In summary,

while EMK controller might be easy to implement, it

is not the best design option for real nonlinear

systems.

The designed adaptive controller yielded a globally

asymptotically stability which means errors go to

zero asymptotically. In this design, in order to

improve performance, we need to tune the gains to

ensure that the control torques are within the actuator

limits while maintaining a good tracking

performance. Using high gain would come at the cost

of increasing control effort, however it also ensure

that any error estimate of the parameters will be

compensated. Simulation result showed that the

adaptive controller is more efficient especially in the

presence of disturbances, which a globally

exponentially stability result was concluded.

In the sliding mode controller (SMC) design, the

controller provides fast switching action to cancel the

nonlinearities and disturbances in the system. This

design gave a globally exponentially stability result,

however this comes at a high control effort and

require an actuator to switch infinitely fast in time

which makes it almost impossible to implement in

reality. Because of the discontinuous nature of this

controller, tuning of gains is almost useless to archive

GES result, which theoretically should have been the

case.

The high gain controller gave uniformly ultimately

bounded stability result in the presence of uncertain

model dynamics and bounded disturbances. While

EMK controllers cannot handle disturbances at all

and Adaptive controllers give a GAS result, high gain

controllers crush the uncertainties at the cost of high

control effort. Perhaps one advantage of this design

was the easiness of the control implementation and

gain tuning.

Page 4: EML6934_Ramin_Shamshiri_Project1_Part1

4 Ramin Shamshiri EML 6934, Nonlinear control systems

4.1. Description of the dynamic model

The dynamics of the two-link robot given in (1) can

be written as

𝑀(π‘ž)π‘ž + π‘‰π‘š (π‘ž, π‘ž )π‘ž + π‘“π‘‘π‘ž + πœπ‘‘(𝑑) = 𝜏 (6)

Where 𝑀 ∈ ℝ2Γ—2 is the inertia matrix, π‘‰π‘š ∈ ℝ2Γ—2

denotes the centripetal-Coriolis matrix, 𝑓𝑑 ∈ ℝ2

denotes friction, πœπ‘‘(𝑑) is a general nonlinear

bounded disturbance modeled as

πœπ‘‘ = 2sin 𝑑 0.5sin 𝑑 𝑇 , 𝜏(𝑑) represents the

torque input control vector and π‘ž 𝑑 , π‘ž 𝑑 , π‘ž 𝑑 denote the link position, velocity, and acceleration

vectors, respectively. 4.2. Development of the error system

We define a position tracking error (7) and filtered

tracking error (8) as follow:

𝑒 = π‘ž βˆ’ π‘žπ‘‘ (7)

π‘Ÿ = 𝑒 + 𝛼𝑒 (8)

where 𝛼 is a positive diagonal gain matrix.

Differentiation (8) with respect to time and

multiplying by 𝑀 yields the open loop error system

as given in (9):

π‘€π‘Ÿ = 𝑀𝑒 + 𝑀𝛼𝑒

= π‘€π‘ž βˆ’ π‘€π‘ž 𝑑 + 𝑀𝛼𝑒 (9)

Substituting for π‘€π‘ž using the dynamic in (6):

π‘€π‘Ÿ = βˆ’π‘‰π‘š π‘ž, π‘ž π‘ž βˆ’ π‘“π‘‘π‘ž βˆ’ πœπ‘‘ 𝑑 + 𝜏 βˆ’ π‘€π‘ž 𝑑

+ 𝑀𝛼𝑒 (10)

Substituting for π‘ž using time differentiation of (7)

and (8):

π‘€π‘Ÿ = βˆ’π‘‰π‘šπ‘ž 𝑑 + π‘‰π‘šπ›Όπ‘’ βˆ’ π‘‰π‘šπ‘Ÿ βˆ’ π‘“π‘‘π‘ž βˆ’ π‘€π‘ž 𝑑

βˆ’ πœπ‘‘ 𝑑 + 𝜏 + 𝑀𝛼𝑒 (11)

We can write (11) in the following form:

π‘€π‘Ÿ = π‘Œπœƒ βˆ’ π‘‰π‘šπ‘Ÿ βˆ’ πœπ‘‘ 𝑑 + 𝜏 (12)

where π‘Œπœƒ = βˆ’π‘‰π‘šπ‘ž 𝑑 + π‘‰π‘šπ›Όπ‘’ βˆ’ π‘“π‘‘π‘ž βˆ’ π‘€π‘ž 𝑑 + 𝑀𝛼𝑒 . The controllers will be designed based on the open

loop error system given in (12).

4.3. Assumptions

The development of the controllers is based on the

following assumptions:

o q(t) and q (t) are measurable.

o M q , Vm q, q , 𝑓𝑑 and Ο„d (t) are unknown.

o q, q , q d and q d exists and ∈ L∞ .

o Ο„d , Ο„ d , Ο„ d ∈ L∞

4.4. Properties

o The inertia matrix 𝑀(π‘ž) is symmetric and

positive definite (PD) and satisfies the following

inequality βˆ€y t ∈ ℝn :

π‘š1 𝑦 2 ≀ 𝑦𝑇𝑀 π‘ž 𝑦 ≀ π‘š π‘ž 𝑦 2 (13.1)

where m1 ∈ ℝ is a known positive constant, m q βˆˆβ„ is a known positive function, and . denotes the

standard Euclidean norm.

o If q t , q (t) ∈ L∞ , then the first and second

partial derivative of the elements of M q and

Vm q, q with respect to q and the first and

second partial derivative of the elements

Vm q, q and fd with respect to q exist and are

bounded.

o The time derivative of the inertia matrix and the

centripetal Coriolis matrix satisfy the following

skew symmetric relationship

πœ‰π‘‡ 1

2𝑀 π‘ž βˆ’ π‘‰π‘š π‘ž, π‘ž πœ‰ = 0 βˆ€πœ‰ ∈ ℝ𝑛 (13.2)

Page 5: EML6934_Ramin_Shamshiri_Project1_Part1

5 Ramin Shamshiri EML 6934, Nonlinear control systems

4.5. Exact Model knowledge (EMK) controller

4.5.1. Controller design

Assuming to have exact knowledge about dynamic of

the system, we design a controller to cancel all the

nonlinearities in the system, thus the external

disturbance will be the only term left undefined. To

this purpose, using the dynamic in (12), the control

torque is designed such that 𝑒 β†’ 0,

𝜏 = βˆ’π‘Œπœƒβ€”πΎπ‘Ÿ (14)

where K is the control gain constant matrix (K > 0).

Substituting this torque in the dynamic yields the

closed loop error system as follow:

π‘€π‘Ÿ = βˆ’π‘‰π‘šπ‘Ÿ βˆ’ πΎπ‘Ÿ βˆ’ πœπ‘‘ (15)

4.5.2. Lyapunov stability analysis

Considering a PD, continuously differentiable

candidate Lyapunov function as

𝑉 =1

2π‘Ÿπ‘‡π‘€π‘Ÿ (16)

and differentiating it with respect to time,

𝑉 =1

2π‘Ÿπ‘‡π‘€ π‘Ÿ + π‘Ÿπ‘‡π‘€π‘Ÿ (17)

Substituting the expression for π‘€π‘Ÿ into (17);

𝑉 =1

2π‘Ÿπ‘‡π‘€ π‘Ÿ + π‘Ÿπ‘‡(βˆ’π‘‰π‘šπ‘Ÿ βˆ’ πΎπ‘Ÿ βˆ’ πœπ‘‘) (18)

Using the property, πœ‰π‘‡ 1

2𝑀 π‘ž βˆ’ Vm q, q πœ‰ = 0,

where πœ‰ = π‘Ÿ in this case, we can simplify and write

(18) as follow:

𝑉 =1

2π‘Ÿπ‘‡π‘€ π‘Ÿ βˆ’ π‘Ÿπ‘‡π‘‰π‘šπ‘Ÿ βˆ’ π‘Ÿπ‘‡πΎπ‘Ÿ βˆ’ π‘Ÿπ‘‡πœπ‘‘

= βˆ’π‘Ÿπ‘‡(πΎπ‘Ÿ + πœπ‘‘)

(19)

Now, we can upper bound 𝑉 as:

𝑉 ≀ βˆ’ K π‘Ÿ 2 βˆ’ π‘ŸTπœπ‘‘ (20)

In the absence of disturbances ( πœπ‘‘ = 0 ), the

inequality in (20) will reduce to:

𝑉 ≀ βˆ’ K π‘Ÿ 2 (21)

Using the expression for V In (16), we can write (21)

as the following differential equation;

𝑉 ≀ βˆ’ 2K𝑉 (22)

which has the solution of the form

𝑉 𝑑 ≀ 𝑉 0 𝑒π‘₯𝑝 βˆ’2𝐾𝑑

πœ†π‘šπ‘Žπ‘₯ 𝑀 (23)

From (23), we can conclude that the system is

Globally exponentially stable (GES) using this

controller. It can be observed that 𝑉 𝑑 exponentially

goes to zero and is ∈ 𝐿∞ , also π‘Ÿ and 𝑒

exponentially go to zero and are ∈ 𝐿∞ . Since π‘Œπœƒ is a

function of 𝑒 and π‘Ÿ , it is also ∈ 𝐿∞ , therefore the

control input torque (𝜏) is also ∈ 𝐿∞ .

In the presence of disturbances (πœπ‘‘ β‰  0), we can

upper bound 𝑉 in (20) by

𝑉 𝑑 ≀ βˆ’ K π‘Ÿ 2βˆ’ 𝑐 π‘Ÿ (24)

where c is a positive constant such that Ο„d ≀ c. In

this case, we can conclude a Globally uniformly

ultimately bounded (GUUB) stability result where

the ultimate bound is given by π‘Ÿ =𝑐

𝐾.

4.5.3. Simulation

The performance of the designed EMK controller

was simulated in MATLAB in the presence and

absence of external disturbance (Figure 2 and 3). The

corresponding error and torque plots are shown in

Figure 4 through 7.

Figure 2. Error plots, EMK controller without

external disturbances

Page 6: EML6934_Ramin_Shamshiri_Project1_Part1

6 Ramin Shamshiri EML 6934, Nonlinear control systems

Figure 3. Torque plots, EMK controller without

external disturbances

Figure 4. Error plots, EMK controller with

external disturbances

Figure 5. Torque plots, EMK controller without

external disturbances

4.5.4. Discussion:

We assumed exact knowledge of the model

parameters to design a controller to cancel out the

nonlinearities in the system using feedback

linearization which yielded a globally exponential

stability result. It can be observed from Figure 2 that

error exponentially converges to zero when there is

no external disturbances to the system. In the

presence of unknown, bounded disturbances, as seen

from Figure 4, the control torque designed based on

the known parameters is not capable of producing

exactly zero error result. Therefore, errors converge

to a small region and stay within that region. In the

other words, not all nonlinearities are cancelled and

we have globally ultimately bounded result. It can

also be seen from Figure 3 and 5 that torques are

bounded and in the range of -10 Nm to 30Nm for the

no disturbance case and within a range of -50Nm to

150 Nm in the presence of disturbance. The

simulation blocks are shown in Figure 6 and 7.

Page 7: EML6934_Ramin_Shamshiri_Project1_Part1

7 Ramin Shamshiri EML 6934, Nonlinear control systems

Figure 6. Exact Model Knowledge control simulation diagram without external disturbance

Figure 7. Exact Model Knowledge control simulation diagram with external disturbance

Page 8: EML6934_Ramin_Shamshiri_Project1_Part1

8 Ramin Shamshiri EML 6934, Nonlinear control systems

4.6. Adaptive controller

The objective of adaptive control is to achieve a

trajectory tracking task in the presence of unknown

parameters, thus, the controller should be designed

based on an estimate of the system model.

4.6.1. Controller design

From (12), we design the control torque as follow:

𝜏 = βˆ’π‘Œπœƒ βˆ’ πΎπ‘Ÿ (25)

where K is a positive control gain matrix and

ΞΈ represents an estimate of the system parameters.

Substituting (25) in (12), yields the following closed

loop error system.

π‘€π‘Ÿ = βˆ’π‘Œπœƒ βˆ’ π‘‰π‘šπ‘Ÿ βˆ’ Kr βˆ’ πœπ‘‘ (26)

where πœƒ = πœƒ βˆ’ πœƒ is he difference between the actual

and estimated parameters. Differentiation ΞΈ with

respect to time gives ΞΈ = βˆ’ΞΈ (since ΞΈ is assumed to

be a constant). In order to design πœƒ , we consider a continuously differentiable, positive-definite Lyapunov function candidate given by

𝑉 =1

2π‘Ÿπ‘‡π‘€π‘Ÿ +

1

2πœƒ π‘‡π›€βˆ’1πœƒ (27)

Differentiating (27) with respect to time and

substituting for ΞΈ with βˆ’ΞΈ yields;

𝑉 =1

2π‘Ÿπ‘‡π‘€ π‘Ÿ +

1

2π‘Ÿ π‘‡π‘€π‘Ÿ +

1

2π‘Ÿπ‘‡π‘€π‘Ÿ βˆ’ πœƒ π›€βˆ’1ΞΈ (28)

Substituting for π‘€π‘Ÿ with (26) ;

𝑉 =1

2π‘Ÿπ‘‡π‘€ π‘Ÿ + π‘Ÿπ‘‡(βˆ’π‘Œπœƒ βˆ’ π‘‰π‘šπ‘Ÿ βˆ’ Kr βˆ’ πœπ‘‘)

βˆ’ πœƒ π›€βˆ’1ΞΈ (29)

Using the skew symmetric property (13.2),

( 1

2π‘Ÿπ‘‡π‘€ π‘Ÿ βˆ’ π‘Ÿπ‘‡π‘‰π‘šπ‘Ÿ = 0) we can write (29) as:

𝑉 = βˆ’π‘Ÿπ‘‡π‘Œπœƒ βˆ’ π‘Ÿπ‘‡ Kr βˆ’ π‘Ÿπ‘‡πœπ‘‘ βˆ’ πœƒ π›€βˆ’1ΞΈ (30)

Now we can design πœƒ as:

πœƒ = βˆ’π›€π‘Œπ‘‡π‘Ÿ (31)

The expression for ΞΈ can then be find by integrating

πœƒ , ( ΞΈ = βˆ’π›€π‘Œπ‘‡π‘Ÿ 𝑑𝑑).

4.6.2. Lyapunov stability analysis:

Substituting the designed πœƒ in the expression for 𝑉 given by (30) yields;

𝑉 = βˆ’πΎπ‘Ÿ2 βˆ’ π‘Ÿπ‘‡πœπ‘‘ (32)

We can now upper-bound (32) by:

𝑉 ≀ βˆ’ K π‘Ÿ 2βˆ’ π‘Ÿπ‘‡πœπ‘‘ (33)

In the absence of external disturbance, πœπ‘‘ = 0 hence

the expression in (33) reduces to 𝑉 ≀ βˆ’ K π‘Ÿ 2 .

Since 𝑉 is a positive definite function and 𝑉 is

negative semi definite, we can conclude that 𝑉 ∈ 𝐿∞ .

In addition, since 𝑉 is a function of π‘Ÿ and πœƒ , then π‘Ÿ

and πœƒ are also ∈ 𝐿∞ . Being π‘Ÿ bounded, we have

𝑒, 𝑒 ∈ 𝐿∞ , thus π‘ž, π‘ž ∈ 𝐿∞ which means π‘Œ ∈ 𝐿∞ .

Also since πœƒ ,πœƒ ∈ 𝐿∞ , then πœƒ ∈ 𝐿∞ , thus π‘Ÿ ∈ 𝐿∞ .

Therefore, π‘Ÿ is continuously differentiable Since π‘Ÿ is

square integrable (π‘Ÿ ∈ 𝐿2 ) and uniformly continuous,

using the corollary to Barbalat’s lemma, we can

prove that π‘Ÿ β†’ 0 as 𝑑 β†’ 0 , hence we can conclude

that using this controller, and in the absence of

external disturbances, the system is asymptotically

stable. The input controller torque in (25) is a

function of bounded terms and is therefore bounded.

In the presence of a bounded external disturbance,

πœπ‘‘ β‰  0, assuming that πœπ‘‘ < 𝑐, we can upper bound

(32) by

𝑉 ≀ βˆ’ K π‘Ÿ 2βˆ’ 𝑐 π‘Ÿ (33.1)

Which results in a globally uniformly ultimately

bounded (GUUB) stability result. To calculate the

ultimate bound, we set βˆ’ K π‘Ÿ 2 βˆ’ 𝑐 π‘Ÿ = 0, which

yields π‘Ÿ >𝑐

𝐾.

Page 9: EML6934_Ramin_Shamshiri_Project1_Part1

9 Ramin Shamshiri EML 6934, Nonlinear control systems

4.6.3. Simulation

The performance of the designed adaptive controller was simulated in MATLAB in the presence and absence of

external disturbance (Figure 8 and 9).

Figure 8. Adaptive control simulation diagram without external disturbance

Figure 9. Adaptive control simulation diagram with external disturbance

Page 10: EML6934_Ramin_Shamshiri_Project1_Part1

10 Ramin Shamshiri EML 6934, Nonlinear control systems

Figure 10. Error plots, adaptive controller without

external disturbances

Figure 11. Error plots, adaptive controller with

external disturbances

Figure 12. Torque plots, adaptive controller

without external disturbances

Figure 13. Torque plots, adaptive controller with

external disturbances

Figure 14. Plots of estimated parameters, p1, p2

and p3, adaptive controller, no disturbance

Figure 15. Plots of estimated parameters, p1, p2

and p3, adaptive controller, with disturbance

Page 11: EML6934_Ramin_Shamshiri_Project1_Part1

11 Ramin Shamshiri EML 6934, Nonlinear control systems

Figure 16. Plots of estimated parameters, fd1 and

fd2, adaptive controller, no disturbance

Figure 17. Plots of estimated parameters, fd1 and

fd3, adaptive controller, with disturbance

4.6.4. Discussion

Since we have uncertain parameters in the system, it

is necessary to use adaptive control to design control

torque. As we can see in Figure 14, 15, 16 and 17,

ultimately, the parameter estimates reach close to the

actual values given by the problem. It can also be

seen from Figure 10 and 11 that the error

asymptotically converges to zero in the absence of

external disturbances. In the case of having

disturbance in the system, the error wiggles around

zero, indicating an ultimately bounded stability

result. It can also be seen from the torque profiles that

the torques are within the prescribed limits.

4.7. Sliding mode control

When the parameters in the model are all unknown,

nonlinear robust sliding mode control is an approach

to compensate uncertainties in the system by crushing

them through fast switching. This approach comes at

the cost of high or even infinite control effort. In the

other words, we would need an actuator that switches

infinitely.

4.7.1. Controller Design:

For this design, we need to consider the following

upper-bounds to the dynamic expressed in (11):

π‘žπ‘‘ = cos 𝑑 cos 𝑑 𝑇

∴ π‘žπ‘‘ , π‘ž 𝑑 , π‘ž 𝑑 ≀ 1,

∴ π‘€π‘žπ‘‘ , π‘€π‘ž 𝑑 , π‘€π‘ž 𝑑 ≀ 𝑐,

∡ 𝑀 ≀ 𝑐 (34)

πœπ‘‘ = 2 sin t 0.5 sin t 𝑇

∴ πœπ‘‘ ≀ 1

We can also group the terms in (12) as follow:

π‘€π‘Ÿ = 𝜏 βˆ’ 𝑉mr + 𝛽 (35)

where 𝛽 = π‘Œπœƒ βˆ’ πœπ‘‘ can be upper bounded by

𝜌 ≀ 𝑐1 + 𝑐2 𝑧 + 𝑐3 𝑧 2 , where 𝑧 = 𝑒𝑇 π‘Ÿπ‘‡ 𝑇 .

Therefore we design the control torque as:

𝜏 = βˆ’πΎπ‘Ÿ βˆ’ πœŒπ‘ π‘”π‘›(π‘Ÿ) (36)

where 𝐾 is a positive control gain matrix, 𝜌 is a

positive constant and 𝑠𝑔𝑛(π‘Ÿ) is the sign function of

π‘Ÿ . Substituting (36) in (35) yields the closed loop

error system:

π‘€π‘Ÿ = βˆ’πΎπ‘Ÿ βˆ’ πœŒπ‘ π‘”π‘›(π‘Ÿ) βˆ’ 𝑉mr + 𝛽 (37)

4.7.2. Stability Analysis:

Considering a continuously differentiable, positive-

definite Lyapunov function candidate given by

𝑉 =1

2π‘Ÿπ‘‡π‘€π‘Ÿ (38)

Differentiating (38) with respect to time,

𝑉 =1

2π‘Ÿπ‘‡π‘€ π‘Ÿ + π‘Ÿπ‘‡π‘€π‘Ÿ (39)

Page 12: EML6934_Ramin_Shamshiri_Project1_Part1

12 Ramin Shamshiri EML 6934, Nonlinear control systems

Substituting (4.37) in (39):

𝑉 =1

2π‘Ÿπ‘‡π‘€ π‘Ÿ + π‘Ÿπ‘‡(βˆ’πΎπ‘Ÿ βˆ’ πœŒπ‘ π‘”π‘›(π‘Ÿ) βˆ’ 𝑉mr + 𝛽) (40)

using the skew symmetry property given by (13.2) to

simplify (40)

𝑉 = π‘Ÿπ‘‡(βˆ’πΎπ‘Ÿ βˆ’ πœŒπ‘ π‘”π‘›(π‘Ÿ) + 𝛽) (40.1)

Now we can upper bound 𝑉 as follow:

𝑉 ≀ βˆ’πΎ π‘Ÿ 2 βˆ’ π‘Ÿπ‘‡πœŒπ‘ π‘”π‘›(π‘Ÿ) + π‘Ÿπ‘‡π›½

∴ 𝑉 ≀ βˆ’πΎ π‘Ÿ 2 βˆ’ π‘Ÿ 𝜌 + π‘Ÿ 𝜌

∴ 𝑉 ≀ βˆ’πΎ π‘Ÿ 2

(41)

From (41), we can get 𝑉 ≀ βˆ’2𝐾

πœ†π‘šπ‘Žπ‘₯ 𝑀 𝑉(t), where

πœ†π‘šπ‘Žπ‘₯ {𝑀} gives the maximum eigenvalue of matrix

𝑀. Therefore, we have:

𝑉(t) ≀ 𝑉 0 eβˆ’

2πΎπ‘‘πœ†π‘šπ‘Žπ‘₯ {𝑀} (42)

From (42), it can be concluded that the system is

Global Exponential stability (GES). Since 𝑉(𝑑)

exponentially converges to 0, π‘Ÿ also exponentially

converges to 0. Therefore, 𝑒 β†’ 0 π‘Žπ‘  𝑑 β†’ 0. Since

the disturbance was included within the uncertain

model, no separate stability analysis is necessary for

a case with disturbance. The constants chosen squash

all the unknown nonlinearities in the system.

However, robust controllers for a system with and

without disturbances are modeled and simulated.

4.7.3. Simulations

Figure 18. Error plots, Sliding mode controller

without external disturbances

Figure 19. Error plots, Sliding mode controller

with external disturbances

Figure 20. Torque plots, Sliding mode controller

without external disturbances

Figure 21. Torque plots, Sliding mode controller

with external disturbances

Page 13: EML6934_Ramin_Shamshiri_Project1_Part1

13 Ramin Shamshiri EML 6934, Nonlinear control systems

4.7.4. Discussion

In this design, we can theoretically achieve a globally

exponentially stability result, however errors do not

exactly converge to zero, because of the

discontinuous nature of the controller and since the

torque limitations impose constraints on the gain

selection. Having upper bounded the unknown

dynamics and disturbances by functions of states; the

sliding mode controller manages to crush the

nonlinearities, however it is not possible to achieve

GES when the unknown dynamics cannot be

modeled as a function of states, but upper-bounded

by a constant. In this case, we can conclude a

globally uniformly ultimately bounded stability

result. From the torque plots, we can see that it has

been switching infinitely which in reality, there is no

actuator to handle such a bandwidth, thus this

controller is not implementable on a real system.

Figure 22. Sliding mode control simulation diagram without external disturbance

Figure 23. Sliding mode control simulation diagram without external disturbance

Page 14: EML6934_Ramin_Shamshiri_Project1_Part1

14 Ramin Shamshiri EML 6934, Nonlinear control systems

4.8. High gain control

In this approach, we design torque control input in

such a way that it crushes the uncertainties in the

system through high gain. This design leads to a high

control effort. 4.8.1. Control design

Using the dynamic in (35), we design the control

torque as:

𝜏 = βˆ’πΎπ‘Ÿ (43)

where 𝐾 is a positive control gain matrix.

Substituting (43) in (35) yields the closed loop error

system as follow:

π‘€π‘Ÿ = βˆ’πΎπ‘Ÿ βˆ’ 𝑉mr + 𝛽 (44)

4.8.2. Stability Analysis

Considering a continuously differentiable, positive-

definite Lyapunov function candidate given by (38)

and its time derivative given in (39), substitution for

π‘€π‘Ÿ in (39) using (44) yields;

𝑉 =1

2π‘Ÿπ‘‡π‘€ π‘Ÿ + π‘Ÿπ‘‡(βˆ’πΎπ‘Ÿ βˆ’ 𝑉mr + 𝛽) (45)

using the skew symmetry property given by (13.2) to

simplify (40)

𝑉 = π‘Ÿπ‘‡(βˆ’πΎπ‘Ÿ + 𝛽) (46)

Now we can upper bound 𝑉 as follow:

𝑉 ≀ βˆ’πΎ π‘Ÿ 2 + π‘Ÿπ‘‡π›½ ∴ 𝑉 ≀ βˆ’πΎ π‘Ÿ 2 + 𝜌 π‘Ÿ

(47)

From (47), we can see that βˆ’πΎ π‘Ÿ 2 dominates 𝜌 π‘Ÿ

by large 𝐾, and as long as this happens, 𝑉(𝑑) will be

decreasing. But because we have π‘Ÿ 2 , the term

βˆ’πΎ π‘Ÿ 2 will eventually be dominated by π‘Ÿ . In the

other words, at some point, π‘Ÿ will be small enough

that βˆ’πΎ π‘Ÿ 2 will be dominated by 𝜌 π‘Ÿ , and since 𝑉

is a positive definite, radially unbounded and

decrescent function, we conclude uniformly ultimate

bound stability result. This can be shown by letting

𝐾 = π‘˜1 + π‘˜2 and completing the square term in (47)

as follow:

𝑉 ≀ βˆ’π‘˜1 π‘Ÿ 2 βˆ’ π‘˜2 π‘Ÿ

2 βˆ’ 𝜌 π‘Ÿ +𝜌2

4π‘˜22 +

𝜌2

4π‘˜2 (48)

The inequality in (48) can be written as

𝑉 ≀ βˆ’2π‘˜1

𝑀.1

2π‘Ÿπ‘‡π‘Ÿ + 𝐢𝑏

∴ 𝑉 ≀ βˆ’πΆπ‘Žπ‘‰ + 𝐢𝑏

(49)

where πΆπ‘Ž =2π‘˜1

𝑀 π‘Žπ‘›π‘‘ 𝐢𝑏 =

𝜌2

4π‘˜2. The solution to (49) is

𝑉(𝑑) ≀ πΆπ‘Žπ‘‰(0)eβˆ’

π‘˜1𝑑

πœ†π‘šπ‘Žπ‘₯ {𝑀 } + 𝐢𝑏 , where πœ†π‘šπ‘Žπ‘₯ {𝑀}

gives the maximum eigenvalue of matrix 𝑀 .

Therefore, we have uniformly ultimate bounded

(UUB) stability result.

4.8.3. Simulations

Figure 24. Error plots, high gain controller,

without disturbances, black:K=1, red:K=10,

blue:K=50, green:K=500.

Figure 25. Error plots, high gain controller, with

disturbances, K=25

Page 15: EML6934_Ramin_Shamshiri_Project1_Part1

15 Ramin Shamshiri EML 6934, Nonlinear control systems

Figure 26. Torque plots, high gain controller,

without disturbances, K=10.

Figure 27. Torque plots, high gain controller,

without disturbances, K=25.

4.8.4. Discussions:

Plots of error for different gains are shown in Figure 24. It can be seen that, as we increase the gain, error get closer

to zero. In reality, increasing gain require high control effort. One advantage of this controller is its simple design

structure which makes it easy to tune and implement. The controller is robust to the uncertainties in the system,

however it only yields a uniformly ultimately bounded stability result.

Page 16: EML6934_Ramin_Shamshiri_Project1_Part1

16 Ramin Shamshiri EML 6934, Nonlinear control systems

V. Appendix

The Robot model remains the same for all the controllers; the MATLAB code for the robot model is provided once,

with the EMK controller. For the sake of keeping the report short, only the controllers with disturbance are shown.

The controllers without disturbance in the system can be modeled with Td = 0.

% April.05.2010, Ramin Shamshiri, [email protected]

% Dept of Ag & Bio Eng

% University of Florida, Gainesville, Florida

APPENDIX 1. Robot dynamic

% Robot manipulator dynamics.

function q_ddot = Manipulator_dynamics(Torque, Td, q, q_dot)

%% Parameter description:

p1 = 3.473; p2 = 0.196; p3 = 0.242;

fd1 = 5.3; fd2 = 1.1;

% Joint position and velocity signals:

q1 = q(1); q2 = q(2); % Joint angles

q1_dot = q_dot(1); q2_dot = q_dot(2); % Joint angular velocities

% Model description:

M = [p1+2*p3*cos(q2) p2+p3*cos(q2); p2+p3*cos(q2) p2 ];

Vm = [-p3*sin(q2)*q2_dot -p3*sin(q2)*(q1_dot+q2_dot);

p3*sin(q2)*q1_dot 0 ];

Fd = [fd1 0;0 fd2];

% Output for feedback - "q_ddot"

% From the given equation of dynamics

q_ddot = inv(M)*(Torque - Vm*q_dot - Fd*q_dot - Td);

APPENDIX 2:. EMK Controller

function [Torque, e]= EMK_controller(t, alf, K, q, q_dot)

% Desired trajectory:

qd = [cos(t);cos(t)];

qd_dot = [-sin(t);-sin(t)];

qd_ddot = [-cos(t);-cos(t)];

% Error definition for the Tracking controller

e = q - qd;

e_dot = q_dot - qd_dot;

% Filter Tracking Error

r = e_dot + alf*e;

% Parameter description, given Exact Model Knowledge:

p1 = 3.473; p2 = 0.196; p3 = 0.242;

fd1 = 5.3; fd2 = 1.1;

% Joint position and velocity signals:

q1 = q(1); q2 = q(2); % Joint angles

q1_dot = q_dot(1); q2_dot = q_dot(2); % Joint angular velocities

% Model description:

M = [p1+2*p3*cos(q2) p2+p3*cos(q2);p2+p3*cos(q2) p2 ];

Vm = [-p3*sin(q2)*q2_dot -p3*sin(q2)*(q1_dot+q2_dot);

p3*sin(q2)*q1_dot 0 ];

Fd = [fd1 0;0 fd2];

% Control Torque based on exact model knowledge

Torque = Vm*qd_dot + Fd*q_dot + M*qd_ddot - Vm*alf*e - alf*M*e_dot - K*r;

Page 17: EML6934_Ramin_Shamshiri_Project1_Part1

17 Ramin Shamshiri EML 6934, Nonlinear control systems

APPENDIX 3. Adaptive controller

function [Torque, e, theta_hat_dot]= Adaptive_controller(t, alf, K, q, q_dot, gamma, theta_hat)

% Desired trajectory:

qd = [cos(t);cos(t)];

qd_dot = [-sin(t);-sin(t)];

qd_ddot = [-cos(t);-cos(t)];

% Error definition for the Tracking controller

e = q - qd;

e_dot = q_dot - qd_dot;

% Filter Tracking Error

r = e_dot + alf*e;

% Joint position and velocity signals:

q1 = q(1); q2 = q(2); % Joint angles

q1_dot = q_dot(1); q2_dot = q_dot(2); % Joint angular velocities

% Linear parametrization

% Defining the terms in Y and theta

qd1_dot = qd_dot(1); qd2_dot = qd_dot(2);

qd1_ddot = qd_ddot(1); qd2_ddot = qd_ddot(2);

e1_dot = e_dot(1); e2_dot = e_dot(2);

alf1 = alf(1,1); alf2 = alf(2,2);

A1 = -qd1_ddot + alf1*e1_dot;

B1 = -qd2_ddot + alf2*e2_dot;

C1 = cos(q2)*(-2*qd1_ddot - qd2_ddot + 2*alf1*e1_dot + alf2*e2_dot) + sin(q2)*(-

alf1*e1_dot*q2_dot - alf2*e2_dot*(q1_dot + q2_dot) + q2_dot*qd1_dot + (q1_dot + q2_dot)*qd2_dot);

D1 = -q1_dot;

E1 = 0;

A2 = 0;

B2 = - qd1_ddot - qd2_ddot + alf1*e1_dot + alf2*e2_dot;

C2 = cos(q2)*(-qd1_ddot + alf1*e1_dot) + sin(q2)*(alf1*e1_dot*q1_dot - q1_dot*qd1_dot);

D2 = 0;

E2 = -q2_dot;

Y = [A1 B1 C1 D1 E1;

A2 B2 C2 D2 E2];

Yt = Y';

% Control Torque based on estimate plant model

Feedback_term = K*r;

Torque = -(Y*theta_hat + Feedback_term);

% Designing theta_hat_dot to cancel the cross-over term in the Lyapunov analysis

theta_hat_dot = gamma*Yt*r;

Page 18: EML6934_Ramin_Shamshiri_Project1_Part1

18 Ramin Shamshiri EML 6934, Nonlinear control systems

APPENDIX 4: Robust, SMC controller

function [Torque, e]= Robust_controller(t, alf, K, q, q_dot)

%% Desired trajectory:

qd = [cos(t);cos(t)];

qd_dot = [-sin(t);-sin(t)];

%% Error definition for the Tracking controller

e = q - qd;

e_dot = q_dot - qd_dot;

% Filter Tracking Error

r = e_dot + alf*e;

%% Control Torque based on estimate plant model

c1 = 10; c2 = 7; c3 = 1;

norm_z = norm([r,e],'fro'); %Frobenius norm

p = c1+c2*norm_z+c3*norm_z^2;

Torque = -p*sign(r)- K*r;

APPENDIX 5: Robust, High gain controller

function [Torque, e]= Robust_controller(t, alf, K, q, q_dot)

%% Desired trajectory:

qd = [cos(t);cos(t)];

qd_dot = [-sin(t);-sin(t)];

%% Error definition for the Tracking controller

e = q - qd;

e_dot = q_dot - qd_dot;

% Filter Tracking Error

r = e_dot + alf*e;

%% Control Torque based on estimate plant model

Torque = -K*r;

Page 19: EML6934_Ramin_Shamshiri_Project1_Part1

19 Ramin Shamshiri EML 6934, Nonlinear control systems

APPENDIX 6: Plotting

% Simulation variables assigned

%-------------------------------------------------------------------------%

% EMK_no_dist --> error1, torque1

% EMK_with_dist --> error2, torque2

% Adaptive_no_dist --> error3, torque3, estimates1

% Adaptive_with_dist --> error4, torque4, estimates2

% SMC_no_dist --> error5, torque5

% SMC_with_dist --> error6, torque6

% Robust_no_dist --> error7_K(i)*, torque7_K10

% Robust_with_dist --> error8, torque8

% * Run simulation with different K, i.e. K=25 and store output as

% error7_K25

%-------------------------------------------------------------------------%

close all

% Exact Model Knowledge (EMK) controller plots without disturbances

%-----------------------------------------------------------------------%

dt=size(error1,1);

t1=0:20/(dt-1):20;

t1=t1';

% Plots of Error i joint angles

figure1 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t1,error1(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q1');

title('Error plots, EMK controller without external disturbances');

subplot (2,1,2)

plot(t1,error1(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q2');

% Plot of torque 1 and torque 2

figure2 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t1,torque1(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 1, (Nm)');

title('Torque plots, EMK controller without external disturbances');

subplot (2,1,2)

plot(t1,torque1(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 2, (Nm)');

%-----------------------------------------------------------------------%

% Exact Model Knowledge controller plots With disturbances

%-----------------------------------------------------------------------%

dt=size(error2,1);

t2=0:20/(dt-1):20;

t2=t2';

% Plots of Error i joint angles

figure3 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t2,error2(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q1');

title('Error plots, EMK controller with external disturbances');

subplot (2,1,2)

plot(t2,error2(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q2');

Page 20: EML6934_Ramin_Shamshiri_Project1_Part1

20 Ramin Shamshiri EML 6934, Nonlinear control systems

% Plot of torque 1 and torque 2

figure4 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t2,torque2(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 1, (Nm)');

title('Torque plots, EMK controller with external disturbances');

subplot (2,1,2)

plot(t2,torque2(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 2, (Nm)');

%-----------------------------------------------------------------------%

% Adaptive controller plots Without disturbances

%-----------------------------------------------------------------------%

dt=size(error3,1);

t3=0:20/(dt-1):20;

t3=t3';

% Plots of Error i joint angles

figure5 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t3,error3(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q1');

title('Error plots, Adaptive controller without external disturbances');

subplot (2,1,2)

plot(t3,error3(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q2');

% Plot of torque 1 and torque 2

figure6 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t3,torque3(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 1, (Nm)');

title('Torque plots, Adaptive controller without external disturbances');

subplot (2,1,2)

plot(t3,torque3(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 2, (Nm)');

% Plot of estimated parameters, p1, p2, p3

figure7 = figure('Color',[1 1 1]);

subplot(3,1,1);

plot(t3,estimates1(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of p1');

title('Parameter estimate plots, Adaptive controller without external disturbances');

subplot(3,1,2);

plot(t3,estimates1(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of p2');

subplot(3,1,3);

plot(t3,estimates1(1:dt,3),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of p3');

% Plot of estimated parameters, fd1,fd2

figure8 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t3,estimates1(1:dt,4),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of fd1');

title('Parameter estimate plots, Adaptive controller without external disturbances');

subplot(2,1,2);

plot(t3,estimates1(1:dt,5),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of fd2');

%-----------------------------------------------------------------------%

Page 21: EML6934_Ramin_Shamshiri_Project1_Part1

21 Ramin Shamshiri EML 6934, Nonlinear control systems

% Adaptive controller plots With disturbances

%-----------------------------------------------------------------------%

dt=size(error4,1);

t4=0:20/(dt-1):20;

t4=t4';

% Plots of Error i joint angles

figure9 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t4,error4(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q1');

title('Error plots, Adaptive controller with external disturbances');

subplot (2,1,2)

plot(t4,error4(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q2');

% Plot of torque 1 and torque 2

figure10 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t4,torque4(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 1, (Nm)');

title('Torque plots, Adaptive controller with external disturbances');

subplot (2,1,2)

plot(t4,torque4(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 2, (Nm)');

% Plot of estimated parameters, p1, p2, p3

figure11 = figure('Color',[1 1 1]);

subplot(3,1,1);

plot(t4,estimates2(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of p1');

title('Parameter estimate plots, Adaptive controller with external disturbances');

subplot(3,1,2);

plot(t4,estimates2(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of p2');

subplot(3,1,3);

plot(t4,estimates2(1:dt,3),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of p3');

% Plot of estimated parameters, fd1,fd2

figure12 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t4,estimates2(1:dt,4),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of fd1');

title('Parameter estimate plots, Adaptive controller with external disturbances');

subplot(2,1,2);

plot(t4,estimates2(1:dt,5),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Estimate of fd2');

%-----------------------------------------------------------------------%

Page 22: EML6934_Ramin_Shamshiri_Project1_Part1

22 Ramin Shamshiri EML 6934, Nonlinear control systems

% Sliding Mode Controller (SMC) plots Without disturbances

%-----------------------------------------------------------------------%

dt=size(error5,1);

t5=0:20/(dt-1):20;

t5=t5';

% Plots of Error i joint angles

figure13 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t5,error5(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q1');

title('Error plots, Sliding Mode Controller without external disturbances');

subplot (2,1,2)

plot(t5,error5(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q2');

% Plot of torque 1 and torque 2

figure14 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t5,torque5(1:dt,1),'b','LineWidth',0.5); grid on

xlabel('Time (sec)');

ylabel('Torque 1, (Nm)');

title('Torque plots, Sliding Mode Controller without external disturbances');

subplot (2,1,2)

plot(t5,torque5(1:dt,2),'b','LineWidth',0.5); grid on

xlabel('Time (sec)');

ylabel('Torque 2, (Nm)');

%-----------------------------------------------------------------------%

% Sliding Mode Controller (SMC) plots With disturbances

%-----------------------------------------------------------------------%

dt=size(error6,1);

t6=0:20/(dt-1):20;

t6=t6';

% Plots of Error i joint angles

figure15 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t6,error6(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q1');

title('Error plots, Sliding Mode Controller with external disturbances');

subplot (2,1,2)

plot(t6,error6(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q2');

% Plot of torque 1 and torque 2

figure16 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t6,torque6(1:dt,1),'b','LineWidth',0.5); grid on

xlabel('Time (sec)');

ylabel('Torque 1, (Nm)');

title('Torque plots, Sliding Mode Controller with external disturbances');

subplot (2,1,2)

plot(t6,torque6(1:dt,2),'b','LineWidth',0.5); grid on

xlabel('Time (sec)');

ylabel('Torque 2, (Nm)');

%-----------------------------------------------------------------------%

Page 23: EML6934_Ramin_Shamshiri_Project1_Part1

23 Ramin Shamshiri EML 6934, Nonlinear control systems

% Robust High gain Controller plots Without disturbances

%-----------------------------------------------------------------------%

dt=size(error7_K1,1);

t7=0:20/(dt-1):20;

t7=t7';

% Plots of Error i joint angles

figure17 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t7,error7_K1(1:dt,1),'b','LineWidth',0.5); grid on % K=1

xlabel('Time (sec)');

ylabel('Error in joint angle q1');

title('Error plots, high gain Controller without external disturbances');

hold on

subplot (2,1,2)

plot(t7,error7_K1(1:dt,2),'b','LineWidth',0.5); grid on % K=1

xlabel('Time (sec)');

ylabel('Error in joint angle q2');

hold on

dt=size(error7_K10,1);

t7=0:20/(dt-1):20;

t7=t7';

subplot(2,1,1);

plot(t7,error7_K10(1:dt,1),'r','LineWidth',0.5); % K=10

hold on

subplot (2,1,2)

plot(t7,error7_K10(1:dt,2),'r','LineWidth',0.5); % K=10

hold on

dt=size(error7_K50,1);

t7=0:20/(dt-1):20;

t7=t7';

subplot(2,1,1);

plot(t7,error7_K50(1:dt,1),'b','LineWidth',0.5); % K=50

hold on

subplot (2,1,2)

plot(t7,error7_K50(1:dt,2),'b','LineWidth',0.5); % K=50

hold on

dt=size(error7_K500,1);

t7=0:20/(dt-1):20;

t7=t7';

subplot(2,1,1);

plot(t7,error7_K500(1:dt,1),'g','LineWidth',0.5); % K=500

hold off

subplot (2,1,2)

plot(t7,error7_K500(1:dt,2),'g','LineWidth',0.5); % K=500

hold off

% Plot of torque 1 and torque 2

dt=size(error7_K10,1);

t7=0:20/(dt-1):20;

t7=t7';

figure18 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t7,torque7_K10(1:dt,1),'b','LineWidth',2); grid on % K=10

xlabel('Time (sec)');

ylabel('Torque in joint angle q1');

title('Torque plots, high gain Controller without external disturbances');

subplot (2,1,2)

plot(t7,torque7_K10(1:dt,2),'b','LineWidth',2); grid on % K=10

xlabel('Time (sec)');

ylabel('Error in joint angle q2');

%-----------------------------------------------------------------------%

Page 24: EML6934_Ramin_Shamshiri_Project1_Part1

24 Ramin Shamshiri EML 6934, Nonlinear control systems

% Robust High gain Controller plots With disturbances

%-----------------------------------------------------------------------%

dt=size(error8,1);

t8=0:20/(dt-1):20;

t8=t8';

% Plots of Error i joint angles

figure19 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t8,error8(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q1');

title('Error plots, Robust High gain Controller with external disturbances');

subplot (2,1,2)

plot(t8,error8(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Error in joint angle q2');

% Plot of torque 1 and torque 2

figure20 = figure('Color',[1 1 1]);

subplot(2,1,1);

plot(t8,torque8(1:dt,1),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 1, (Nm)');

title('Torque plots, Robust High gain Controller with external disturbances');

subplot (2,1,2)

plot(t8,torque8(1:dt,2),'b','LineWidth',2); grid on

xlabel('Time (sec)');

ylabel('Torque 2, (Nm)');

%-----------------------------------------------------------------------%