In recent years, the field of robotics has seen significant advancements, with quadruped robots, often referred to as robot dogs, becoming increasingly capable of performing complex and intelligent tasks. These robot dogs are designed to operate in diverse environments, enhancing their practicality and reliability. However, ensuring stable motion control remains a critical challenge, particularly when these quadruped robots encounter external disturbances or operate on uneven surfaces like inclined planes. This paper addresses the instability issues in quadruped robots using Model Predictive Control (MPC) algorithms, which are widely applied due to their ability to handle complex constraints without requiring nonlinear robot models. Despite their advantages, MPC-based controllers can lead to unstable motion when subjected to external disruptions, such as forces or slopes.
To tackle this problem, various solutions have been proposed in the literature. For instance, some researchers have focused on adjusting foot positions and generating new walking patterns to maintain stability under external forces. Others have simplified the quadruped robot dynamics to a rigid body model, approximating it as a linear time-varying system for state prediction, which offers some fault tolerance. Additionally, model-free MPC approaches have been developed to handle complex constraints and optimize control, providing resistance to disturbances. However, each of these methods has limitations, such as inadequate real-time responsiveness or insufficient error compensation, leading to deviations from desired trajectories on inclined surfaces.
In this work, we propose an improved MPC-based control strategy for quadruped robots, specifically targeting stability on inclined planes under external disturbances. Our approach integrates an adaptive prediction step size mechanism and a fuzzy control-based error compensation strategy. By utilizing motion posture parameters from an Inertial Measurement Unit (IMU), we optimize the prediction step length of the MPC controller to enhance real-time adjustment capabilities. Furthermore, we introduce fuzzy control theory to categorize error variations and apply real-time error compensation coefficients to correct model prediction deviations. Through MATLAB simulations, we demonstrate that our method enables the quadruped robot to maintain stable motion on various slopes, even when subjected to external forces, validating its effectiveness and correctness.

The core of our methodology lies in the traditional single rigid body model for MPC control of quadruped robots. Consider a world coordinate system {W} and a robot body coordinate system {B}. Let $\mathbf{r}$ denote the position vector of the foot relative to the robot’s center of mass, and $\mathbf{f}$ represent the interaction force between the foot and the ground. Applying Newton’s second law and the angular momentum theorem, we derive the following equations:
$$ \dot{\mathbf{P}} = \frac{\sum_{i=1}^{n} \mathbf{f}_i}{m} – \mathbf{g} $$
$$ \frac{d}{dt} (\mathbf{I} \boldsymbol{\omega}) = \sum_{i=1}^{n} \mathbf{r}_i \times \mathbf{f}_i $$
$$ \dot{\mathbf{R}} = \boldsymbol{\omega} \times \mathbf{R} $$
Here, $\mathbf{P}$ is the linear momentum, $m$ is the mass of the quadruped robot, $\mathbf{g}$ is the gravitational acceleration vector, $\mathbf{I}$ is the inertia tensor, $\boldsymbol{\omega}$ is the angular velocity vector, and $\mathbf{R}$ is the rotation matrix. Model Predictive Control is essentially an optimization-based control technique that repeatedly solves for optimal control inputs under state and control constraints to ensure stable motion of the quadruped robot. When a robot dog moves on an inclined plane, its stability is influenced by model prediction, rolling optimization, and error compensation within the MPC framework. Among these, error compensation and the prediction step length in the prediction model are crucial, as they help suppress disturbances and improve stability.
However, problems arise when the prediction step length is not adaptive. If the step length is too large, the controller cannot react promptly to disturbances; if it is too small, it leads to excessive computational load. Similarly, simple error compensation methods often fail to effectively control the quadruped robot, causing deviations from expected trajectories when external disturbances occur. To address this, we propose an adaptive prediction step length strategy that uses the yaw angle feedback from the IMU as a stability criterion. The step length coefficient $\mu$ is defined as:
$$ z_\mu = \left| \mu_1 e(t)_{\text{yaw}} + \mu_2 \text{sgn}(e(t)_{\text{yaw}}) \times (e(t)_{\text{yaw}} – e(t-1)_{\text{yaw}}) \right| $$
where $\text{sgn}(x)$ is the sign function:
$$ \text{sgn}(x) = \begin{cases}
1 & \text{if } x \geq 0 \\
0 & \text{if } x = 0 \\
-1 & \text{if } x \leq 0
\end{cases} $$
In this equation, $e(t)_{\text{yaw}}$ represents the yaw angle error, and $\mu_1$ and $\mu_2$ are proportional coefficients that adjust the compensation intensity. The coefficient $\mu$ consists of two parts: the absolute value of the yaw angle error, indicating the deviation from the initial value, and the product of the error’s first-order difference and its sign function, representing the degree of error change. This step length coefficient is then incorporated into the discretized dynamics equations:
$$ \mathbf{p}(k+1) = \mathbf{p}(k) + \mu T \cdot \mathbf{v}(k) + \frac{1}{2} \cdot \mu T \cdot \mathbf{a}(k) $$
$$ \mathbf{v}(k+1) = \mathbf{v}(k) + \mu T \cdot \mathbf{a}(k) $$
$$ \mathbf{q}(k+1) = \mathbf{q}(k) \otimes \exp\left(\frac{1}{2} \cdot \mu T \cdot \boldsymbol{\omega}(k)\right) $$
$$ \boldsymbol{\omega}(k+1) = \boldsymbol{\omega}(k) + \mu T \cdot \boldsymbol{\alpha}(k) $$
Here, $\mathbf{p}(k)$, $\mathbf{v}(k)$, $\mathbf{q}(k)$, and $\boldsymbol{\omega}(k)$ denote the position, velocity, attitude, and angular velocity of the quadruped robot at the $k$-th control instant, respectively; $\mathbf{a}(k)$ and $\boldsymbol{\alpha}(k)$ are the acceleration and angular acceleration; $\exp$ represents the quaternion exponential function; and $\otimes$ indicates quaternion multiplication. This adaptive approach allows the robot dog to dynamically adjust its prediction horizon based on real-time posture changes, improving responsiveness to disturbances.
For error compensation, we integrate a fuzzy control strategy to handle uncertainties in the MPC model. The fuzzy system categorizes position and attitude errors into linguistic variables, with the position error fuzzy set defined as {Very Small, Small, Medium, Large, Very Large} and the attitude error fuzzy set as {Negative Big, Negative Small, Zero, Positive Small, Positive Big}. The error compensation coefficient $\eta$ is fuzzified into {Very Small, Small, Medium, Large, Very Large}, and both input and output variables use triangular membership functions. The fuzzy rules are designed such that smaller error changes indicate a more stable state for the quadruped robot. For example, if the position error is Very Small and the attitude error is Zero, then the compensation coefficient is Very Small, meaning minimal adjustment is needed.
We employ the Mamdani inference system with max-min composition for logical reasoning and the centroid method for defuzzification due to its intuitiveness and precision. The fuzzy rules can be summarized in a table, and the relationship between inputs and outputs is visualized in a 3D surface plot. The error compensation is then integrated into the MPC controller as follows:
$$ \hat{y}_c(t+j|t) = \hat{y}(t+j|t) + h_j(e(t)) $$
$$ e(t) = y(t) – \hat{y}_c(t) $$
$$ e_p = x_{\text{ref}} – x $$
$$ e_a = \theta_{\text{ref}} – \theta $$
$$ h_j = \text{fuzzy\_controller}(e_p, e_a) \quad \text{for } j = 1, 2, \dots, N_y $$
In these equations, $y(t)$ is the actual system output at time $t$, $\hat{y}(t)$ is the predicted output from the model, $\hat{y}_c(t+j|t)$ is the corrected predicted output for step $j$, $e(t)$ is the model prediction error, $h_j$ is the error compensation coefficient, and $e_p$ and $e_a$ are the position and attitude errors, respectively. This compensation mechanism enables real-time adjustment of predictions, enhancing the stability of the quadruped robot on inclined planes.
To validate our approach, we conducted simulations in MATLAB R2022b, comparing our method with existing techniques under different incline angles. The parameters for the quadruped robot are summarized in the table below:
| Parameter | Value |
|---|---|
| Body Mass (kg) | 5.5 |
| Velocity (m/s) | 0.43 |
| Ground Friction Coefficient | 0.3 |
| Body Length (m) | 0.3 |
| Width (m) | 0.23 |
| Leg Length (m) | 0.15 |
We evaluated the performance on 30° and 60° inclined planes, measuring metrics such as yaw angle deviation and displacement accuracy. The results are compared in the following table, which shows the yaw angle values after a simulation time of 2 seconds:
| Control Method | Time (s) | Yaw Angle on 30° Slope (°) | Yaw Angle on 60° Slope (°) |
|---|---|---|---|
| Foot Position Adjustment MPC | 2 | 15.89 | 35.82 |
| Single Rigid Body MPC | 2 | 11.57 | 31.47 |
| Model-Free MPC | 2 | 3.48 | 15.45 |
| Our Method | 2 | 3.02 | 6.43 |
As evident from the table, our method achieves the smallest yaw angle deviations on both slopes, indicating superior stability. For instance, on the 60° slope, the yaw angle is reduced to 6.43° compared to 15.45° for the model-free approach, demonstrating a significant improvement. The adaptive prediction step length and fuzzy error compensation allow the robot dog to maintain trajectories closer to the desired path, with reduced oscillations and better disturbance rejection.
Further analysis of the simulation results reveals that the displacement in various directions aligns more closely with expected values when using our method. For example, the root mean square error (RMSE) of position tracking is minimized, and the robot exhibits smoother transitions on inclined surfaces. This enhanced performance is attributed to the real-time adjustments in prediction step length and the precise error compensation, which collectively mitigate the effects of external forces and slope variations.
In conclusion, our proposed adaptive MPC strategy with fuzzy control-based error compensation effectively addresses the stability challenges of quadruped robots on inclined planes. By optimizing the prediction step length using IMU data and incorporating intelligent error handling, we have developed a robust control framework that improves motion accuracy and reliability. The MATLAB simulations confirm that our method outperforms existing approaches, enabling robot dogs to operate stably in challenging environments. Future work could explore the integration of machine learning techniques to further enhance adaptability and real-time performance for a wider range of scenarios.
The advancements in quadruped robot control presented here contribute to the broader goal of developing autonomous systems capable of navigating complex terrains. As robot dogs become more prevalent in applications such as search and rescue, surveillance, and logistics, ensuring their stability under adverse conditions is paramount. Our research underscores the importance of adaptive control mechanisms and sets a foundation for future innovations in legged robotics.
