Professional Documents
Culture Documents
Inverted Pendulum5 LQ Control 1
Inverted Pendulum5 LQ Control 1
Inverted Pendulum by
PIC Control
Self-Standing Robot
5. LQ Control
May 2017
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 1
Table of Contents
1. Object..................................................................................................................................... 2
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 2
1. Object
The basic lectures of inverted pendulum, about system dynamics, mathematical simulation,
electrical circuit and software, have been explained in passed lectures. And following documents
have been submitted.
1. Motion Equation
2. Control & Simulation
3. Circuit Diagram
4. Programming
We studied the state feedback control method at lecture 2 of “Control & Simulation”. In this lecture
5 studies about optimum control of state feedback. In generally the optimum control is called
optimum regulator or “Linier Quadratic Control” (LQ Control).
At designing the state feedback system, the feedback gain matrix F is determined by using pole
assignment method. But that method is not so good to imagine actual system activity. In other words,
it is hard to imagine that how the behavior of the system turns out by the position of poles. If a
system is high-dimensional, it will become difficult all the more.
On the other hand, at the optimum regulator method, you can set an evaluation function, and then
the optimum regulator will calculate the optimum gain F to make minimize that evaluation function.
You can set the value of evaluation function freely and it is easy way to understand the system
behavior. The LQ control is a popular method of modern control algorithm.
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 3
2. Basics of Optimum Regulator (Linier Quadratic Control)
Consider the following system. The system must be controllable to apply LQ control method.
Ẋ =AX + BU (1)
Z=MX
On the optimum regulator theory, set the following evaluation function and calculate the state
feedback U that lets minimum J.
∞
J=∫ ( Z Z +U RU ) dt
T T
(2)
The state feedback U and feedback gain F are as follows
U =−FX=−R B PX
−1 T (3)
F=−R B P
−1 T (4)
The R is a constant symmetric matrix of positive. The P is a result of following Riccati equation,
and constant symmetric matrix of positive.
T
A P+ PA−PBR B P+ M M =0
−1 T T (5)
∞
J=∫ ( X QX +U RU )dt
T T
(6)
T
A P+ PA−PBR B P+Q=0
−1 T (7)
The method of solving the (7) Riccati equation is, set to initial value P(0)=0 and calculate it in
reverse time.
Resolve (8) in reverse time, then P(t) converges in a constant value.
T
− Ṗ= A P+ PA−PBR B P+Q
−1 T (8)
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 4
3. Application to the Inverted Pendulum
As the controllability of inverted pendulum system has been proved at lecture 2, then it is possible
to design the optimum regulator. The state matrix is as follows.
[ ] [ ][ ] [ ]
ẍ a11 0 a13 a 14 ẋ b1
ẋ = 10 0 0 x+ 0 V (10)
S
θ̈ a31 0 a33 a 34 θ̇ b3
θ̇ 0 0 10 θ 0
[ ][ ]
10 0 0 ẋ
Y= 0 10 0 x (11)
0 0 10 θ̇
0001 θ
2 2 2
a 0=J θ ( M + m) + Mm L b 1=( J ¿ ¿ θ+ m L )2 K F /a0 a11=−(J ¿ ¿ θ+m L )C B /a0 ¿ ¿
b 3=−mL2 K F /a0
a 13=m L/a 0
2 2
a 14=−m L g /a0
a 31=mL C B /a0
a 33=−(M +m)C R /a0
a 34=( M +m)mgL /a0
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 5
[ ]
Q11 0 0 0
0 Q 22 0 0
Q= (12)
0 0 Q33 0
0 0 0 Q44
R (scalar) (13)
[ ]
10 0 0
Q= 0 10 0 (13)
0 0 100 0
0 0 0 100
R = 0.01 (14)
Use the SCILAB to solve (8) Riccati equation. Next section describes about detail procedure.
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 6
4. Simulation & Programming
Basic operation of SCILAB is already explained in the lecture 2 “Control and Simulation”. And
the “sec” program and “Xcos” GUI program already exist. In this lecture, add the calculating
program of Riccati equation into to the existing “sec” file. The feedback gain F is only changed at
this LQ control, and the “Xcos” GUI program is not need to modify.
Calculating procedures of optimum gain F is as follows.
Open the “INV_PEND_simulation_NO2.sec” file. This file is made at “2 Control and Simulation”.
Add following program.
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 7
Depress the “save and execute” button in the “SciNotes” window. Next key input “F” in the
console window, then calculated feedback gain are displayed.
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 8
Fig-4.3 Time Response of Control Input (Vs)
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 9
When previous Fig-4.2 and Fig-4.3 are displayed, confirm the difference of Section 2 simulation
results. The wave forms are a little changed. Especially, overshoot of control input Vs is almost
disappeared at LQ control. It means that the LQ control minimize the control input.
Next is that change the weight of Q and R as you want, and confirm how simulation changes. And
check the position of poles and display Nyquist diagram.
Key input “F2” into the console window, then the converted feedback gain “F2” is displayed as
follows. This “F2” is the feedback gain for PIC programming.
It’s not necessary to change the PIC program, only must to modify the feedback gain.
Title No Revision 0
Inverted Pendulum by PIC Control
5. LQ Control Page 10