1. Abstract— In this lab, students were tasked with calculating
the Furuta pendulum system gain values using the LQR method
for the pendulum up position. The LQR (linear-quadratic
regulator) method is a way to calculate system gains that allows
for optimal control of a dynamic system at a minimum or optimal
cost. This is done by using the system inputs (A and B matrices),
system outputs (C and D matrices) and weightings for cost and
control. Using these values along with Matlab, the system gains
can be calculated.
Index Terms—Furuta pendulum, LQR method, optimization,
pendulum up
I. INTRODUCTION
his lab tasked students to calculate the Furuta pendulum
system gain values using the LQR method for the
pendulum up position. This was done by using the LQR
method. The LQR method is frequently used to optimize
control systems in real-world applications where the amount
(or weighting) of control effort must be weighed against the
cost of the controller. This is done typically because the
amount of control effort is directly proportional to the cost of
implementing the controller. This is due to the fact that
increasing control effort typically requires more feedback
sensors and programming which all contribute to a higher
overall cost of implementing the controller. The goal of this
lab is for students to find a good balance with regards to cost
and control effort while still balancing the pendulum in an
upward position.
II. PROCEDURE
A. System hardware setup
This lab has the same setup that has been used in both lab 3
and lab 4. The Furuta pendulum consists of a swing-arm and a
pendulum arm that are controlled using full-state feedback.
Each arm has its own encoder and motor that allows for
students to control the system using the DAQ and LabView.
B. Implementation of LQR method
The LQR method is performed by first obtaining the input
matrices A and B described by the following equations:
𝑥 = 𝐴𝑥 + 𝐵𝑢̇ (1)
The A and B matrices are obtained from the parameterized
system values/state-space system representation found in labs
3 & 4. The quadratic cost function that is used in the LQR
method is found using the following equation:
𝐽 = 𝑥 𝑇(𝑡1)𝐹(𝑡1)𝑥(𝑡1) + ∫ (𝑥 𝑇
𝑄𝑥 + 𝑢 𝑇
𝑅𝑢)𝑑𝑡
𝑡1
𝑡0
(2)
Where R is the matrix which sets the cost/weightings of the
control and Q is the matrix that sets the cost/weightings of the
errors in the states. The input vector u is the full-state
feedback law:
𝑢 = −𝐾𝑥 (3)
And where the vector of gains, K, are found using the
following formula:
𝐾 = 𝑅−1
(𝐵 𝑇
𝑃(𝑡)) (4)
Where B is one of the input matrices and P is found by
solving the continuous time Riccati differential equation. [1]
The system gains using the LQR method were found using
Matlab. In the Matlab code, the user is required to input the
input (A and B) and output (C and D) matrices found using the
parameterized system values found in lab 3 and the targeted
pole locations found in lab 4 using the pole placement subVI
in LabView. These matrices represent the input/output
dynamics of the system in a state-space fashion and are
necessary for implementing the LQR method Matlab code. In
addition, the user must input the R vector which sets the
cost/weightings of the control and the Q matrix sets the
cost/weightings of the errors in the states. Figure 1 shows the
Matlab code that was used to find the system gain values using
the LQR method.
Final Project: Calculating Furuta Pendulum
System Gains Using LQR Method
Ballingham, Ryland & Levine, Tevan
Section 7042 12/7/16
T
2. <Section####_Lab#> Double Click to Edit 2
2
Fig.1. Matlab code used to implement LQR method
The code outputs four vectors of gain values. Using the lab
4 LabView VI, these gains are then tested on the actual
system. Table 1 in the results section shows the gain values
that were obtained using this code. The R matrix was found
through a lot of trial and error experimenting with a range of
different R values on the physical Furuta pendulum system.
The Q matrix was determined based on trying to get gain
values similar to the gains found by using pole-placement in
LabView. [1]
C. Quantifying System Performance
System performance is quantified using the root mean
square formula to solve for errors. RMS error is shown below:
𝑥 𝑟𝑚𝑠 = √
1
𝑛
(𝑥1
2
+ 𝑥2
2
+ ⋯ + 𝑥 𝑛
2) (5)
RMS error was calculated for 𝜃1 and 𝜃2, where 𝜃1
represents the swing arm and 𝜃2 represents the pendulum arm.
III. RESULTS
TABLE I
GAIN/STATE VARIABLES
Gain Gain
Classification
State Variable State Variable
Measurement
𝒌 𝟏 Proportional 𝜃1 Swing arm
position
𝒌 𝟐 Proportional 𝜃2 Pendulum arm
position
𝒌 𝟑 Derivative 𝜃̇3 Swing arm
angular velocity
𝒌 𝟒 Derivative 𝜃4
̇ Pendulum arm
angular velocity
𝒌 𝟓 Proportional 𝑖 Motor current
TABLE II
SYSTEM WEIGHTINGS AND GAIN VALUES
R
value
Q value 𝒌 𝟏 𝒌 𝟐 𝒌 𝟑 𝒌 𝟒 𝒌 𝟓
1 40 -0.2635 1.3008 -0.1614 0.1966 0.0006
5 40 -0.1179 0.8997 -0.0913 0.1369 0.0005
7.5 40 -0.0962 0.8348 -0.0802 0.1271 0.0005
10 40 -0.0833 0.7948 -0.0734 0.1210 0.0005
Fig.2. Plot of swing arm position/vertical pendulum position and desired
swing arm position vs. time for R=1.
Fig.3. Plot of swing arm position/vertical pendulum position and desired
swing arm position vs. time for R=5.
3. <Section####_Lab#> Double Click to Edit 3
3
Fig.4. Plot of swing arm position/vertical pendulum position and desired
swing arm position vs. time for R=7.5.
Fig.5. Plot of swing arm position/vertical pendulum position and desired
swing arm position vs. time for R=7.5.
TABLE III
RMS ERROR
R Value Q Value RMS Error
𝜽 𝟏
RMS Error
𝜽 𝟐
1 40 0.343 0.101
5 40 0.710 0.119
7.5 40 0.328 0.074
10 40 0.544 0.125
IV. DISCUSSION
The purpose of the Final Project assignment was to build on
the full-state feedback controllers designed to control the
Furuta Pendulum system. Students are asked to find the
balance between cost effectiveness and control effort. This is
done by utilizing the LQR method. The matlab code was
implemented to find desired gain vectors based on the state-
space model that was found using LabView in previous labs.
Once the gains values were established, they were tested on
the physical Furuta Pendulum setup in lab. Using the rms
method, errors were calculated for both 𝜃1 and 𝜃2, where 𝜃1
corresponds to the swing arm and 𝜃2 corresponds to the
pendulum arm.
Referencing Table II, it can be seen that an R value of 7.5
yielded better results than any other R value. At an R value of
7.5, RMS error of both 𝜃1 and 𝜃2 was the smallest. Using an R
value of 1 yielded the next best results as RMS errors for both
theta’s were the next smallest. From the data taken, it is clear
that there is not a clear correlation in terms of R value
selection and lower RMS errors. Instead, certain values of R
yield more desired results than others, in no order. Given more
time to experiment with different R values and the Furuta
Penduum setup, RMS error could potentially be reduced even
further. Using R values that were too large, greater than ten,
the system was not able to command pendulum motion
efficiently. Large R values caused the system to become
unstable, yielding results that were undesirable.
For all gains used, the system yielded reasonably stable
results.
REFERENCES
[1] S. Banks, “EML 4314C Fall 2016 Lecture Notes”