Optimized Gait Control for Quadruped Robots Based on Quadratic Programming

In recent years, the development of legged robots has gained significant attention due to their superior mobility and adaptability in unstructured environments compared to wheeled systems. Among these, the quadruped robot, often referred to as a robot dog, demonstrates remarkable stability and efficiency, particularly in dynamic terrains. The trotting gait, a common locomotion pattern in nature, is characterized by the simultaneous movement of diagonal legs, offering a balance between speed and energy consumption. However, achieving stable and robust trotting in real-world scenarios poses challenges, such as handling uneven terrain and external disturbances. Traditional control methods, including central pattern generators and simplified models, often fall short in addressing these issues due to limitations in adaptability and computational complexity. To overcome these hurdles, we propose a comprehensive control framework based on quadratic programming for quadruped robots, focusing on optimizing force distribution during the support phase and trajectory planning during the swing phase. This approach ensures robust performance across various conditions, such as obstacles, slopes, and lateral impacts, while maintaining computational efficiency suitable for real-time applications.

Our method leverages a virtual model control strategy, where the robot’s body is treated as a rigid mass, and the legs are modeled as extensible links. This simplification allows for intuitive control without relying on precise dynamical models, which are often difficult to obtain in practice. The core of our controller involves dividing the gait cycle into support and swing phases. During the support phase, we use quadratic programming to optimally distribute ground reaction forces, ensuring stability in all six degrees of freedom. In the swing phase, we incorporate body velocity adjustments for foot placement and employ fifth-order Bézier curves for smooth trajectory tracking. Joint impedance control and force estimation enable compliant ground contact, reducing impact forces and enhancing overall stability. Through extensive simulations and physical experiments, we validate the effectiveness of our approach, demonstrating that the quadruped robot can maintain stable trotting even under adverse conditions.

The kinematics and dynamics of the quadruped robot are fundamental to our control design. The robot dog features four legs, each with three degrees of freedom: hip roll, hip pitch, and knee pitch joints. This configuration allows for versatile movement and adaptability. The kinematic model relates joint angles to foot positions in the leg base coordinate system. For a given leg, the foot position (x, y, z) can be expressed as:

$$ x = L_1 \cos \theta_2 + L_2 \cos \theta_3 $$
$$ y = (L_1 \sin \theta_2 + L_2 \sin \theta_3) \cos \theta_1 $$
$$ z = (L_1 \sin \theta_2 + L_2 \sin \theta_3) \sin \theta_1 $$

where $L_1$ and $L_2$ represent link lengths, and $\theta_1$, $\theta_2$, $\theta_3$ are the joint angles. The inverse kinematics provides unique joint angles for a desired foot position, computed using trigonometric functions. For instance, $\theta_1$ is derived as $\theta_1 = \text{atan2}(z, y)$, and the other angles are solved based on geometric constraints. The Jacobian matrix, which maps joint velocities to foot velocities, is crucial for impedance control and force estimation. It is defined as:

$$ J = \begin{bmatrix}
0 & -L_1 s_2 – L_2 s_3 & -L_2 s_3 \\
-(L_1 s_2 + L_2 s_3) s_1 & L_1 c_2 c_1 & L_2 c_3 c_1 \\
(L_1 s_2 + L_2 s_3) c_1 & L_1 c_2 s_1 & L_2 c_3 s_1
\end{bmatrix} $$

where $s_k = \sin \theta_k$ and $c_k = \cos \theta_k$ for $k=1,2,3$. This matrix enables the transformation between joint and Cartesian spaces, facilitating real-time control.

For dynamics modeling, we adopt a Lagrangian approach, treating the quadruped robot as a central rigid body with telescopic legs during the support phase. The generalized coordinates include the body’s position and orientation, denoted as $q = [x_B, y_B, z_B, \alpha, \beta, \phi]^T$, where $x_B, y_B, z_B$ are the body’s coordinates, and $\alpha, \beta, \phi$ are the roll, pitch, and yaw angles, respectively. The Lagrangian function $L = T – V$ combines kinetic energy $T$ and potential energy $V$. The kinetic energy accounts for the body and leg masses, while the potential energy includes gravitational effects. The equations of motion are derived as:

$$ M(q) \ddot{q} + H(q, \dot{q}) = Q $$

where $M(q)$ is the mass matrix, $H(q, \dot{q})$ represents Coriolis and centrifugal terms, and $Q$ is the generalized force vector. This model allows us to compute joint torques based on desired forces, ensuring dynamic consistency during locomotion.

Key Kinematic and Dynamic Parameters of the Quadruped Robot
Parameter Value
Link Length L1 (mm) 350
Link Length L2 (mm) 250
Body Length LB (mm) 1250
Body Width WB (mm) 450
Body Mass mB (kg) 42
Leg Segment Mass m1 (kg) 0.9
Leg Segment Mass m2 (kg) 0.7

The control framework for the quadruped robot is divided into support phase and swing phase controllers, which alternate to achieve the trotting gait. In the support phase, the robot maintains stability by optimizing ground reaction forces using quadratic programming. The virtual model control applies impedance-based forces to the body, computed in the inertial frame as:

$$ F_x = k_{px} (x_d – x) + k_{dx} (v_x – \dot{x}) $$
$$ F_y = k_{py} (y_d – y) + k_{dy} (v_y – \dot{y}) $$
$$ F_z = k_{pz} (h_d – h) – k_{dz} \dot{h} + m_B g $$
$$ \tau_x = k_{p\alpha} (\alpha_d – \alpha) + k_{d\alpha} (\dot{\alpha}_d – \dot{\alpha}) $$
$$ \tau_y = k_{p\beta} (\beta_d – \beta) + k_{d\beta} (\dot{\beta}_d – \dot{\beta}) $$
$$ \tau_z = k_{p\phi} (\phi_d – \phi) + k_{d\phi} (\dot{\phi}_d – \dot{\phi}) $$

where $k_p$ and $k_d$ are proportional and derivative gains, respectively, and the subscript $d$ denotes desired values. These virtual forces and torques are then distributed to the supporting legs. For a quadruped robot in a trotting gait, the support phase typically involves two legs, making the system underactuated. To address this, we formulate the force distribution as a quadratic optimization problem:

$$ \min f = (A x – b)^T S (A x – b) + x^T W x $$

where $A$ is the force distribution matrix, $b$ is the virtual force vector, $S$ is a weight matrix based on dynamic parameters, and $W$ is a penalty matrix to avoid excessive forces. The solution is obtained using pseudo-inverse methods, ensuring optimal force allocation. The weight matrix $S$ is designed as:

$$ S = \text{diag} \left( \frac{1}{m_B}, \frac{1}{m_B}, \frac{1}{m_B}, \frac{h}{I_{xx}}, \frac{h}{I_{yy}}, \frac{h}{I_{zz}} \right) $$

where $I_{xx}$, $I_{yy}$, $I_{zz}$ are the body’s principal moments of inertia, and $h$ is the body height. This weighting prioritizes control in directions where the robot is more sensitive to disturbances.

During the swing phase, the focus shifts to foot trajectory planning and compliant landing. The desired foot placement is adjusted based on the body’s velocity to anticipate terrain changes. In the inertial frame, the target foot position $(x_d, y_d, z_d)$ is computed as:

$$ x_d(t) = x_0 + \frac{1}{2} \int_0^t v_x \, dt + k_{vx} (v_x – v_{xd}) $$
$$ y_d(t) = y_0 + \frac{1}{2} \int_0^t v_y \, dt + k_{vy} (v_y – v_{yd}) $$
$$ z_d(t) = z_0 – \Delta h $$

where $\Delta h$ is a predefined descent distance to ensure ground contact, and $k_{vx}$, $k_{vy}$ are gain factors. The foot trajectory is planned using fifth-order Bézier curves for smooth motion:

$$ X_c(u) = P_0 (1 – u)^5 + 5 P_1 u (1 – u)^4 + 10 P_2 u^2 (1 – u)^3 + 10 P_3 u^3 (1 – u)^2 + 5 P_4 u^4 (1 – u) + P_5 u^5 $$

where $u = t/T$ is the normalized time, $T$ is the swing period, and $P_0$ to $P_5$ are control points in 3D space. The control points are calculated based on the start and end points, as well as the desired step height $H$. For example, $P_1 = 0.8 P_0 + 0.2 P_5 + 0.3 H$. This curve ensures continuous acceleration and velocity, reducing jerky movements.

Joint impedance control is employed to track the desired trajectories smoothly. The joint torque for a swing leg is given by:

$$ \tau_i = k_\theta (\theta_{id} – \theta_i) + d_\theta (\dot{\theta}_{id} – \dot{\theta}_i) $$

where $k_\theta$ and $d_\theta$ are stiffness and damping coefficients, respectively. Ground contact is detected by estimating the foot force using the Jacobian transpose and joint torques:

$$ f_{sw} = (J_{sw}^T)^{-1} \tau_{\theta sw} $$

If the vertical component exceeds a threshold, the leg is considered to have touched down, triggering a phase switch. This force estimation enhances compliance and reduces impact forces during landing.

Control Parameters for the Quadruped Robot
Parameter Value
Ground Friction Coefficient 0.35
Control Frequency (Hz) 1000
Joint Stiffness kθ (N·m/rad) 2000
Joint Damping dθ (N·m·s/rad) 200
Body Translational Stiffness kpx, kpy, kpz (N/m) 1800
Body Translational Damping kdx, kdy, kdz (N·s/m) 180
Body Rotational Stiffness kpα, kpβ, kpφ (N·m/rad) 1500
Body Rotational Damping kdα, kdβ, kdφ (N·m·s/rad) 150

To validate our control approach, we conducted simulations in a dynamic environment using Gazebo, with a robot model matching the physical prototype’s dimensions and inertia. The quadruped robot was tested on flat ground, obstacles of 5 cm height, and slopes of 10 degrees. Additionally, we applied a lateral force of 50 N for 0.3 s to assess stability under disturbances. The robot dog successfully maintained stable trotting in all scenarios, with body attitude and velocity remaining within acceptable bounds. For instance, on uneven terrain, the maximum roll and pitch variations were 2.5° and 3.2°, respectively, while the yaw deviation reached 7.3°. The lateral velocity fluctuated by up to 0.08 m/s, indicating robust performance.

In the support phase, the virtual forces and torques closely tracked their desired values, as shown in the simulation results. The quadratic programming approach effectively distributed forces, minimizing body tilt and drift. Compared to methods that neglect lateral force control, our full-dimensional strategy reduced lateral velocity fluctuations and positional drift significantly. For example, without lateral control, the body exhibited noticeable sideward movement over time, whereas our method maintained stability. The computational overhead of our algorithm was minimal, with each control cycle taking approximately 120 μs on a standard industrial computer, enabling a 1 ms control period that surpasses other approaches requiring 2.5 ms.

Physical experiments on a prototype quadruped robot further confirmed the simulation findings. The robot dog, equipped with custom permanent magnet synchronous motors and harmonic drives, achieved stable trotting on flat terrain. The body attitude, measured using an MEMS gyroscope, showed roll and pitch variations of up to 3.7° and 4.6°, respectively, which were slightly higher than in simulations due to foot slippage. Nevertheless, the lateral velocity remained stable without significant drift, demonstrating the controller’s practicality. Future work will involve adding anti-slip padding to the feet and testing on more complex terrains to further improve performance.

In conclusion, our quadratic programming-based control framework for quadruped robots provides an efficient and robust solution for trotting gait stabilization. By optimizing force distribution and incorporating adaptive swing leg trajectories, the robot dog can navigate challenging environments while resisting disturbances. The use of simplified models and impedance control reduces computational demands, making it suitable for real-time applications. Simulations and experiments validate the method’s effectiveness, highlighting its potential for various applications, from search and rescue to planetary exploration. As research progresses, we aim to enhance the controller with learning capabilities for even greater autonomy and adaptability.

Scroll to Top