Back to Projects

LQR and LQG Controllers for Dual-Load Crane System

Crane Control System Demo

Project Overview

This project focuses on the development of advanced control strategies for a crane system, specifically utilizing Linear Quadratic Regulator (LQR) and Linear Quadratic Gaussian (LQG) controllers. The primary objective is to achieve precise positioning of the crane’s trolley while minimizing the oscillations of the suspended payloads. This is particularly challenging due to the system’s inherent instability and oscillatory nature.

System Modeling

The crane system is modeled as a cart (trolley) moving along a one-dimensional track with two suspended pendulums representing the payloads. The dynamic equations governing the system are derived using Lagrangian mechanics, resulting in a set of nonlinear differential equations. For controller design purposes, these equations are linearized around the equilibrium point where the pendulums hang vertically downward.

Equations of Motion

The system’s behavior is described by nonlinear equations of motion derived using Newtonian mechanics. These equations account for the translational motion of the cart and the rotational motion of the suspended loads.

Linearization

To facilitate controller design, the nonlinear equations are linearized around the equilibrium point where the cart is at rest, and the loads hang vertically. This linearization simplifies the system into a state-space representation suitable for applying linear control techniques.

State-Space Representation

The linearized system is expressed in state-space form as follows:

\[\dot{x} = Ax + Bu\] \[y = Cx + Du\]

Where:

Controllability and Observability Analysis

Controllability Analysis

Controllability determines whether it’s possible to move the system from any initial state to any desired final state using appropriate control inputs. For the linearized crane system, the controllability matrix is constructed and analyzed. The system is found to be controllable if the matrix has full rank, indicating that all state variables can be influenced by the control inputs.

Observability Analysis

Observability assesses whether the system’s internal states can be inferred from its outputs. By examining different output configurations, the observability matrix is constructed and analyzed. A full-rank observability matrix indicates that the system’s states can be accurately estimated from the outputs.

Controller Design

Linear Quadratic Regulator (LQR)

The LQR controller is designed to provide optimal state feedback control by minimizing a cost function that balances state errors and control effort. The cost function is defined as:

\[J = \int_{0}^{\infty} (x^T Q x + u^T R u) dt\]

Where:

The optimal control law is given by: \(u = -K \hat{x}\) Where ( K ) is the gain matrix computed by solving the Riccati equation.

Implementation of LQR

Linear Quadratic Gaussian (LQG)

In practical scenarios, not all states may be measurable, and measurements are often corrupted by noise. The LQG controller addresses this by combining the LQR controller with a Kalman filter, which estimates the system states from noisy measurements. The Kalman filter provides an optimal estimate of the state vector $ \hat{x} $, which is then used in the control law:

\[u = -K \hat{x}\]

This approach ensures robust performance even with partial and noisy state information.

Luenberger Observer Design

For observable systems, a Luenberger observer is designed to estimate the internal states based on output measurements. The observer uses the system’s outputs and a model of its dynamics to provide real-time state estimates, which are crucial for state-feedback control strategies.

Implementation of LQG

Technical Architecture

System Modeling

function [A, B, C, D] = getCraneModel()
    % System parameters
    m1 = 1.0;  % Mass of load 1
    m2 = 1.5;  % Mass of load 2
    L1 = 2.0;  % Cable length 1
    L2 = 2.5;  % Cable length 2
    g = 9.81;  % Gravity
    
    % State space matrices
    A = [0 1 0 0 0 0;
         g/L1 0 0 0 0 0;
         0 0 0 1 0 0;
         0 0 g/L2 0 0 0;
         0 0 0 0 0 1;
         0 0 0 0 0 0];
         
    B = [0; 0; 0; 0; 0; 1];
    C = eye(6);
    D = zeros(6,1);
end

Implementation Details

Controller Design

% LQR Design
Q = diag([10 1 10 1 10 1]);
R = 0.1;
[K, P, E] = lqr(A, B, Q, R);

% Kalman Filter Design
Qn = diag([0.1 0.1 0.1 0.1 0.1 0.1]);
Rn = diag([0.01 0.01 0.01 0.01 0.01 0.01]);
[L, P, E] = lqe(A, eye(6), C, Qn, Rn);

% LQG Controller
sys_lqg = ss(A-B*K-L*C, L, -K, 0);

Performance Metrics

Control Performance

Simulation and Results

Simulations were conducted to evaluate the performance of the designed controllers. The system was subjected to various scenarios, including setpoint changes and external disturbances. Key performance metrics such as settling time, overshoot, and oscillation damping were analyzed.

Key Findings

Conclusion

The implementation of LQR and LQG controllers for the crane system demonstrates the efficacy of modern control techniques in managing complex, oscillatory systems. The controllers achieve precise trolley positioning while minimizing payload sway, enhancing both safety and efficiency in crane operations. Extensive simulations confirm that both controllers effectively stabilize the crane system, with the LQG controller offering superior performance in the presence of noise.

Resources