In recent years, humanoid robots have become a focal point in robotics research, driven by their potential applications in service, education, disaster response, elderly care, and assistive technologies. As a nonlinear, strongly coupled, and non-holonomically constrained multi-degree-of-freedom system, achieving stable walking motions in humanoid robots is challenging with traditional methods. Therefore, gait optimization is essential. Common approaches, such as those based on deep deterministic policy gradients or inverted pendulum models, often suffer from complex models, large data requirements, and slow convergence. In this study, we address these issues by employing projection analysis for kinematic modeling, cubic spline interpolation for gait trajectory planning, and particle swarm optimization (PSO) to optimize joint motor angles. The zero moment point (ZMP) serves as the criterion for dynamic stability, and we construct an objective function that minimizes trajectory variables and driving energy consumption per step. Through MATLAB simulations, we demonstrate that our method efficiently searches for global optimal parameters, enabling smooth trajectories and stable control in initial, periodic, and termination steps for humanoid robots.

Robot technology has evolved significantly, with humanoid robots representing a pinnacle of integration in mechanics, control systems, and artificial intelligence. The complexity of humanoid robots lies in their multi-joint structure, where each joint may have multiple degrees of freedom, making kinematic analysis and gait planning non-trivial. Traditional methods like the Denavit-Hartenberg (D-H) method are limited to single rotational or translational motions per joint, which is insufficient for joints like the ankle, hip, and shoulder that exhibit multiple rotations. To overcome this, we utilize projection analysis, which simplifies computations by projecting three-dimensional motions onto sagittal and coronal planes. This approach reduces computational time and storage requirements while accurately capturing the kinematic characteristics of humanoid robots. In this paper, we detail how projection analysis, combined with cubic spline interpolation and PSO, leads to efficient gait optimization, enhancing the overall performance and stability of humanoid robots in various applications of robot technology.
Projection analysis is a powerful method for kinematic modeling in robot technology, particularly for systems with multiple degrees of freedom per joint. The basic process involves projecting the three-dimensional motion of a link onto two-dimensional planes—specifically, the sagittal plane (x-z plane) and the coronal plane (y-z plane). For instance, consider a two-degree-of-freedom joint motor rotating a link initially aligned with the z-axis of length l. First, the link is rotated by an angle φ about the x-axis, followed by a rotation by an angle θ about the y-axis. The projections onto the sagittal and coronal planes allow us to compute the end-point coordinates efficiently. The coordinates in the x, y, and z directions are given by:
$$P_x = l \cos \phi \sin \theta = l_S \sin \theta$$
$$P_y = -l \cos \theta \sin \phi = -l_C \sin \phi$$
$$P_z = l \cos \phi \cos \theta = l_S \cos \theta$$
where \( l_S \) and \( l_C \) represent the projected lengths in the sagittal and coronal planes, respectively. This method simplifies the computation of global coordinates for all joints in a humanoid robot. For a humanoid robot in a left-foot support state, the absolute coordinates of joints can be derived sequentially. The projected lengths for lower-body links in the sagittal plane are expressed as:
$$l_1^S = l_1 | \cos \phi_1 |, \quad l_2^S = l_2 | \cos \phi_1 |, \quad l_4^S = l_4 \left| \cos \left( \phi_{12} + \frac{\pi}{2} \right) \right|$$
$$l_6^S = l_6 \left| \cos \left( \phi_{123} + \frac{\pi}{2} \right) \right|, \quad l_7^S = l_7 \left| \cos \left( \phi_{123} + \frac{\pi}{2} \right) \right|$$
$$l_8^S = l_8 \left| \cos \left( \phi_{1234} + \frac{\pi}{2} \right) \right|$$
Similarly, in the coronal plane, the projected lengths are:
$$l_1^C = l_1 | S_1^\theta |, \quad l_2^C = l_2 | S_{12}^\theta |, \quad l_4^C = l_4, \quad l_6^C = l_6 | S_{1234}^\theta |$$
$$l_7^C = l_7 | S_{12345}^\theta |, \quad l_8^C = l_8 | S_{123456}^\theta |$$
where \( S_{1 \dots k}^\theta \) denotes \( \sin(\theta_1 + \cdots + \theta_k) \), and \( \phi_{1 \dots k} \) represents \( \phi_1 + \cdots + \phi_k \). The three-dimensional absolute coordinates for each joint can then be computed. For example, the coordinates for joint 1 are:
$$X_1 = X_0 + l_1^S C_1^\theta, \quad Y_1 = Y_0 + l_1^C \sin \phi_1, \quad Z_1 = Z_0 + l_1^S S_1^\theta$$
where \( C_{1 \dots k}^\theta \) and \( S_{1 \dots k}^\theta \) represent \( \cos(\theta_1 + \cdots + \theta_k) \) and \( \sin(\theta_1 + \cdots + \theta_k) \), respectively. This projection method efficiently handles the multi-degree-of-freedom nature of humanoid joints, which is crucial for advanced robot technology applications. When the robot switches to right-foot support, minor adjustments are made, such as modifying the pelvic link length in the sagittal plane to account for phase differences. For the upper body, similar projections are applied to compute coordinates, ensuring comprehensive kinematic analysis. The use of projection analysis in robot technology not only streamlines computations but also enhances the accuracy of motion simulations, which is vital for real-world implementations.
Gait planning in humanoid robots is critical for maintaining dynamic balance and stability. The zero moment point (ZMP) is a key metric used to assess stability during walking. ZMP is defined as the point on the ground where the net moment of inertial forces and gravity forces is zero in the horizontal direction. If the ZMP lies within the support polygon (e.g., the foot area), the robot remains stable; otherwise, it may fall. To generate a dynamic walking pattern, we use a table-cart model analogy, where a cart of mass m moves on a table, representing the robot’s center of mass, and the table legs represent the support feet. The ZMP equations for the x and y directions are derived from the balance of moments. For the x-direction, the ZMP position \( P_x \) is given by:
$$P_x = x – \frac{z_c}{g} \ddot{x}$$
where \( x \) is the cart’s position, \( z_c \) is the height of the center of mass, \( g \) is gravity, and \( \ddot{x} \) is the acceleration. This equation ensures that the horizontal moment around the ZMP is zero. For a humanoid robot with multiple links, the ZMP coordinates can be computed using the following state-space equations:
$$X_{ZMP} = \frac{\sum_{i=1}^n m_i (\ddot{z}_{im} + g) X_{im} – \sum_{i=1}^n m_i \ddot{x}_{im} Z_{im} – \sum_{i=1}^n I_{iy} \ddot{\Omega}_{iy}}{\sum_{i=1}^n m_i (\ddot{z}_{im} + g)}$$
$$Y_{ZMP} = \frac{\sum_{i=1}^n m_i (\ddot{z}_{im} + g) Y_{im} – \sum_{i=1}^n m_i \ddot{y}_{im} Z_{im} – \sum_{i=1}^n I_{ix} \ddot{\Omega}_{ix}}{\sum_{i=1}^n m_i (\ddot{z}_{im} + g)}$$
where \( m_i \) is the mass of the i-th link, \( (X_{im}, Y_{im}, Z_{im}) \) are the absolute coordinates of the link’s center of mass, \( I_{ix} \) and \( I_{iy} \) are the moments of inertia, and \( \ddot{\Omega}_{ix} \) and \( \ddot{\Omega}_{iy} \) are the angular accelerations. In projection analysis, we adapt these equations by representing the center of mass of each link using interpolation between joint coordinates. For a link k connecting joints k-1 and k, the center of mass \( (X_{km}, Y_{km}, Z_{km}) \) is:
$$(X_{km}, Y_{km}, Z_{km}) = (\alpha_k x_k + \beta_k x_{k-1}, \alpha_k y_k + \beta_k y_{k-1}, \alpha_k z_k + \beta_k z_{k-1})$$
where \( \alpha_k \) and \( \beta_k \) are interpolation coefficients. By differentiating twice, we obtain the accelerations needed for ZMP computation. This approach integrates seamlessly with projection analysis, enabling efficient stability assessment in robot technology.
To generate reference ZMP trajectories for walking, we define key points for different walking phases: initial step, periodic step, and termination step. For example, in the initial step, the ZMP moves from point A (double support) to point B (single support) and then to point C and D. The target ZMP coordinates at any time t are computed using linear interpolation between these points:
$$x_{zmp}^r(t) = x_i + \frac{x_{i+1} – x_i}{t_{i+1} – t_i} (t – t_i)$$
$$y_{zmp}^r(t) = y_i + \frac{y_{i+1} – y_i}{t_{i+1} – t_i} (t – t_i)$$
for \( t_i \leq t < t_{i+1} \) and i = 0,1,2. This ensures a smooth transition of the ZMP, which is essential for stable gait in humanoid robots. For trajectory planning of joint angles, we use cubic spline interpolation to achieve continuous and smooth motions. The joint angle trajectory in each interval is represented by a cubic polynomial:
$$q(t) = a_0 + a_1 t + a_2 t^2 + a_3 t^3$$
where the coefficients are determined based on boundary conditions, such as zero velocity and acceleration at the start and end points to minimize impacts. This method allows for efficient real-time computation, which is crucial in robot technology applications where processing power is limited.
Particle swarm optimization (PSO) is a global optimization algorithm inspired by social behavior, such as bird flocking. It is particularly effective for solving complex optimization problems in robot technology, including gait optimization. In PSO, a population of particles (candidate solutions) moves through the search space, updating their positions based on their own experience and the experience of neighboring particles. The velocity and position update equations for particle i in dimension d at iteration k+1 are:
$$V_{id}^{k+1} = W_{id}^{k+1} V_{id}^k + C_1 r_1 (P_{best id}^k – X_{id}^k) + C_2 r_2 (G_{best d}^k – X_{id}^k)$$
$$X_{id}^{k+1} = X_{id}^k + r V_{id}^{k+1}$$
where \( V_{id} \) is the velocity, \( X_{id} \) is the position, \( W \) is the inertia weight, \( C_1 \) and \( C_2 \) are acceleration coefficients (typically set to 2), \( r_1 \) and \( r_2 \) are random numbers between 0 and 1, \( P_{best} \) is the personal best position, and \( G_{best} \) is the global best position. The inertia weight W decreases linearly with iterations to balance exploration and exploitation. For gait optimization, we define a cost function that incorporates trajectory variables and energy consumption. In the double support phase, the cost function J for walking preparation is:
$$J(\theta, \phi) = |X_c – (X_0 – 0.5 S_0)| + |X_6 – (X_0 – S_0)| + 2 |Z_6|$$
where \( X_c \) is the X-coordinate of the pelvis center, \( X_0 \) is the X-coordinate of the front foot center, \( S_0 \) is the step length, and \( X_6 \) and \( Z_6 \) are the coordinates of the swinging foot. This function ensures that the pelvis is centered and the swinging foot is off the ground. To optimize energy efficiency, we consider the average power \( P_v \) and the root mean square deviation of instantaneous power \( \sigma \). The instantaneous power \( P_s \) for a walking cycle is:
$$P_s = \sum_{i=1}^5 |M_i(t) \cdot \dot{\theta}_i(t)|$$
where \( M_i(t) \) is the torque of joint i and \( \dot{\theta}_i(t) \) is the angular velocity. The average power over a cycle of duration \( T_s + T_d \) is:
$$P_v = \frac{1}{T_s + T_d} \sum_{i=1}^5 \int_0^{T_s + T_d} |M_i(t) \cdot \dot{\theta}_i(t)| dt$$
and the deviation \( \sigma \) is:
$$\sigma = \sqrt{\frac{1}{T_s + T_d} \int_0^{T_s + T_d} (P_s – P_v)^2 dt}$$
The overall objective function F(x) for stability and energy optimization is:
$$F(x) = \alpha J + \beta (P_v + \sigma)$$
where \( \alpha \) and \( \beta \) are weighting factors between 0 and 1. Minimizing F(x) leads to stable and energy-efficient gaits, which are key goals in advancing robot technology.
For simulation, we use the DARwin-OP humanoid robot model with specific link dimensions and masses. The parameters are summarized in the following tables:
| Link | Dimension (m) |
|---|---|
| Heel (\( l_{ca} \)) | 0.0335 |
| Shank (\( l_{tb} \)) | 0.093 |
| Femur (\( l_{fe} \)) | 0.093 |
| Hip (\( l_{hp} \)) | 0.03 |
| Pelvis (\( l_{pv} \)) | 0.074 |
| Upper Arm (\( l_{hu} \)) | 0.06 |
| Forearm (\( l_{ra} \)) | 0.129 |
| Torso (\( l_{tr} \)) | 0.0922 |
| Shoulder (\( l_{sh} \)) | 0.115 |
| Neck (\( l_{nk} \)) | 0.0505 |
| Head (\( l_{hd} \)) | 0.069 |
| Forefoot (\( l_{ft\_for} \)) | 0.052 |
| Hindfoot (\( l_{ft\_back} \)) | 0.052 |
| Foot Inner (\( l_{ft\_inner} \)) | 0.023 |
| Foot Outer (\( l_{ft\_outer} \)) | 0.043 |
| Link | Mass (kg) |
|---|---|
| Heel (\( m_{ca} \)) | 0.0167 |
| Shank (\( m_{tb} \)) | 0.0703 |
| Femur (\( m_{fe} \)) | 0.1190 |
| Hip (\( m_{hp} \)) | 0.0271 |
| Pelvis (\( m_{pv} \)) | 0.0167 |
| Upper Arm (\( m_{hu} \)) | 0.1684 |
| Forearm (\( m_{ra} \)) | 0.0593 |
| Torso (\( m_{tr} \)) | 0.0976 |
| Shoulder (\( m_{sh} \)) | 0.0259 |
| Neck (\( m_{nk} \)) | 0.0244 |
| Head (\( m_{hd} \)) | 0.1580 |
| Foot (\( m_{foot} \)) | 0.0794 |
In MATLAB R2016a, we set the gait parameters: step length sl = 0.05 m, walking cycle T = 1 s, and sampling period = 0.05 s. For PSO, we use a population size N = 50, maximum iterations M = 200, inertia weight W = 0.8, and acceleration coefficients C1 = C2 = 2. The optimization process converges quickly, as shown by the fitness curve, which drops from [0.02, 0.06] to [0, 0.001] within iterations. The optimized joint angles result in a natural walking posture, with the ZMP trajectory and swinging foot trajectory showing smooth and stable patterns. The simulation outputs demonstrate that the robot achieves stable initial, periodic, and termination steps, with minimal fluctuations in the ZMP, indicating enhanced stability. This underscores the effectiveness of our integrated approach in robot technology for gait optimization.
In conclusion, we have presented a comprehensive method for gait optimization in humanoid robots using projection analysis, cubic spline interpolation, and particle swarm optimization. Projection analysis simplifies kinematic modeling by handling multi-degree-of-freedom joints efficiently, while cubic spline interpolation ensures smooth trajectory planning. PSO effectively searches for global optimal parameters, minimizing trajectory errors and energy consumption. The ZMP-based stability criterion ensures dynamic balance during walking. Simulation results on the DARwin-OP robot validate our approach, showing improved performance in terms of stability and energy efficiency. Future work will focus on enhancing the robustness of the system against external disturbances, further advancing the capabilities of humanoid robots in real-world applications of robot technology. The integration of these methods provides a solid foundation for developing more adaptive and reliable humanoid robots, contributing to the ongoing evolution of robot technology.
