Attitude Control of Quadrotor Drone with Unbalanced Load Based on LSTM-MPC

In recent years, the advancement of control technologies for quadrotor drones has been significant, with applications spanning agriculture, surveillance, and logistics. However, a critical challenge arises when these drones carry unbalanced loads, which introduces nonlinearities and disturbances into the control system, compromising flight stability and precision. Traditional control strategies often fall short in handling such complexities. In this article, I present a novel approach that integrates Long Short-Term Memory (LSTM) neural networks with Model Predictive Control (MPC) to address the attitude control of a quadrotor drone under unbalanced load conditions. By leveraging the predictive capabilities of LSTM and the optimization strengths of MPC, this strategy enhances error anticipation and control accuracy, ensuring robust performance in real-world scenarios. Through detailed mathematical modeling, simulations, and flight tests, I demonstrate the effectiveness of this method, offering insights into high-precision control for quadrotor drones in demanding operational environments.

The quadrotor drone is an underactuated and highly coupled nonlinear system, where attitude adjustments are achieved by modulating the thrust of four rotors. When an unbalanced load is attached, the system’s dynamics become more intricate due to shifts in the center of mass and additional torque effects. Existing control methods, such as PID, adaptive control, and MPC, have shown promise but often struggle with the unpredictability introduced by load imbalances. My approach combines LSTM neural networks, which excel at capturing temporal dependencies, with MPC, which optimizes control inputs over a horizon. This synergy allows for better handling of nonlinearities and disturbances, making it ideal for quadrotor drone applications where load distribution is uneven. In the following sections, I will delve into the mathematical framework, strategy design, and experimental validation of this LSTM-MPC method.

To begin, let’s establish the mathematical model of a quadrotor drone with an unbalanced load. The quadrotor drone’s body frame is defined with its origin at the center of mass, and the dynamics are derived from Newton-Euler equations. For a standard quadrotor drone, the attitude dynamics are given by:

$$ \dot{\phi} = \left[ M_x – (J_y – J_z) \dot{\theta} \dot{\psi} \right] / J_x $$
$$ \dot{\theta} = \left[ M_y – (J_z – J_x) \dot{\phi} \dot{\psi} \right] / J_y $$
$$ \dot{\psi} = \left[ M_z – (J_x – J_y) \dot{\phi} \dot{\theta} \right] / J_z $$

Here, $\phi$, $\theta$, and $\psi$ represent the roll, pitch, and yaw angles, respectively; $\dot{\phi}$, $\dot{\theta}$, and $\dot{\psi}$ are their angular velocities; $M_x$, $M_y$, and $M_z$ are the moments around the body axes; and $J_x$, $J_y$, $J_z$ are the moments of inertia. When an unbalanced load is added, the system’s inertia matrix and torque contributions change. Let $m_L$ be the mass of the load, and $\mathbf{d}_L$ be the offset vector from the quadrotor drone’s center of mass to the load’s center of mass. The combined inertia matrix $\mathbf{J}_C$ becomes:

$$ \mathbf{J}_C = \mathbf{J}_Q + m_L \left( \|\mathbf{d}_L\|^2 \mathbf{I}_3 – \mathbf{d}_L \mathbf{d}_L^T \right) $$

where $\mathbf{J}_Q$ is the inertia of the quadrotor drone alone, and $\mathbf{I}_3$ is a 3×3 identity matrix. The additional torque due to the load, $\mathbf{M}_L$, is given by:

$$ \mathbf{M}_L = \mathbf{d}_L \times (m_L \mathbf{g}) $$

with $\mathbf{g}$ as the gravitational acceleration vector. Assuming the load is rigidly attached, the modified attitude dynamics for the quadrotor drone with unbalanced load are:

$$ \dot{\phi}_C = \left[ M_x + M_{Lx} – (J_{Cy} – J_{Cz}) \dot{\theta} \dot{\psi} \right] / J_{Cx} $$
$$ \dot{\theta}_C = \left[ M_y + M_{Ly} – (J_{Cz} – J_{Cx}) \dot{\phi} \dot{\psi} \right] / J_{Cy} $$
$$ \dot{\psi}_C = \left[ M_z + M_{Lz} – (J_{Cx} – J_{Cy}) \dot{\phi} \dot{\theta} \right] / J_{Cz} $$

where the subscript $C$ denotes the combined system. This model forms the basis for designing the control strategy, as it accounts for the nonlinear effects introduced by the unbalanced load on the quadrotor drone.

The LSTM-MPC strategy is designed to handle these complexities by integrating a predictive neural network with an optimization-based controller. The LSTM neural network is used to forecast future attitude states, enhancing the quadrotor drone’s ability to anticipate errors. LSTM networks are well-suited for time-series prediction due to their memory cells and gating mechanisms, which capture long-term dependencies. In this context, the LSTM model takes current attitude angles, angular velocities, and moments as inputs to predict the next attitude angles. The input features include $\phi$, $\theta$, $\psi$, $\dot{\phi}$, $\dot{\theta}$, $\dot{\psi}$, $M_{Cx}$, $M_{Cy}$, and $M_{Cz}$, while the outputs are $\phi_{\text{next}}$, $\theta_{\text{next}}$, and $\psi_{\text{next}}$. A sample of the training data is summarized in Table 1, showcasing the input-output relationships for the quadrotor drone.

Table 1: Sample Input and Output Data for LSTM Model Training
Index $\phi$ (rad) $\theta$ (rad) $\psi$ (rad) $\dot{\phi}$ (rad/s) $\dot{\theta}$ (rad/s) $\dot{\psi}$ (rad/s) $M_{Cx}$ (N·m) $M_{Cy}$ (N·m) $M_{Cz}$ (N·m) $\phi_{\text{next}}$ (rad) $\theta_{\text{next}}$ (rad) $\psi_{\text{next}}$ (rad)
1 0.1535 0.0834 0.0367 0.2079 0.3835 0.0872 1.1440 0.7144 0.0013 0.1574 0.0756 0.0385
2 0.1574 0.0756 0.0385 0.1885 0.3936 0.0873 1.1757 0.6343 0.0013 0.1610 0.0677 0.0402
3 0.1610 0.0677 0.0402 0.1686 0.4025 0.0873 1.2039 0.5592 0.0009 0.1642 0.0595 0.0420
4 0.1642 0.0595 0.0420 0.1482 0.4104 0.0873 1.2290 0.4915 0.0004 0.1669 0.0513 0.0437
5 0.1669 0.0513 0.0437 0.1275 0.4172 0.0873 1.2512 0.4284 0.0004 0.1693 0.0428 0.0455

The LSTM model consists of an input layer, LSTM layers, fully connected layers, and an output layer. It is trained using backpropagation through time, with data split into training and testing sets. To evaluate the model’s performance, I use metrics such as the coefficient of determination ($R^2$), root mean square error ($E_{\text{RMSE}}$), and mean absolute error ($E_{\text{MAE}}$). The formulas for these metrics are:

$$ R^2 = 1 – \frac{\sum_{i=1}^{m} (y_i – \hat{y}_i)^2}{\sum_{i=1}^{m} (y_i – \bar{y})^2} $$
$$ E_{\text{RMSE}} = \sqrt{\frac{1}{m} \sum_{i=1}^{m} (y_i – \hat{y}_i)^2} $$
$$ E_{\text{MAE}} = \frac{1}{m} \sum_{i=1}^{m} |y_i – \hat{y}_i| $$

where $m$ is the number of samples, $y_i$ is the actual value, $\hat{y}_i$ is the predicted value, and $\bar{y}$ is the mean of actual values. For the quadrotor drone attitude prediction, the LSTM model achieved high accuracy, as shown in Table 2 for the training set and Table 3 for the testing set. These results indicate that the LSTM model effectively captures the dynamics of the quadrotor drone with unbalanced load, providing reliable predictions for control purposes.

Table 2: Evaluation Metrics for LSTM Model on Training Set
Attitude Angle $R^2$ $E_{\text{RMSE}}$ (rad) $E_{\text{MAE}}$ (rad)
Roll ($\phi$) 0.9926 0.0103 0.0084
Pitch ($\theta$) 0.9853 0.0187 0.0140
Yaw ($\psi$) 0.9934 0.0085 0.0073
Table 3: Evaluation Metrics for LSTM Model on Testing Set
Attitude Angle $R^2$ $E_{\text{RMSE}}$ (rad) $E_{\text{MAE}}$ (rad)
Roll ($\phi$) 0.9838 0.0148 0.0127
Pitch ($\theta$) 0.9776 0.0202 0.0149
Yaw ($\psi$) 0.9869 0.0134 0.0115

On the other hand, MPC is used as a feedforward controller to optimize control inputs dynamically. The discrete-time state-space model for the quadrotor drone system is:

$$ \mathbf{x}(k+1) = \mathbf{A} \mathbf{x}(k) + \mathbf{B} \mathbf{u}(k) $$
$$ \mathbf{y}(k) = \mathbf{C} \mathbf{x}(k) + \mathbf{D} \mathbf{u}(k) $$

where $\mathbf{x}(k)$ is the state vector, $\mathbf{u}(k)$ is the input vector, $\mathbf{y}(k)$ is the output vector, and $\mathbf{A}$, $\mathbf{B}$, $\mathbf{C}$, $\mathbf{D}$ are matrices defining the system dynamics. The MPC controller minimizes a cost function $J$ over a prediction horizon:

$$ J = \sum_{k=0}^{n-1} \left[ (\mathbf{y}(k) – \mathbf{y}_{\text{ref}}(k))^T \mathbf{Q} (\mathbf{y}(k) – \mathbf{y}_{\text{ref}}(k)) + \mathbf{u}(k)^T \mathbf{R} \mathbf{u}(k) \right] $$

Here, $\mathbf{y}_{\text{ref}}(k)$ is the reference trajectory, $\mathbf{Q}$ and $\mathbf{R}$ are weight matrices, and $n$ is the horizon length. The optimization considers constraints on control inputs and their rates, ensuring feasible solutions for the quadrotor drone.

The LSTM-MPC strategy integrates these components as follows: the LSTM model predicts future attitude states, which are fed into the MPC optimizer to compute optimal control inputs. This closed-loop system includes feedback correction to account for prediction errors and disturbances. The overall workflow involves: (1) the LSTM model generating predictions based on current states, (2) the MPC solver optimizing control inputs using these predictions, and (3) the quadrotor drone executing the control inputs while updating states for the next iteration. This approach enhances the quadrotor drone’s ability to handle unbalanced loads by proactively adjusting for anticipated deviations.

To validate the LSTM-MPC strategy, I conducted simulation experiments using MATLAB. The quadrotor drone was simulated with an unbalanced load of 0.9 kg attached at coordinates (0.15 m, 0.15 m, 0.05 m) in the body frame. The control performance was compared against fuzzy PID and standard MPC strategies. The attitude trajectory tracking results are summarized in Table 4, which shows the root mean square errors for each strategy. The LSTM-MPC strategy consistently outperformed the others, demonstrating lower errors in roll, pitch, and yaw angles for the quadrotor drone.

Table 4: Root Mean Square Errors for Attitude Tracking in Simulation
Attitude Angle Fuzzy PID $E_{\text{RMSE}}$ (rad) MPC $E_{\text{RMSE}}$ (rad) LSTM-MPC $E_{\text{RMSE}}$ (rad)
Roll ($\phi$) 0.0121 0.0120 0.0104
Pitch ($\theta$) 0.0229 0.0195 0.0171
Yaw ($\psi$) 0.0021 0.0018 0.0016

Specifically, the LSTM-MPC strategy reduced the $E_{\text{RMSE}}$ for roll angle by 14.05% compared to fuzzy PID and 13.33% compared to MPC. For pitch angle, the reductions were 25.33% and 12.31%, respectively, and for yaw angle, 23.81% and 11.11%. These improvements highlight the efficacy of combining LSTM predictions with MPC optimization for controlling a quadrotor drone under unbalanced load conditions.

Furthermore, I performed flight tests using a commercial F450 quadrotor drone platform equipped with a 0.6 kg unbalanced load. The quadrotor drone was integrated with an IMU and GPS for state estimation, and the LSTM-MPC strategy was implemented in real-time. The flight test lasted 60 seconds, divided into maneuvering and hovering phases. The attitude tracking performance is illustrated in Figure 1, where the actual outputs closely follow the desired trajectories. The average errors between actual and desired values were 3.91% for roll, 5.31% for pitch, and 1.10% for yaw, confirming the practical viability of the LSTM-MPC strategy for quadrotor drone applications.

In discussion, the LSTM-MPC strategy offers several advantages for quadrotor drone control. First, the LSTM neural network provides accurate predictions of attitude dynamics, enabling the quadrotor drone to anticipate and compensate for errors caused by unbalanced loads. Second, the MPC framework ensures optimal control input generation, considering constraints and future states. This combination is particularly beneficial for quadrotor drones operating in unpredictable environments, such as agricultural spraying or payload delivery, where load distribution may vary. However, challenges remain, including computational complexity and the need for extensive training data. Future work could focus on reducing the computational load through model simplification or exploring reinforcement learning for adaptive control of quadrotor drones.

In conclusion, the LSTM-MPC strategy presents a robust solution for attitude control of quadrotor drones with unbalanced loads. By integrating predictive modeling with optimization-based control, it addresses nonlinearities and disturbances effectively, enhancing flight stability and precision. The mathematical model, simulations, and flight tests validate its superiority over traditional methods. As quadrotor drones continue to evolve for complex tasks, strategies like LSTM-MPC will play a crucial role in ensuring reliable performance. I believe this approach paves the way for advanced control systems in autonomous quadrotor drone operations, contributing to safer and more efficient aerial robotics.

To further elaborate, the quadrotor drone’s dynamics with unbalanced load can be analyzed using linearized models for controller design. The state vector $\mathbf{x}$ for the quadrotor drone might include attitude angles, angular velocities, and position states. For instance, let $\mathbf{x} = [\phi, \theta, \psi, \dot{\phi}, \dot{\theta}, \dot{\psi}]^T$. The control input $\mathbf{u}$ represents the motor thrusts or moments. Using the derived dynamics, the system matrices $\mathbf{A}$ and $\mathbf{B}$ can be obtained through Jacobian linearization around an operating point. This facilitates the implementation of MPC for the quadrotor drone.

Moreover, the LSTM model’s architecture details are worth noting. For the quadrotor drone attitude prediction, I used a network with two LSTM layers, each with 50 hidden units, followed by a fully connected layer with a linear activation function. The model was trained using the Adam optimizer with a mean squared error loss function. The training data comprised 10,000 samples generated from simulations of the quadrotor drone under various load conditions. This ensures the LSTM model generalizes well to unseen scenarios for the quadrotor drone.

In terms of MPC implementation, the quadrotor drone’s control inputs are subject to constraints such as maximum thrust and rate limits. The optimization problem is solved using quadratic programming at each time step. The weight matrices $\mathbf{Q}$ and $\mathbf{R}$ are tuned to balance tracking performance and control effort for the quadrotor drone. For example, $\mathbf{Q} = \text{diag}(10, 10, 10, 1, 1, 1)$ and $\mathbf{R} = \text{diag}(0.1, 0.1, 0.1, 0.1)$ were used in simulations to prioritize attitude accuracy for the quadrotor drone.

The synergy between LSTM and MPC can be mathematically expressed as follows. Let $\hat{\mathbf{y}}_{\text{LSTM}}(k+1)$ be the LSTM prediction for the next output. The MPC cost function is modified to include this prediction:

$$ J = \sum_{k=0}^{n-1} \left[ (\hat{\mathbf{y}}_{\text{LSTM}}(k+1) – \mathbf{y}_{\text{ref}}(k+1))^T \mathbf{Q} (\hat{\mathbf{y}}_{\text{LSTM}}(k+1) – \mathbf{y}_{\text{ref}}(k+1)) + \mathbf{u}(k)^T \mathbf{R} \mathbf{u}(k) \right] $$

This ensures that the control optimization leverages accurate forecasts for the quadrotor drone’s future states, improving responsiveness to unbalanced load effects.

For the flight test, the quadrotor drone was programmed to follow a trajectory with varying attitude commands. The LSTM-MPC strategy ran on an onboard computer with a sampling time of 0.01 seconds. The quadrotor drone successfully maintained stability despite the unbalanced load, as evidenced by the low tracking errors. This practical validation underscores the real-world applicability of the LSTM-MPC strategy for quadrotor drones in scenarios like aerial photography or inspection, where payloads may be asymmetrically distributed.

In summary, the LSTM-MPC strategy represents a significant advancement in quadrotor drone control technology. By harnessing the power of neural networks and predictive control, it enables quadrotor drones to operate reliably under challenging conditions. As research progresses, I anticipate further refinements that will make quadrotor drones even more versatile and autonomous, solidifying their role in modern robotics.

Scroll to Top