Academic Project

LQR Trajectory Control of a Quadcopter Drone

Duration 2 Months
Team 2 Members
Tools MATLAB/Simulink, FlightGear
200 m
Maximum Climb Altitude
60 m
Circular Trajectory Radius
6
Independent LQR Controllers
13 m/s
Vertical Climb Speed

Optimal Control for Multi-Phase Trajectory Tracking

This project designs and validates a Linear-Quadratic Regulator (LQR) to control a quadcopter drone through a two-phase autonomous mission: a vertical climb followed by a circular trajectory. The controller is built on a linearized state-space model of the drone's translational and rotational dynamics and validated in MATLAB/Simulink, with a 3D visualization in FlightGear.

Contributions

Project carried out with one teammate, covering the full chain from optimal-control theory to a validated flight simulation: system linearization, LQR controller design for all six degrees of freedom, and simulation/visualization in MATLAB and FlightGear.

System Modeling

Linearized the quadcopter's roll, pitch, yaw and translational dynamics into state-space form for controller design.

LQR Controller Design

Designed 6 independent LQR controllers (height, x/y position, roll/pitch, yaw) using MATLAB's lqr(A,B,Q,R) function.

Control Architecture

Implemented a dual-loop structure, an outer position loop feeding an inner attitude loop, for multi-phase trajectory tracking.

Simulation & Visualization

Validated the closed-loop system in MATLAB/Simulink and produced a 3D flight visualization in FlightGear.

LQR Fundamentals

The LQR is an optimal control method that finds the control input minimizing a quadratic cost function while respecting the system's linear dynamics, trading off state-tracking performance against control effort.

Cost Function

J = ∫[xᵀQx + uᵀRu] dt the term xᵀQx penalizes state deviations, while uᵀRu penalizes control effort. Q and R are tuned to trade off performance against actuation energy.

Optimization Problem

Minimize J subject to the linear dynamic constraint ẋ = Ax + Bu, yielding the optimal control law u*(t) = -Kx(t).

Riccati Equation

The optimal gain is obtained by solving the Algebraic Riccati Equation (ARE): AᵀP + PA - PBR⁻¹BᵀP + Q = 0, for a unique symmetric positive-definite P when (A,B) is stabilizable.

Optimal Gain

K = R⁻¹BᵀP a constant, optimal, stabilizing gain, computed in MATLAB via are(A, B*inv(R)*B', Q) or the lqr() function.

Dynamics & Control Architecture

The quadcopter's nonlinear dynamics were linearized around hover into independent state-space subsystems for roll, pitch, yaw and translational motion (x, y, z), each driven by a corresponding control input. A dual-loop architecture was then implemented: an outer position-control loop generates attitude references, which feed an inner attitude-control loop producing the four motor commands.

Block diagram of the dual-loop position and attitude control architecture
Dual-Loop Control Architecture (Position & Attitude)

LQR Tuning

Six independent LQR controllers were tuned in MATLAB using diagonal Q and R weighting matrices, one pair per controlled axis, via the lqr(A,B,Q,R) function.

Controller Q R
Altitude (z)diag([5, 1])3
Position (x / y)diag([15, 1])1000
Roll / Pitchdiag([25, 1])200
Yawdiag([7, 1])1
LQR Weighting Matrices

Simulation Results

Simulated position trajectories of the quadcopter during the climb and circular flight phases
Position Trajectories
Simulated velocity profiles of the quadcopter throughout the mission
Velocities
3D and 2D visualization of the quadcopter's flight path
3D/2D Visualization
Euler angle response of the quadcopter under LQR control
Euler Angles — LQR Control
Motor rotation speeds and generated thrust during the mission
Motor Rotation Speeds & Generated Thrust

The controller tracked both mission phases accurately: a stable vertical climb to 200 m followed by a well-maintained 60 m radius circular trajectory, with bounded Euler angles and smooth motor commands throughout.

Takeaways

The LQR controller proved effective for multi-phase trajectory control of a quadcopter, combining a rigorous optimal-control formulation with a practical dual-loop implementation validated in simulation.

View FlightGear Visualization Download Simulation Files