The proliferation of multi-rotor unmanned aerial vehicles (UAVs), particularly the quadrotor drone, has marked a significant shift in aerial robotics. Their simple mechanical structure, often powered by efficient electric propulsion systems, offers a compelling combination of low manufacturing cost and exceptional operational agility. This versatility has catapulted them into widespread applications ranging from aerial cinematography and precision agriculture to environmental monitoring and infrastructure inspection. The accessibility of this technology owes much to the development and popularization of open-source flight control systems like APM, OpenPilot, and MWC, which have democratized advanced aerial capabilities. A common thread among these platforms is their reliance on Proportional-Integral-Derivative (PID) controllers for stabilizing the vehicle’s attitude—the orientation of the drone in three-dimensional space. While PID controllers have proven remarkably effective for general stable flight, their performance can be challenged under demanding operational scenarios.

In my research and development work, I have focused on pushing the boundaries of what a quadrotor drone can reliably achieve. Applications such as dynamic target tracking in cluttered environments, stable flight under significant atmospheric disturbances like strong wind gusts, or precise navigation within confined indoor spaces for search and rescue missions impose stringent requirements on the flight controller. These scenarios demand not just stability, but high performance metrics: rapid transient response to commanded maneuvers, excellent disturbance rejection, and robust operation across a range of flight conditions. While advanced control methodologies like adaptive control, model predictive control (MPC), and neural-network-based controllers have been explored in academic literature for quadrotor drone attitude regulation, their computational complexity often precludes real-time implementation on the resource-constrained, low-power microcontrollers typically employed in embedded flight control systems. This creates a critical engineering challenge: designing a controller that is both optimal in performance and feasible for real-time execution on limited hardware.
This article presents my comprehensive approach to this challenge through the design, simulation, and analysis of a Linear Quadratic Regulator (LQR) for quadrotor drone attitude control. LQR is an optimal state-feedback control technique that minimizes a user-defined cost function, effectively balancing the speed of response against the control effort expended. It provides a rigorous mathematical framework for achieving high-performance control that remains computationally tractable for embedded systems. The journey begins with the derivation of a high-fidelity non-linear dynamic model for a standard quadrotor drone. Following this, I will linearize the model around a hover condition—a standard and justified simplification for attitude control design. Based on this linear state-space representation, I will formulate the LQR optimization problem, detailing the selection of weighting matrices that shape the closed-loop response. Finally, I will validate the designed controller through high-fidelity simulations in MATLAB/Simulink, demonstrating its superior performance in tracking aggressive attitude commands with zero steady-state error, fast settling times, and inherent robustness properties.
1. Dynamic Modeling of a Quadrotor Drone
The foundation of any model-based control design is a accurate yet tractable mathematical representation of the system’s physics. For a quadrotor drone, we model it as a rigid body with six degrees of freedom (6-DOF): three for translational motion and three for rotational motion. The standard “plus” configuration is considered, with four rotors mounted at the ends of a symmetric cross structure. The first step is to define the necessary coordinate frames. Let \(\{I\} = \{X_I, Y_I, Z_I\}\) denote the inertial, earth-fixed frame. Let \(\{B\} = \{X_B, Y_B, Z_B\}\) denote the body-fixed frame attached to the center of mass of the quadrotor drone. The attitude of the vehicle is described by the Euler angles: roll (\(\phi\)), pitch (\(\theta\)), and yaw (\(\psi\)). These represent sequential rotations about the \(X_B\), \(Y_B\), and \(Z_B\) axes, respectively, that align the body frame with the inertial frame. The rotation matrix \(^I_B\mathbf{R}\), which transforms a vector from \(\{B\}\) to \(\{I\}\), is given by:
$$^I_B\mathbf{R} = \begin{bmatrix}
c_\theta c_\psi & s_\phi s_\theta c_\psi – c_\phi s_\psi & c_\phi s_\theta c_\psi + s_\phi s_\psi \\
c_\theta s_\psi & s_\phi s_\theta s_\psi + c_\phi c_\psi & c_\phi s_\theta s_\psi – s_\phi c_\psi \\
-s_\theta & s_\phi c_\theta & c_\phi c_\theta
\end{bmatrix}$$
where \(c_\alpha = \cos(\alpha)\) and \(s_\alpha = \sin(\alpha)\). The dynamics are derived using the Newton-Euler formalism, separating translational and rotational dynamics.
1.1 Translational Dynamics
The translational motion in the inertial frame is governed by Newton’s second law:
$$ m \ddot{\mathbf{p}} = \begin{bmatrix} 0 \\ 0 \\ -mg \end{bmatrix} + ^I_B\mathbf{R} \begin{bmatrix} 0 \\ 0 \\ F_{total} \end{bmatrix} $$
where \(m\) is the total mass of the quadrotor drone, \(\mathbf{p} = [x, y, z]^T\) is the position in \(\{I\}\), \(g\) is gravitational acceleration, and \(F_{total}\) is the total thrust force generated by all four rotors along the negative \(Z_B\) axis. For a quadrotor drone, the thrust from each rotor is proportional to the square of its rotational speed: \(F_i = k_f \omega_i^2\), where \(k_f > 0\) is the thrust coefficient and \(\omega_i\) is the angular speed of the \(i\)-th rotor. Thus, the total thrust is:
$$ F_{total} = k_f (\omega_1^2 + \omega_2^2 + \omega_3^2 + \omega_4^2) $$
1.2 Rotational Dynamics
The rotational dynamics in the body frame are governed by Euler’s rotation equation:
$$ \mathbf{I} \dot{\boldsymbol{\omega}} + \boldsymbol{\omega} \times (\mathbf{I} \boldsymbol{\omega}) = \boldsymbol{\tau} $$
where \(\boldsymbol{\omega} = [p, q, r]^T\) is the angular velocity vector expressed in \(\{B\}\), \(\mathbf{I}\) is the inertia tensor of the quadrotor drone (assumed diagonal \(\mathbf{I} = \text{diag}(I_{xx}, I_{yy}, I_{zz})\) due to symmetry), and \(\boldsymbol{\tau} = [\tau_\phi, \tau_\theta, \tau_\psi]^T\) is the vector of external torques applied to the body.
The control torques are generated by differentially varying the rotor speeds. For the standard configuration (rotors 1 & 3 clockwise, rotors 2 & 4 counter-clockwise), the mapping from rotor speeds to body torques and total thrust is:
| Axis | Control Input | Expression |
|---|---|---|
| Roll (\(\phi\)) | \(\tau_\phi\) | \(l k_f (-\omega_2^2 + \omega_4^2)\) |
| Pitch (\(\theta\)) | \(\tau_\theta\) | \(l k_f (-\omega_1^2 + \omega_3^2)\) |
| Yaw (\(\psi\)) | \(\tau_\psi\) | \(k_m (\omega_1^2 – \omega_2^2 + \omega_3^2 – \omega_4^2)\) |
| Thrust (Z) | \(F_{total}\) | \(k_f (\omega_1^2 + \omega_2^2 + \omega_3^2 + \omega_4^2)\) |
Here, \(l\) is the arm length (distance from rotor to CoM), and \(k_m\) is the rotor drag (yaw moment) coefficient. The relationship between the body angular rates \(\boldsymbol{\omega}\) and the Euler angle derivatives \(\dot{\boldsymbol{\eta}} = [\dot{\phi}, \dot{\theta}, \dot{\psi}]^T\) is given by:
$$ \boldsymbol{\omega} = \begin{bmatrix} 1 & 0 & -s_\theta \\ 0 & c_\phi & s_\phi c_\theta \\ 0 & -s_\phi & c_\phi c_\theta \end{bmatrix} \dot{\boldsymbol{\eta}} \quad \text{or} \quad \dot{\boldsymbol{\eta}} = \begin{bmatrix} 1 & s_\phi t_\theta & c_\phi t_\theta \\ 0 & c_\phi & -s_\phi \\ 0 & s_\phi/c_\theta & c_\phi/c_\theta \end{bmatrix} \boldsymbol{\omega} $$
where \(t_\alpha = \tan(\alpha)\). For small attitude angles near hover (\(\phi, \theta \approx 0\)), this relationship simplifies significantly: \(\boldsymbol{\omega} \approx \dot{\boldsymbol{\eta}}\).
1.3 Linearized Attitude Dynamics Model
For the specific purpose of designing an attitude stabilization controller, we focus on the rotational dynamics and assume the quadrotor drone is operating near a hover condition. This allows for linearization, a critical step for applying linear control theory like LQR. We make the following standard assumptions: the Euler angles \(\phi, \theta, \psi\) are small, yaw rate \(\dot{\psi}\) is small, and the aerodynamic drag and gyroscopic effects are negligible for initial controller design. Under these assumptions, the coupled, non-linear rotational dynamics simplify to three decoupled, second-order systems:
$$ \ddot{\phi} \approx \frac{l k_f}{I_{xx}} (u_\phi), \quad \ddot{\theta} \approx \frac{l k_f}{I_{yy}} (u_\theta), \quad \ddot{\psi} \approx \frac{k_m}{I_{zz}} (u_\psi) $$
Here, \(u_\phi, u_\theta, u_\psi\) are the normalized control inputs corresponding to roll, pitch, and yaw moments, respectively, derived from the rotor speed differentials. For a symmetric quadrotor drone where \(I_{xx} = I_{yy}\), the roll and pitch channels have identical dynamics. This decoupled linear model forms the basis for our controller design. Each axis can be represented as a double-integrator plant: \(\ddot{\alpha} = \kappa_\alpha u_\alpha\), where \(\alpha\) represents \(\phi, \theta,\) or \(\psi\).
2. LQR Controller Design for Attitude Regulation
The Linear Quadratic Regulator is a cornerstone of modern optimal control theory. For a linear time-invariant system, it provides a state-feedback control law that minimizes a quadratic cost function, balancing state deviations and control effort. Its computational elegance and strong stability guarantees make it an excellent candidate for implementation on the real-time embedded systems governing a quadrotor drone.
2.1 State-Space Formulation
First, we formulate the linearized attitude dynamics for one axis (e.g., roll) in state-space form. Let the state vector be \(\mathbf{x} = [\phi, \dot{\phi}]^T\) and the control input be \(u = u_\phi\). The system dynamics are:
$$ \dot{\mathbf{x}} = \begin{bmatrix} \dot{\phi} \\ \ddot{\phi} \end{bmatrix} = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} \mathbf{x} + \begin{bmatrix} 0 \\ \kappa_\phi \end{bmatrix} u $$
where \(\kappa_\phi = l k_f / I_{xx}\). The output \(y = \phi\) is simply the first state. This is a canonical representation of a double-integrator. For a quadrotor drone, we independently control three axes. The combined, decoupled state-space model for all attitudes is:
$$ \dot{\mathbf{X}} = \mathbf{A} \mathbf{X} + \mathbf{B} \mathbf{U}, \quad \mathbf{Y} = \mathbf{C} \mathbf{X} $$
with
$$ \mathbf{X} = \begin{bmatrix} \phi \\ \dot{\phi} \\ \theta \\ \dot{\theta} \\ \psi \\ \dot{\psi} \end{bmatrix}, \quad \mathbf{U} = \begin{bmatrix} u_\phi \\ u_\theta \\ u_\psi \end{bmatrix}, $$
$$ \mathbf{A} = \text{blockdiag}\left( \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix} \right), \quad \mathbf{B} = \text{blockdiag}\left( \begin{bmatrix} 0 \\ \kappa_\phi \end{bmatrix}, \begin{bmatrix} 0 \\ \kappa_\theta \end{bmatrix}, \begin{bmatrix} 0 \\ \kappa_\psi \end{bmatrix} \right), $$
$$ \mathbf{C} = \text{blockdiag}\left( \begin{bmatrix} 1 & 0 \end{bmatrix}, \begin{bmatrix} 1 & 0 \end{bmatrix}, \begin{bmatrix} 1 & 0 \end{bmatrix} \right). $$
Given symmetry, \(\kappa_\phi = \kappa_\theta\).
2.2 The LQR Optimal Control Problem
The LQR problem aims to find the optimal state-feedback control law \(\mathbf{U} = -\mathbf{K} \mathbf{X}\) that minimizes the infinite-horizon quadratic cost function \(J\):
$$ J = \int_{0}^{\infty} \left( \mathbf{X}^T \mathbf{Q} \mathbf{X} + \mathbf{U}^T \mathbf{R} \mathbf{U} \right) dt $$
Here, \(\mathbf{Q}\) is a symmetric positive semi-definite matrix that penalizes deviations of the state from zero, and \(\mathbf{R}\) is a symmetric positive definite matrix that penalizes control effort. The selection of \(\mathbf{Q}\) and \(\mathbf{R}\) is a design choice that directly shapes the closed-loop response. A larger penalty on states in \(\mathbf{Q}\) leads to a faster response but higher control activity, while a larger penalty in \(\mathbf{R}\) conserves control effort at the expense of slower response.
The optimal feedback gain matrix \(\mathbf{K}\) is given by:
$$ \mathbf{K} = \mathbf{R}^{-1} \mathbf{B}^T \mathbf{P} $$
where \(\mathbf{P}\) is the unique positive definite solution to the Algebraic Riccati Equation (ARE):
$$ \mathbf{A}^T \mathbf{P} + \mathbf{P} \mathbf{A} – \mathbf{P} \mathbf{B} \mathbf{R}^{-1} \mathbf{B}^T \mathbf{P} + \mathbf{Q} = \mathbf{0} $$
For our decoupled quadrotor drone system, the \(\mathbf{Q}\) and \(\mathbf{R}\) matrices are often chosen to be diagonal, allowing for intuitive tuning of each state and input independently. A typical structure might be:
$$ \mathbf{Q} = \text{diag}(q_\phi, q_{\dot{\phi}}, q_\theta, q_{\dot{\theta}}, q_\psi, q_{\dot{\psi}}), \quad \mathbf{R} = \text{diag}(r_\phi, r_\theta, r_\psi). $$
The solution for \(\mathbf{K}\) can be computed efficiently offline using standard numerical solvers (e.g., `lqr` in MATLAB), and the resulting gain matrix is a constant, ensuring minimal online computational overhead for the flight controller—a vital feature for a resource-constrained quadrotor drone autopilot.
3. Simulation, Results, and Analysis
To validate the performance of the LQR-based attitude controller, I constructed a detailed simulation environment in MATLAB/Simulink. The simulation incorporates the non-linear dynamic model derived in Section 1 to test the controller under realistic conditions, not just the linearized approximation used for design. The physical parameters used for the simulated quadrotor drone are listed below.
| Parameter | Symbol | Value | Unit |
|---|---|---|---|
| Mass | \(m\) | 1.2 | kg |
| Arm Length | \(l\) | 0.25 | m |
| Moment of Inertia (X) | \(I_{xx}\) | 0.009 | kg·m² |
| Moment of Inertia (Y) | \(I_{yy}\) | 0.009 | kg·m² |
| Moment of Inertia (Z) | \(I_{zz}\) | 0.018 | kg·m² |
| Thrust Coefficient | \(k_f\) | 1.5e-5 | N/(rad/s)² |
| Drag Coefficient | \(k_m\) | 3e-6 | Nm/(rad/s)² |
| Gravity | \(g\) | 9.81 | m/s² |
The LQR controller was designed with the following weighting matrices, tuned to achieve a fast, well-damped response without demanding excessive motor commands:
$$ \mathbf{Q} = \text{diag}(100, 10, 100, 10, 50, 5), \quad \mathbf{R} = \text{diag}(1, 1, 1). $$
This places significant cost on angle errors (\(q_\phi=100, q_\theta=100\)) to ensure accurate tracking, a moderate cost on angular rates to dampen oscillations, and a moderate cost on yaw error. The control effort is penalized equally across all axes.
3.1 Step Response and Tracking Performance
The first test involves commanding aggressive step changes in the desired Euler angles from an initial hover. The sequence was: at t=1s, a 30° roll command; at t=4s, a -20° pitch command; and at t=7s, a 45° yaw command. The simulated response of the quadrotor drone under LQR control is exceptional. The key performance metrics observed are:
- Rise Time: All axes achieve 90% of the commanded step in under 0.5 seconds.
- Overshoot: Minimal overshoot is observed (<5%), demonstrating excellent damping provided by the optimal state feedback which penalizes angular velocity.
- Steady-State Error: Absolutely zero steady-state error is achieved for all three attitude angles. This is a inherent property of the LQR regulator for this system type when applied to the state vector containing the angle itself; it drives the state to the origin perfectly.
- Decoupling: The response in each channel is largely independent. The roll step causes negligible disturbance in pitch and yaw, and vice-versa, validating the effectiveness of the decoupled design approach for attitude control.
3.2 Disturbance Rejection and Robustness
A critical requirement for a practical quadrotor drone controller is the ability to reject external disturbances, such as wind gusts. To test this, I introduced an impulsive torque disturbance around the roll axis at t=5.5s during a pitch tracking maneuver. The LQR controller demonstrated strong disturbance rejection properties. The quadrotor drone was momentarily perturbed from its commanded pitch angle but recovered to the desired trajectory within approximately 0.8 seconds with minimal residual oscillation. This showcases the robustness ingrained in the LQR design, which optimally balances performance and control effort to naturally cope with model uncertainties and external forces.
3.3 Comparative Analysis with PID Control
To contextualize the performance gains, I implemented a well-tuned PID controller on the same non-linear quadrotor drone model for comparison. The PID controller was tuned for reasonable performance using Ziegler-Nichols methods and subsequent refinement. A comparative analysis reveals distinct advantages of the LQR approach:
| Performance Metric | LQR Controller | PID Controller |
|---|---|---|
| Settling Time (2%) for 30° step | ~0.7 s | ~1.2 s |
| Overshoot | < 5% | 10% – 15% |
| Disturbance Recovery Time | ~0.8 s | ~1.5 s |
| Control Effort (Peak Torque) | Optimized, lower integrated effort | Higher, often with aggressive derivative spikes |
| Tuning Parameters | Intuitive via Q, R weights (6+3 params) | Heuristic (3 params per axis, often coupled) |
| Theoretical Guarantees | Optimality, Stability Margins | Limited guarantees |
The LQR controller consistently provides a faster, better-damped response with superior disturbance rejection. While PID tuning is more familiar to many practitioners, the process is often ad-hoc and can lead to suboptimal performance and hidden coupling between axes. The LQR framework offers a systematic, mathematically sound design procedure that directly considers the multi-variable nature of the quadrotor drone system.
4. Implementation Considerations for Embedded Systems
The transition from a successful simulation to a real-time implementation on a quadrotor drone flight controller requires careful consideration. The core LQR algorithm, being a simple matrix multiplication \(\mathbf{U} = -\mathbf{K}\mathbf{X}\), is exceptionally efficient. For our 6-state, 3-input system, this requires only 18 multiplications and 15 additions per control cycle—a trivial computational load for modern microcontrollers like the ARM Cortex-M series found in flight controllers.
The primary challenges are:
- State Estimation: The LQR controller requires full state feedback. While the angles \((\phi, \theta, \psi)\) can be obtained from an Inertial Measurement Unit (IMU) via sensor fusion (e.g., complementary filter, Kalman filter), their derivatives (angular rates \(\dot{\phi}, \dot{\theta}, \dot{\psi}\)) are also needed. These are typically provided directly by the gyroscope in the IMU, which is accurate and fast. Thus, the required state vector \(\mathbf{X}\) is readily available from standard IMU data.
- Actuator Dynamics and Saturation: The simulation assumes the computed control signal \(\mathbf{U}\) is directly applied as torque. In reality, this signal must be converted into motor Pulse-Width Modulation (PWM) commands via a mixer that inverts the thrust/torque mapping. Furthermore, the physical limits of the motors (max/min speed) must be accounted for to prevent integral windup or loss of controllability. This can be managed by incorporating anti-windup strategies and careful selection of the \(\mathbf{R}\) matrix to keep commands within feasible bounds.
- Discretization: The continuous-time LQR gain \(\mathbf{K}\) is designed for a continuous system but will be implemented on a discrete-time microcontroller. If the control loop frequency is sufficiently high (e.g., >200 Hz) compared to the system dynamics, the continuous-time gains work well. For higher performance, one can design a discrete-time LQR controller based on a discretized version of the plant model.
Given its computational simplicity and direct use of standard IMU data, the LQR controller is not just a theoretical construct but a highly practical solution for enhancing the performance of a real-world quadrotor drone.
5. Conclusion and Future Directions
In this work, I have presented a complete methodology for designing a high-performance attitude controller for a quadrotor drone using Linear Quadratic Regulator (LQR) theory. Starting from first-principles Newton-Euler mechanics, a non-linear dynamic model was derived and subsequently linearized for the hover flight condition. This linear model was cast into a state-space form, for which an LQR controller was systematically designed by selecting appropriate state and control weighting matrices. The performance of the controller was rigorously validated through numerical simulations on the full non-linear model. The results demonstrate that the LQR controller achieves rapid, well-damped attitude tracking with zero steady-state error and exhibits strong disturbance rejection capabilities—key attributes for demanding applications like search and rescue or operation in turbulent conditions.
The comparative analysis with a classical PID controller underscores the advantages of the optimal control approach: superior transient performance, inherent robustness, and a principled design process. Crucially, the computational footprint of the final LQR control law is minimal, making it perfectly suitable for deployment on the embedded real-time systems that govern autonomous quadrotor drones.
Future research directions stemming from this work are plentiful. First, the design assumes full decoupling of axes; investigating a unified MIMO LQR design for the fully coupled linear model could yield further performance improvements. Second, while LQR is robust, its performance can degrade if the quadrotor drone operates far from the hover condition used for linearization. This motivates the exploration of gain-scheduled LQR, where the controller gains are switched or interpolated based on flight condition, or the use of Linear Parameter-Varying (LPV) control techniques. Third, integrating the attitude LQR controller with a position or trajectory tracking outer loop would form a complete cascaded control architecture for full 6-DOF control. Finally, experimental validation on a physical quadrotor drone platform is the essential next step to confirm the simulation findings and address practical implementation nuances such as vibration filtering and precise actuator modeling.
