0% found this document useful (0 votes)
34 views

Lab 5 Prelab

The document describes modeling and controlling a single-link flexible joint manipulator. It introduces the system and goal of modeling and controlling the flexible joint for vertical orientation. It then provides background on feedback linearization of nonlinear systems and defines key concepts like relative degree and normal forms that are important for feedback linearization.

Uploaded by

Good Good
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Lab 5 Prelab

The document describes modeling and controlling a single-link flexible joint manipulator. It introduces the system and goal of modeling and controlling the flexible joint for vertical orientation. It then provides background on feedback linearization of nonlinear systems and defines key concepts like relative degree and normal forms that are important for feedback linearization.

Uploaded by

Good Good
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Modeling and Nonlinear Control of a Single-link Flexible Joint

Manipulator
Kevin Groves, Andrea Serrani
Department of Electrical and Computer Engineering
The Ohio State University
Columbus, OH 43210 USA

1 Introduction
In this experiment, we consider the nonlinear control of a robotic arm with joint flexibility. The
specific mechanism under investigation is an attachment to rotary Quanser experimental setup.
Flexibility is attained by attaching the link to the motor shaft using a pair of springs. There is
some discretion in choosing the joint stiffness as there are different locations that the springs can be
attached on the body as well as several spring choices.
The goal of this project is to model and control the flexible joint for the case in which the arm
is oriented vertically. This introduces a non-linearity into the system in the form of a sinusoid, as a
result of the potential energy due to gravity. The output to be controlled is the tip angle, which is
given by the sum of the motor angle θ and the joint deflection α with respect to the motor shaft.
The non-linear model of the dynamics will be linearized by means of state feedback in such a way
that the input-output response between the voltage applied to the motor and the tip angle becomes
that of a linear system. After the system has been rendered linear by feedback, it can be controlled
using any linear control system design.

2 Feedback Linearization of Nonlinear Systems


In this section, we give the fundamentals of feedback linearization for single-input, single-output
(SISO) nonlinear control systems which are affine in the control input, that is, systems of the form

ẋ = f (x) + g(x)u
(1)
y = h(x)

where x ∈ Rn , u ∈ R, y ∈ R. We assume that the vector fields f : D → Rn , g : D → Rn and the


readout map h : D → R are smooth in the domain D ⊂ Rn , that is that their partial derivatives
with respect to x of any order exist and are continuous in D. Our objective is to find a smooth
control law of the form
u = α(x) + β(x)v (2)
with v ∈ R is an overall control input, such that the closed-loop system

ẋ = f (x) + g(x)α(x) + g(x)β(x)v


(3)
y = h(x)

depicted in Figure 1 possesses a linear input/output map y = G(s)v between the new input v and
the system output y. This problem is known as the input/output feedback linearization problem, and
it is sometimes referred to as partial linearization problem (1). If the objective is that of finding
a control law of the kind (2) and a set of coordinates under which the closed loop system (3) is

1
u ẋ = f (x) + g(x)u
v β(x)v + y
y = h(x)

α(x)

G(s)

Figure 1: Linearization by feedback

altogether a realization of the map u/y, then the problem in question is referred to as the exact
feedback linearization problem. It is worth noting that, although an output y = h(x) is specified for
the system (1), the entire state vector x ∈ Rn is assumed available for feedback.

2.1 Notation
We will adopt the following notation:
• A smooth vector field f (x) is a mapping assigning a point x ∈ Rn to a column vector whose
components are smooth functions of x ∈ Rn
 
f1 (x)
 f2 (x) 
f (x) =  .  .
 
 .. 
fn (x)

• Given a vector field f : Rn → Rn and a function λ : Rn → R, both defined and smooth over
a domain D ⊂ Rn , we denote by
. ∂λ
Lf λ : R n → R , x 7→ Lf λ(x) = f (x)
∂x
the derivative of λ(x) along the vector field f (x). Note that Lf λ(x) is again a smooth function.
Therefore, higher order derivatives of λ(x) along f (x) are easily defined using the recursive
relation
k−1
. ∂Lf λ(x)
Lkf λ(x) = f (x) ,
∂x
for any integer k > 1.

2.2 Coordinate transformations in nonlinear systems


A function Φ : D → Rn defined on a domain D ⊂ Rn of a point x◦ ∈ Rn , is a local diffeomorphism
of Rn in a neighborhood of x◦ if
1. Φ in one-to-one, that is, the inverse function Φ−1 : Φ(D) → D such that
Φ−1 ◦ Φ(x) = x
is well defined for all x ∈ D.

2
2. Φ is smooth in D and Φ−1 is smooth in Φ(D)1 .
If the above properties hold for D = Φ(D) = Rn , then Φ is said to be a , global diffeomorphism.
One easy way to recognize a local diffeomorphism is the following. Suppose Φ is a smooth function
over a domain D. If the jacobian matrix ∂Φ/∂x is non singular at a point x◦ ∈ D, then Φ is a local
diffeomorphism in a neighborhood of x◦2 .

The importance of a local diffeomorphism for nonlinear systems lies in the fact that it represents a
nonlinear coordinate transformation, in the same way that a nonsingular matrix defines a change of
basis in a linear system. Suppose we are given a system of the kind (1) over a domain D ⊂ R n , and
a local diffeomorphism Φ defined in D. Letting z = Φ(x), we obtain
d ∂Φ
ż(t) = Φ(x(t)) = ẋ(t)
dt ∂x
and thus, in the new coordinate z the system (1) has the expression
ż = f¯(z) + ḡ(z)u
(4)
y = h̄(z)
where
   
∂Φ ∂Φ
f¯(z) = f (x) , ḡ(z) = g(x) , h̄(z) = [h(x)]x=Φ−1 (z) .
∂x x=Φ−1 (z) ∂x x=Φ−1 (z)

Note that (4) is defined in the domain Φ(D).3 Therefore, the coordinate transformation
 
φ1 (x)
 φ2 (x) 
z = Φ(x) = 
 ...  ,

φn (x)
yields a transformed system (4) in which
   
Lf φ1 (x) Lg φ1 (x)
 Lf φ2 (x)   Lg φ2 (x)
f¯(z) = 

 ḡ(z) =   h̄(z) = h(Φ−1 (z)) .
 ...   ... 
Lf φn (x) x=Φ−1 (z) Lg φn (x) x=Φ−1 (z)

2.3 Relative degree and normal forms


Consider again a smooth affine system of the form (1). The following definition is of fundamental
importance.
Definition 2.1 (Relative degree) We say that the system (1) has relative degree r ≤ n at the
point x◦ it:
1. Lg h(x) = 0, for any x in a neighborhood of x◦ ;
2. Lg Lif h(x) = 0, for any x in a neighborhood of x◦ , for all i = 1, . . . , r − 2;

3. Lg Lr−1
f h(x◦ ) 6= 0.
Remark 2.1 It is important to point out that the relative degree of a systems is defined for a specific
output map h(x), and it can not exceed the dimension of the state space n.
1 The set Φ(D) is the set of all points y ∈ Rn such that y = Φ(x) for some x ∈ D
2 This can be verified using the Implicit Function Theorem
3 It is easy to verify that, as a result of the continuity of Φ −1 , the set Φ(D) is open and connected.

3
2.3.1 Example
In a linear SISO systems
ẋ = Ax + Bu
y = Cx
the relative degree is defined at each point in the state space. In this case, since f (x) = Ax, g(x) = B
and h(x) = Cx, we have

Lkf h(x) = CAk x , and Lg Lkf h(x) = CAk B .

Therefore, the integer r is characterized by the conditions (independent of x)

CAk B = 0 for all 0 ≤ k < r − 1


r−1
CA B 6= 0.

It can be shown that the integer satisfying these conditions is exactly equal to the difference between
the degree of the denominator polynomial and the degree of the numerator polynomial of the transfer
function of the system
G(s) = C(sI − A)−1 B .
Let us discuss a simpler and more intuitive characterization of the relative degree of a system
from the point of view of its trajectories. Suppose that x(t) is the trajectory of (1) originating from
a point x(t0 ) = x◦ at which a relative degree r < n is defined. For a sufficiently small interval [t 0 , t1 ]
the trajectory x(t) with t ∈ [t0 , t1 ] remains close to x◦ and thus we can assume that x(t) remains
in the neighborhood of x◦ in which conditions 1-3 in definition 2.1 hold. Taking derivative of the
output y(t) of the system, we obtain

∂h
y (1) (t) = ẋ = Lf h(x(t)) + Lg h(x(t))u(t) .
∂x
If the relative degree is greater than 1, for all t ∈ [t0 , t1 ] we have Lg h(x(t)) = 0, and therefore

y (1) (t) = Lf h(x(t)) .

If this is the case, then the second derivative of the output is given by

y (2) (t) = L2f h(x(t)) + Lg Lf h(x(t))u(t)

which, if the relative degree is greater than 2, yields

y (2) (t) = L2f h(x(t)) , t ∈ [t0 , t1 ] .

Continuing along these lines, it is easy to see that the relative degree at x ◦ being r means that the
derivatives of the output y(t) in a sufficiently small interval of time are given by

y (k) (t) = Lkf h(x(t)) ∀k < r


y (r) (t0 ) = Lrf h(x◦ ) + Lg Lr−1
f h(x◦ )u(t0 ) .

The relative degree r is exactly equal to the number of times one needs to differentiate the output
y(t) at time t = t0 in order to have the input u(t0 ) appear explicitly.

The following result is of crucial importance:

4
Lemma 2.1 Suppose the system (1) has relative degree r at x◦ . Then, the r × n matrix
∂h(x)
 

 ∂x 

 ∂Lf h(x) 
 

 ∂x 

 .. 

 . 

 
 ∂Lr−1 h(x) 
f
∂x
has rank equal to r for all x in a neighborhood of x◦ .
This results suggests that the r smooth functions h(x), Lf h(x),. . .,Lr−1
f h(x) are good candidates
to define a local coordinate transformation in a neighborhood of x◦ . Since the dimension of the
state space is n and r ≤ n, we need n − r more functions to complete the construction of a local
diffeomorphism. At this regard, we can invoke the following result, which constitutes a nonlinear
analogue of the theorem of the completion of basis in linear algebra:
Theorem 2.2 Suppose the system (1) has relative degree r at x◦ . Let
.
φ1 (x) = h(x)
.
φ2 (x) = Lf h(x)
...
.
φr (x) = Lr−1 f h(x).
If r < n there exist n − r smooth functions φr+1 (x), . . . , φn (x) such that the mapping
 
φ1 (x)
 φ2 (x) 
Φ(x) = 
 ... 

φn (x)
has a nonsingular jacobian matrix ∂Φ/∂x in x◦ , and thus Φ(x) defines a local diffeomorphism in a
neighborhood of x◦ . Furthermore, it is always possible to choose φr+1 (x), . . . , φn (x) in such a way
that
Lg φi (x) = 0 , i = r + 1, . . . , n
for all x in a neighborhood of x◦ .
At this point, we know that we can construct a coordinate transformation z = Φ(x) in such a way
that the the first r components are exactly z1 = h(x), z2 = Lf h(x), . . ., zr = Lr−1
f h(x). In terms of
trajectories, this means thatk
z1 (t) = y(t) , z2 (t) = y (1) (t) , . . . zr (t) = y r−1 (t)
for all t in a sufficiently small interval [t0 , t1 ]. In view of this, and due to the choice of the other
n − r components of the diffeomorphism Φ(x), the system (1) in the new coordinates has the form
ż1 = z2
ż2 = z3
..
.
żr−1 = zr
żr = a(z) + b(z)u (5)
żr+1 = qr+1 (z)
..
.
żn = qn (z)
y = z1

5
u ẋ = f (x) + g(x)u y
1
v b(z)
v + y = h(x) x

z
− a(z)
b(z)
Φ(x)

Figure 2: Feedback linearization control

where
a(z) = Lrf h(x)|x=Φ−1 (z) , b(z) = Lg Lr−1
f h(x)|x=Φ−1 (z) ,

qi (z) = Lif (x)|x=Φ−1 (z) , i = r + 1, . . . , n .


The system written in the form (5) is said to be in normal form. It is worth noting that only the
derivative of the r-th component of z depends on the input u. This is a consequence of both a
suitable choice of φr+1 (x), . . . , φn (x), as suggested by Theorem 3.2, and the definition of relative
degree.

2.4 Input/output linearization


Let us finally turn our attention to the problem of finding a feedback control law of the kind (2)
such that the closed loop system (3) has a linear input/output mapping between v and y. If the
system (1) has relative degree r in x◦ then it can be put into the normal form (5) by means of
the coordinate transformation we have previously discussed. Note that the assumption of relative
degree r implies that, at the point z ◦ = Φ(x◦ ) we have

b(z ◦ ) = Lg Lr−1
f h(x◦ ) 6= 0 .

As b(z) is a smooth function, b(z) 6= 0 in a neighborhood z ◦ . Consider the feedback law (see Figure 2)
1
u= [−a(z) + v] , (6)
b(z)

which in the original coordinates x reads as


1
−Lrf h(x) + v .
 
u=
Lg Lr−1
f h(x)

The feedback law (6), which is well defined in a neighborhood of z ◦ (x◦ in the original coordinates)
yields the closed loop system
ż1 = z2
ż2 = z3
..
.
żr−1 = zr
żr = v (7)
żr+1 = qr+1 (z)
..
.
żn = qn (z)
y = z1 .

6
It is easy to see that the control law has acted in such a way that the closed loop system has
been split into a linear and a nonlinear part. More precisely, let z = col(ξ, η), with dim ξ = r and
dim η = n − r. System (7) can be rewritten as

ξ˙ = Aξ + Bv
y = Cξ (8)
η̇ = q(η, ξ)

where    
0 1 0 ··· 0 0
0 0 1 ··· 0 0  
A= , B = . , C= 1 0 ··· 0 .
   
..  .. 
 . 
0 0 0 ··· 0 1

The interconnection between the two subsystem is depicted in Figure 3. For the closed loop system
in Figure 2, the I/O map between v ed y is that of the linear system (A, B, C) with transfer function
1
G(s) = C(sI − A)−1 B =
sr
which is the transfer function of a chain of r integrators. It is easy to see that r is precisely the
difference between the degree of the denominator polynomial of G(s) and the degree of its numerator
polynomial.

v y
- G(s) -

ξ
?
η̇ = q(η, ξ)

Figure 3: The closed-loop system

It is worth noting that the control law (6) has rendered the partial state η unobservable from the
output y. Also, keep in mind that the control law (6), and consequently the closed loop system (8),
remain valid only in the neighborhood of the point x◦ at which the relative degree is defined.

If the system has relative degree n, then the diffeomorphism Φ(x) is found immediately as
 
h(x)
 Lf h(x) 
Φ(x) =  .. ,
 
 . 
Lfn−1 h(x)

and the linearizing feedback


1
v − Lnf h(x)
 
u=
Lg Lfn−1 h(x)

7
yields the n dimensional linear closed loop system

ż1 = z2
ż2 = z3
..
. (9)
żn−1 = zn
żn = v
y = z1 .

It is thus clear that our ability to find a change of coordinates and a feedback law that at the same
time produces a linear I/O map and transform the original nonlinear system into a linear system
depends exclusively on an intrinsic property of the nonlinear system, that is, its relative degree at a
point. Note that the relative degree of a system remains the same independently of the chosen set
of coordinates.

2.4.1 Example [1]


Consider the controlled Van der Pol oscillator
ẋ1 = x2
ẋ2 = −x1 + (1 − x21 )x2 + u
y = x1 .

The system has global 4 relative degree 2 with respect to the given output. It is easy to see, in fact,
that the system is already in normal form, with

a(x) = −x1 + (1 − x21 )x2 , b(x) = 1 .

The linearizing feedback is therefore given by

u = x1 − (1 − x21 )x2 + v

which produces the closed loop system

ẋ1 = x2
ẋ2 = v
y = x1 .

Assume, on the other hand, that the output for the system is given by y = x 21 + x2 . It is easy to say
that in this case the system has global relative degree 1, since

Lg h(x) = 1 , ∀ x ∈ R2 .

The choice for the first function of the coordinate transformation is obviously φ 1 (x) = h(x) = x21 +x2 .
For the second function φ2 (x), we are free to choose any function which form a local diffeomorphism
with φ1 (x) and such that Lg φ2 (x) = 0. For instance, z2 = x1 is a good choice, since
 2 
x1 + x 2
Φ(x) =
x1

yields the jacobian matrix  


∂Φ 2x1 1
=
∂x 1 0
4 That is, for each x ∈ R2 .

8
which is nonsingular for any x ∈ R2 . The inverse transformation is readily seen to be
 
−1 z2
x = Φ (z) = .
z1 − z22

In the new coordinates (z1 , z2 ) the system has the form

ż1 = 2z1 z2 − 2z23 − z2 + z1 − z22 − z1 z22 + z24 + u


ż2 = z1 − z22
y = z1

and the linearizing feedback is

u = v − 2z1 z2 − 2z23 − z2 + z1 − z22 − z1 z22 + z24 .




The closed loop system is given by


ż1 = v
ż2 = z1 − z22
y = z1
which is clearly decomposed into a linear subsystem (actually, an integrator) and a nonlinear, un-
observable subsystem.

2.5 Inner-loop / outer-loop control


Feedback linearization is an effective method to implement a multi-loop controller for nonlinear
systems. Basically, the idea is to render the input/output map of a given nonlinear system that of
a linear system, and then apply a linear feedback to achieve the control objectives. To clarify this
idea, assume that we want to regulate the output y of the system (1) to a constant setpoint y d . For
the sake of simplicity, assume also that the system (1) has relative degree n for all x ∈ R n . Then,
there exists a change of coordinates z = Φ(x) and a feedback control of the form (6) such that the
closed loop system reduces to the chain of integrators

y (n) (t) = v(t) .

At this point, define the setpoint error e1 (t) = y(t) − yd , and, since yd is constant, note that e(t)
satisfies
(n)
e1 (t) = v(t) .
The above equation has state-space realization

ė = Ae + Bv
e1 = Ce

where e = col(e1 , e2 , . . . , en ) and, as before,


   
0 1 0 ··· 0 0
0 0 1 · · · 0 0  
A= , B = . , C= 1 0 ··· 0 .
   
..  .. 
 . 
0 0 0 ··· 0 1

In order to drive the error to zero asymptotically it suffices to compute a state feedback matrix
K ∈ R1×n such that A + BK has all eigenvalues with Re[s] < 0, which exists since the pair (A, B)
is controllable, and apply the outer/loop control v = Ke. The resulting control system is shown in
Figure 4.

9
inner loop

(yd 0 . . . 0)T − e u ẋ = f (x) + g(x)u y


1
K b(z)
+ y = h(x) x
+
z
z
− a(z)
b(z)
Φ(x)
outer loop

Figure 4: Multiloop nonlinear controller

3 Mathematical Model of the Flexible Joint


In this section, we consider the single-link manipolator with flexible joint operating on a vertical
plane. The main difference from the model of the flexible joint manipulator on a horizontal plane
considered in the previous experiment is the presence of gravity, which introduces a nonlinearity in
the equations of the dynamics. The mathematical model of the dynamics of the link with flexible
joint in vertical position is easily obtained from Lagrange’s equations of motion. It is clear that the
systems has two degrees of freedom, corresponding to the rotation of the motor shaft with respect
to a coordinate frame fixed to the base, and the rotation of the flexible joint to which the link is
attached with respect to the motor. The generalized coordinates are therefore the angular position
of the motor θ and the angular displacement of the flexible joint α (see Figure 5). The potential
and kinetic energy of the system are given respectively by

K = K h + Kl , V = V g + Vs

being

Vg = mgh cos(θ + α)
1
Vs = Ks α 2
2
1
Kh = Jh θ̇2
2
1
Kl = Jl (θ̇ + α̇)2 ,
2

Figure 5: Definition of generalized coordinates for the link

10
where Vg is the potential energy due to gravity, Vs is the potential energy due to the springs, Kh is
the kinetic energy of the hub, and Kl is the kinetic energy of the load. Also, m is the mass of the
shaft, g is the gravity constant, h is the height of the center of gravity of the link with respect to
the rest position, Jh is the inertia at the motor output, Jl is the inertia of the arm, and Ks is the
spring stiffness. The value of the constant Ks depends on the way the springs are attached to the
link. Following the Quanser manual, the expression for Ks is
2R  3

Ks = 3 (Dd − Rr 2 )Fr + (D 2 d − DLd + Rr 2 L)K
D2
D = r 2 + (R − d)2 ,

where R is the arm anchor point, d is the body “Y” anchor point, r is the body “X” anchor point,
K is the spring stiffness, Fr is the spring restoring force, and L is the spring length at rest. The
values of the constants can be found in Table 1.

The Lagrangian is given by L = K − V, and the Lagrange equations of motion read as


d ∂L ∂L
− = 0
dt ∂ α̇ ∂α
d ∂L ∂L
− = τ,
dt ∂ θ̇ ∂θ
which yield, after easy manipulations,

Jl θ̈ + Jl α̈ + Ks α − mgh sin(θ + α) = 0
(10)
(Jh + Jl )θ̈ + Jl α̈ − mgh sin(θ + α) = τ

In the above equations, τ is the torque produced by the motor. The torque is commanded by the
voltage v applied to the armature, which represent the control input to the system. The relationship
between the torque and the applied voltage is given in the Quanser lab manual as

v = iRm + Km Kg ω

which gives
v Km Kg
i = − ω,
Rm Rm
being ω the angular velocity of the motor, i the armature current, and Rm the motor resistance,
and Km and Kg constant parameters. Since
τ
i =
Kg Km
θ̇ = ω,

we obtain the desired relationship as


2
Km Kg Km Kg2
τ = v− θ̇.
Rm Rm
Choosing

θ = x1
α = x2
θ̇ = x3
α̇ = x4 ,

11
Parameter Symbol Value
Spring Stiffness Ks 1.61 [N/m]
Inertia of hub Jh 0.0021 [Kgm2 ]
Link Mass m 0.403 [Kg]
Grav. Const. g -9.81 [N/m]
Height of C.M. h 0.06 [m]
Motor Const. Km 0.00767 [N/rad/s]
Gear Ratio Kg 70
Load Inertia Jl 0.0059 [Kgm2 ]
Motor Resist. Rm 2.6 [Ω]

Table 1: Plant parameters

the system is written as

x˙1 = x3
x˙2 = x4
2
Ks Km Kg2 Km Kg
x˙3 = x2 − x3 + v
Jh Rm Jh Rm Jh
2
Ks Km Kg2 Km Kg Ks mgh
x˙4 = − x2 + x3 − v− x2 + sin(x1 + x2 ) .
Jh Rm Jh Rm Jh Jl Jl
Letting u = v, and choosing as output the tip position y = x1 + x2 , the system can now be given
the usual state-space form
ẋ = f (x) + g(x)u
(11)
y = h(x) ,
being  
x3
x4
 
 
f (x) = 
 2

Ks Km Kg2
Jh x 2 − R m Jh x 3

 
 2

Km Kg2
−( K
Jh +
s Ks
Jl )x2 + mgh
Jl sin(x1 + x2 ) + R m Jh x 3

0
 

 0 

g(x) = 
 Km Kg ,
 h(x) = x1 + x2 .
 R m Jh 
K K
− Rm g
m Jh

4 Problems
In preparation for the laboratory, you are asked to solve the following problems:

• Problem 1 Determine the relative degree of the flexible joint manipulator model (11) with
respect to the given input and the given output. Is the relative degree of the system (11)
dependent on the state x?

• Problem 2 Compute a change of coordinates z = Φ(x) that puts the given system in normal
form.

12
• Problem 3 Find a feedback linearizing control u = α(x)+β(x)v. What is the transfer function
G(s) of the closed loop system between the new input v and the output y?

• Problem 4 Implement the original plant model and the linearizing controller in Simulink.

• Problem 5 Compute an outer loop state-feedback linear controller v = Kz that regulates the
tip position y(t) to a constant setpoint yd . You can use either LQR or pole placement.

• Problem 6 Implement the resulting multiloop controller in Simulink. Perform simulations to


test your design.

13

You might also like