📊

Linear Quadratic Regulator (LQR) on Inverted Pendulum

May 13, 2024

Lecture Notes: Introduction to Linear Quadratic Regulator (LQR) Control

Overview of the Inverted Pendulum System

  • System Components: Inverted pendulum on a cart.
  • Steps Taken:
    • Simulated the full nonlinear system without control.
    • Linearized the system around the fixed point where the pendulum is upright.
    • Obtained the A matrix (system dynamics) and D matrix.
    • Verified system controllability by checking the rank of the controllability matrix, confirming it spans the four-dimensional state space.

Introduction to Control Design

  • Objective: Stabilize the unstable inverted pendulum configuration using full state feedback control (u = -Kx).
  • Key Concept: Ability to place eigenvalues of the closed-loop system anywhere desired by designing an appropriate gain matrix K.

The Problem of Pole Placement

  • Challenge: Determining the optimal placement of poles or eigenvalues for system stability.
  • Solution: Utilize the Linear Quadratic Regulator (LQR) for deciding the best placement of poles to achieve desired performance.

Linear Quadratic Regulator (LQR) Control

  • Purpose: Optimally chooses control actions to minimize a defined cost function over time.
  • Components:
    • Cost Function (J): Integrates penalties for state deviation and control effort over time.
    • Q Matrix: Penalizes deviation of state from desired values. Should be positive semi-definite.
    • R Matrix: Penalizes magnitude of control effort.
  • Operation: MATLAB lqr function computes the optimal gain matrix K that minimizes the cost function.
  • Q and R Matrices Configuration: The choice of Q and R reflects the trade-off between state stability and control effort.

Practical Implementation in MATLAB

  • Procedure:
    • Start with initial Q and R values, adjusting based on desired performance.
    • Apply the lqr function with system dynamics (A, B matrices) and desired Q, R matrices to obtain the optimal gain matrix K.
    • Simulate the nonlinear system with the designed controller to observe stabilization performance.
  • Results: Successful stabilization of the inverted pendulum with adjustable aggressiveness of control based on Q, R configurations.

Insights and Applications

  • Fine-tuning Q and R allows control over system responsiveness and energy consumption.
  • The LQR approach provides a systematic way to achieve optimal control with respect to a defined cost function, making it a powerful tool in control theory.
  • Real-world Applicability: Despite being computationally expensive for high-dimensional systems, LQR is highly effective for systems of manageable size and complexity, like the four-dimensional inverted pendulum system illustrated in the example.

Conclusion

  • LQR offers a mathematically rigorous, yet intuitively accessible method for designing controllers that balance system performance with control effort, demonstrating its value in practical control system design.