Abstract
To improve the walking stability of a hexapod robot, a foot-end trajectory planning method using quintic polynomial interpolation through waypoints is presented. The main objective is to achieve smooth joint motion at waypoint transitions and to reduce vertical body oscillation during walking. First, an integrated model of the hexapod robot and a three-joint leg is established, and the kinematic relationship between joint angles and foot-end position is derived. Then, waypoint, stride, and continuity constraints are imposed on joint position, velocity, and acceleration to construct a general trajectory planning function based on quintic polynomial interpolation. Finally, an Adams–Simulink cosimulation model is developed, and the proposed method is verified under a triangular gait. The results indicate that the planned trajectory remains smooth when passing through waypoints, with no discontinuities in joint angular velocity or angular acceleration at transition points. Moreover, the robot achieves stable triangular-gait locomotion, while the vertical oscillation of the body is maintained within 1 mm.
Keywords
Introduction
During locomotion, hexapod robots may suffer from foot-end slippage and improper ground-contact timing, which can significantly degrade walking stability. In addition to an appropriate gait coordination strategy, stable locomotion requires smooth joint-space trajectory planning to avoid abrupt variations in velocity and acceleration. In particular, discontinuities in joint angular acceleration at trajectory transition points may induce impact loads, increase mechanical stress, and amplify body oscillations. Therefore, improving trajectory smoothness at gait-phase transition points is important for enhancing the overall stability of hexapod locomotion.
In recent years, extensive research has been conducted on stability enhancement of legged robots. Bioinspired structural designs, such as the crab-inspired compliant leg mechanism proposed by Zhang et al. 1 and the passive gripping foot developed by Hakamada et al., 2 have improved terrain adaptability. Meanwhile, a variety of trajectory planning methods have been investigated, including quintic NURBS interpolation, 3 polynomial-based schemes such as the “414” method, 4 neural-network-based approaches, 5 and CPG-based gait generation methods. 6 These studies have contributed to improving motion stability and environmental adaptability under different operating conditions.
Among existing trajectory planning methods, cubic polynomial interpolation is widely used because of its simple formulation and low computational cost. However, cubic interpolation usually guarantees continuity only up to the velocity level, and discontinuities in angular acceleration may still occur at segment transition points. Such discontinuities can excite undesirable dynamics and adversely affect coordinated multi-leg motion.
To address this issue, this article presents a segmented quintic polynomial interpolation method through prescribed waypoints under triangular gait coordination. The method is designed to ensure continuity of joint angle, angular velocity, and angular acceleration across trajectory segments, thereby improving the smoothness of gait-phase transitions. In addition, a two-stage trajectory organization is introduced, consisting of stride execution and terrain-adjustment descent, so that waypoint traversal and smooth transition requirements can be considered simultaneously. To evaluate the effectiveness of the proposed method, a cosimulation framework integrating MATLAB/Simulink and Adams is established. Simulation results show that the proposed method avoids acceleration discontinuities at waypoint transitions and helps reduce vertical body oscillation during locomotion.
The main contributions of this work are as follows:
A segmented quintic polynomial interpolation formulation through waypoints with explicit continuity constraints on joint position, velocity, and acceleration during gait transitions. A two-stage foot-end trajectory planning mechanism that integrates stride execution and terrain-adjustment descent under triangular gait coordination. A cosimulation-based validation framework showing that improved trajectory smoothness contributes to reduce vertical body oscillation and stable locomotion.
Different from conventional single-segment quintic interpolation commonly used in manipulator trajectory planning, the present study focuses on continuity enforcement across intermediate waypoints within a segmented gait-phase framework. In this way, the proposed formulation provides a clearer connection between local joint-motion smoothness and the overall stability of hexapod locomotion.
Kinematic analysis of the hexapod robot leg
The foot-end trajectory of a robot can be described by a sequence of key nodes in space, 7 and the corresponding joint angles can be obtained through inverse kinematics. 8 The hexapod robot model is shown in Figure 1, where Figure 1(a) presents the overall structure of the hexapod robot, Figure 1(b) shows the front view of a single three-joint leg, and Figure 1(c) shows the top view of the same leg. The robot realizes locomotion through the coordinated motion of its six legs. Each leg has three rotational joints, namely the hip joint, the knee joint, and the ankle joint. The motion of these joints changes the position of the foot-end, and the corresponding angular variations are driven by servo motors.

Structure of the hexapod robot. (a) Hexapod robot, (b) front view of a single leg, (c) top view of a single leg.
A single-leg model is established in the world coordinate system

Single-leg model of the hexapod robot.
Since each leg of the hexapod robot has only three rotational joints, the relationship between the foot-end position and the joint angles can be derived directly from the geometric structure of the leg. For given values of
Conversely, if the coordinates of point C are known, the corresponding joint angles can be obtained through inverse kinematics using equations (2)–(4). First, the angle
Then, the angle
Finally, the angle
Although the above kinematic relations are derived for a single leg, they provide the basic mapping between foot-end position and joint motion for the coordinated trajectory generation of the entire hexapod robot under triangular gait. In particular, the smoothness of joint trajectories directly affects the coordination between swing legs and support legs, and thus influences the overall stability of the robot body during locomotion.
Foot-end trajectory planning for hexapod robots
Common foot-end trajectory planning schemes
Robot trajectory planning refers to the process of determining the motion path of each joint or the end-effector according to the robot's performance characteristics, task requirements, and operating environment. 9 It also involves describing the robot's pose and motion state at any given time.10,11 In general, robot trajectory planning can be carried out in different planning spaces. 12 Cartesian-space trajectory planning is performed in the workspace coordinate system, where the motion variables of the end-effector, such as displacement, velocity, and acceleration, are taken as the planning objectives. 13 In contrast, joint-space trajectory planning is conducted in the joint coordinate space, where the joint displacement, velocity, and acceleration are directly planned. 14
Compared with wheeled and tracked robots, legged robots exhibit stronger obstacle-crossing capability and better environmental adaptability. By appropriately planning gait patterns and foot-end trajectories, the obstacle-crossing performance, locomotion efficiency, and energy consumption of legged robots can be improved. 15 Existing foot-end trajectory planning methods mainly include cycloid-based trajectories, 16 elliptical trajectories, 17 polynomial trajectories, 18 and straight-line or composite trajectories. 19 Representative studies have shown that improved cycloid trajectories can achieve smooth foot-end transitions and reduce ground-dragging phenomena, 20 while elliptic-curve-based trajectories can improve the smoothness of foot motion. 21 Cubic spline fitting has also been used for gait trajectory planning, although acceleration mutations may occur and lead to impact effects during ground contact. 22 In addition, elliptical reference trajectories, 23 parabolic or linearical reference trajectoriesit tra, 24 cubic polynomial interpolation through waypoints, 25 and quintic polynomial foot trajectories 26 have all been investigated to improve terrain adaptability, motion smoothness, and locomotion stability.
Among these methods, cubic polynomial interpolation is widely used because of its relatively simple formulation and implementation. However, under complex terrain conditions, cubic interpolation may not be sufficient to ensure both prescribed waypoint traversal and stride requirements. More importantly, cubic interpolation generally guarantees continuity only up to the velocity level, and angular acceleration discontinuities may still occur at segment transition points. These discontinuities can induce impact effects and adversely affect stable locomotion. By contrast, quintic polynomial interpolation can further enforce acceleration continuity and is therefore more suitable for smooth foot-end trajectory generation in hexapod robots.
Foot-end trajectory planning using quintic polynomial interpolation
The motion of a single leg can be described as the process in which each joint rotates from its initial angle to the corresponding target angle within a specified time interval, subject to velocity and acceleration constraints. Let the initial joint angles of the leg be denoted by
For a single step, the joint trajectory can first be expressed by a quintic polynomial interpolation function. Let the time required for completing one step be
To ensure continuity of motion at the start and end of the step, the initial and final angular velocities and angular accelerations are specified as zero. Thus, the boundary conditions are given by:
According to equations (5) and (6), six constraint equations can be established for each joint, from which the six coefficients of the quintic polynomial can be determined. The independent variable is time t, and the resulting polynomial trajectory can be expressed as:
However, in practical foot-end trajectory planning, the swing motion is usually divided into two consecutive segments: from the lift-off point to the intermediate waypoint, and from the waypoint to the landing point. Therefore, the trajectory of each segment is described separately using two quintic polynomial functions, with corresponding time intervals
If the two trajectory segments are planned independently using zero velocity and zero acceleration at their respective boundaries, the angular velocity and angular acceleration at the intermediate waypoint may become discontinuous. This discontinuity can lead to impact effects and reduce locomotion smoothness. Therefore, additional continuity constraints must be imposed at the waypoint so that the joint angle, angular velocity, and angular acceleration remain continuous when the trajectory passes through the waypoint. On this basis, a segmented quintic polynomial interpolation function through the waypoint is constructed to achieve smooth transition between adjacent trajectory segments and to avoid abrupt changes in joint motion.
Segmented quintic polynomial interpolation for foot-end trajectory planning through waypoints
To address the above problems, a segmented quintic polynomial interpolation method through waypoints is constructed for foot-end trajectory planning, as shown in Figure 3. The red dashed line represents the planned foot trajectory. Each step is divided into two phases: a stride-execution phase and a terrain-adjustment descent phase. A safety height H is introduced to determine the intermediate waypoint above the target landing location. The corresponding joint angles are then obtained through inverse kinematics. After the foot reaches the waypoint, it descends toward the landing point. In practical implementation, force sensing at the foot can be used to determine whether ground contact has occurred and to terminate the descent in time if necessary. Accordingly, the first trajectory segment describes the motion from the current foot-end position to the waypoint, while the second segment describes the motion from the waypoint to the landing point. Both segments are represented by quintic polynomial interpolation functions.

Foot trajectory planning scheme.
Although quintic polynomial interpolation is widely used in robotic trajectory planning, the contribution of this work does not lie in the polynomial form itself. Instead, it lies in the continuity constraints imposed at the intermediate waypoint, through which joint position, angular velocity, and angular acceleration are enforced to remain continuous between adjacent trajectory segments. In this way, smooth gait-phase transitions can be achieved, and abrupt variations in joint motion that may induce impact effects or mechanical stress can be avoided.
Let the joint angle corresponding to the waypoint, obtained from inverse kinematics, be denoted by
These constraints yield a system of 12 equations with 12 unknown coefficients, from which a unique solution can be obtained. If the time durations of the two trajectory segments are assumed to be identical, that is,
Substituting the solved coefficients
Simulation experiments for hexapod foot-end trajectory planning
Simulation of foot-end trajectories for the hexapod robot
The trajectory planning functions derived in “Foot-end trajectory planning for hexapod robots” section are applied simultaneously to all eighteen joints of the hexapod robot under triangular gait coordination. Therefore, the resulting locomotion behavior reflects a fully coupled multi-leg system rather than a set of independently moving legs. The six legs of the hexapod robot are numbered sequentially, and a reference coordinate system

Numbering of hexapod robot legs and establishment of a reference coordinate system.
Using MATLAB and the Monte Carlo method, the reachable workspace of the foot-end within the prescribed joint-angle ranges is obtained through kinematic analysis. The
Parameters of Leg 1.
For Leg 1, the ranges of joint angles

Reachable workspace of the foot-end obtained from kinematic analysis. (a) Reachable workspace point cloud of the hexapod robot's foot end, (b) projection on the xoy plane, (c) projection on the yoz plane.
In the simulation, the safety height and stride length are set as
Kinematic analysis results for Leg 1.
Kinematic analysis results for Leg 2.
Kinematic analysis results for Leg 3.
Using these parameters as the initial conditions, both the cubic polynomial interpolation function through waypoints and the segmented quintic polynomial interpolation function through waypoints are generated. The corresponding angle, angular velocity, angular acceleration, and jerk curves are then obtained for comparison. In the simulation, the robot leg is designed to reach the waypoint within 0.5 s and to complete the descent to the ground within the following 0.5 s, giving a total step period of 1.0 s. The proposed planning method is intended to maintain smooth motion transition between these two phases. Taking Joint A of Leg 2 as an example, the cubic polynomial interpolation function through the waypoint is given by:
The corresponding angular-parameter variation curves are shown in Figure 6(a), (c), (e), and (g). The segmented quintic polynomial interpolation function through the waypoint is given by:

Comparison of cubic and quintic polynomial interpolation through waypoints. (a) Cubic polynomial angle profile, (b) quintic polynomial angle profile, (c) cubic polynomial angular velocity profile, (d) quintic polynomial angular velocity profile, (e) cubic polynomial angular acceleration profile, (f) quintic polynomial angular acceleration profile, (g) cubic polynomial jerk profile, (h) quintic polynomial jerk profile.
The corresponding angular-parameter variation curves are shown in Figure 6(b), (d), (f), and (h).
As shown in Figure 6, the segmented quintic polynomial interpolation through waypoints effectively avoids the acceleration discontinuity observed in the cubic polynomial interpolation. The transition between the two trajectory segments remains smooth, and the angle, angular velocity, and angular acceleration profiles vary continuously throughout the step. Although the initial joint angles differ among the six legs, the kinematic analysis method and the proposed trajectory planning function can generate coordinated foot-end trajectories for all 18 joints of the hexapod robot under the prescribed stride condition.
Stability analysis of hexapod robot locomotion
The trajectory planning functions obtained for each joint were imported into MATLAB/Simulink, where they were implemented as S-Functions. By taking the leg sequence function of the triangular gait as the input and the joint-angle variation together with the vertical body displacement as the outputs, a cosimulation framework integrating Simulink and Adams was established, as shown in Figure 7. Based on this framework, the locomotion process and body-stability response of the hexapod robot were simulated and analyzed.

Simulink block diagram.
Discontinuities in joint acceleration may introduce dynamic excitation, which can propagate through the support structure and affect body posture. By enforcing acceleration continuity at the waypoint, the proposed method reduces such excitation sources and helps improve the vertical stability of the robot during locomotion. In the cosimulation, the segmented quintic polynomial interpolation function through waypoints was used as the joint-drive function for each leg. During leg lifting, swinging, and landing, the time-varying joint motion inevitably caused slight body oscillations. The measured vertical body displacement is shown in Figure 8, where Figure 8(a) and (b) presents the results obtained from the Adams side and the Simulink side, respectively. The two sets of results show good agreement, which verifies the consistency of the cosimulation framework. Moreover, the simulation results indicate that the proposed trajectory planning method can effectively suppress body oscillation induced by joint-motion excitation. Throughout the locomotion process, the vertical body oscillation remains within 1 mm, demonstrating that the proposed method satisfies the stability requirement of the hexapod robot.

Cosimulation results. (a) Vertical body oscillation measured on the Adams side, (b) vertical body oscillation measured on the Simulink side.
The Adams-based simulation further demonstrates that the hexapod robot can achieve stable triangular-gait locomotion under the proposed trajectory planning strategy, as shown in Figure 9. During the interval from 0 s to 0.5 s, Legs 1, 3, and 5 act as swing legs and move toward their prescribed waypoints, while Legs 2, 4, and 6 remain in the support phase. From 0.5 s to 1.0 s, the swing legs descend along the planned trajectories until ground contact is achieved. During the interval from 1.0 s to 1.5 s, the robot completes one stride, after which Legs 1, 3, and 5 switch to the support phase, while Legs 2, 4, and 6 begin to swing and move toward their corresponding waypoints. From 1.5 s to 2.0 s, the second group of swing legs descends and lands, completing the gait transition. Through this cyclic process, the robot maintains smooth posture evolution and stable walking, which further confirms the effectiveness of the proposed foot-end trajectory planning method.

Adams simulation results.
Conclusion
A segmented foot-end trajectory planning method for a hexapod robot is developed using quintic polynomial interpolation through waypoints. In the proposed method, the foot-end trajectory is divided into two phases: a stride-execution phase for completing the prescribed step length, and a terrain-adjustment descent phase for adapting to potentially complex ground conditions. Based on the joint-angle variations of each leg during a gait cycle, the corresponding segmented quintic polynomial interpolation functions are established. The resulting trajectory ensures smooth foot-end motion, with continuity of joint angle, angular velocity, and angular acceleration at waypoint transitions.
Cosimulation results in MATLAB/Simulink and Adams verify the effectiveness of the proposed method. Compared with cubic interpolation, the proposed quintic interpolation through waypoints effectively avoids acceleration discontinuities at trajectory-segment transitions and improves locomotion smoothness. The hexapod robot achieves stable triangular-gait walking, and the vertical body oscillation remains within 1 mm, satisfying the stability requirement.
Footnotes
Funding
The authors disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was supported by the Ningxia Science Foundation Project, (grant number 2024AAC03408).
Declaration of conflicting interests
The authors declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
