Linear Quadratic Regulator Control of an Inverted Pendulum with Friction

The linear quadratic regulator (LQR) method is used to generate a control force that brings an inverted pendulum from an initial condition back to the upright position in an optimal way. The state space is used to represent the dynamics of the system. Static and Coulomb friction forces act as external disturbances. Coulomb friction causes an oscillation of the cart position around the equilibrium position (). When only viscous friction is present, LQR brings the pendulum to the upright position since viscous friction is included in the state matrix, while Coulomb friction is included in neither the nor the matrix. A standard friction model is used and is described below. The eigenvalues of the closed-loop state matrix (where is the gain vector generated by LQR) are all located in the left side of the complex plane, showing that the resulting system is stable.



  • [Snapshot]


Let be the mass of the cart, the mass of the pendulum bob, and the length of the pendulum. The kinetic energy of the system is and the potential energy is . Hence the Lagrangian is and the equation of motion for the cart is , where is the applied force and is the force due to friction. The equation of motion for the bob mass is .
The friction model used is the following: let be the static, Coulomb (kinetic), and viscous friction coefficients, respectively. Let be the normal force, which is . When the speed of the cart is zero and then the friction force is , and when , then the friction force is . When the speed of the cart is not zero, then . The value of is normally less than . You can use the sliders to change the values of these coefficients.
The applied force is found by using the LQR (linear quadratic regulator) method. This force is applied in order to bring the cart to the position with the pendulum in the upright position.
The table at the top of the display shows simulation information. The field labeled "" is the applied force (the state feedback control force found by LQR), the field labeled is the Coulomb friction force, and the field labeled is viscous force, with all units in Newtons. The sign indicates the direction of the force at that moment of the simulation.
You can adjust the weights used by LQR by adjusting the slides that represent the entries in the matrix diagonal. The documentation for Mathematica's built-in function LQRegulatorGains (link below) explains more about the Q matrix.
You can change the initial angle position of the inverted pendulum and the initial cart position using the sliders.
For more information on the derivation of the equations of motion, see the author's report on inverted pendulum.
[1] R. Soutas-Little and D. Inman, Engineering Mechanics Dynamic, New Jersey, Prentice–Hall, 1999.
[2] D. Guida, F. Nilvetti, and C. M. Pappalardo, "Dry Friction of Bearings on Dynamics and Control of an Inverted Pendulum," Journal of Achievements in Materials and Manufacturing Engineering, 38(1), 2010 pp. 80–94.
[3] S. Campbell, S. Crawford, and K. Morris, "Friction and the Inverted Pendulum Stabilization Problem," Journal of Dynamic Systems, Measurement, and Control, 130(5), 2008.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+