Fault-tolerant motion planning for a hexapod robot with single-leg failure using a foot force control method

Hexapod robots are widely used for resource exploration, post-disaster rescue, and military equipment. They typically travel on rugged and complex roads. The robot itself has a high probability of failure owing to mechanical failure, driving motor failure, or external environmental interference. To improve the adaptability of the robot to a complex environment, a motion control method for fault-tolerant gait was designed. The trajectory generator based on zero-moment point information can generate a smooth desired trajectory for the body’s center of mass, thereby improving the robot’s zero-moment point trajectory tracking effect and motion stability. The force-distribution algorithm based on torque optimization selects the minimum square sum of the driving force as the objective function and reduces the number of constraint equations through QR decomposition to increase the speed at which the expected contact force at the foot is calculated. A CoppeliaSim and MATLAB/Gurobi joint simulation platform were built to simulate and verify the fault-tolerant motion planning of the hexapod robot and foot contact force control algorithm. The feasibility and effectiveness of the fault-tolerant motion planning and foot force control algorithm applied to a hexapod robot with a single-foot failure are verified.


Introduction
Compared with wheeled robots, foot robots have more advantages in unstructured environments, including adaptability and flexibility in irregular terrains. [1][2][3] Therefore, foot robots have wider application prospects in certain special environments. Niu et al. 4 proposed a novel rescue robot with a three-degrees-of-freedom leg mechanism based on the serial-parallel and wheel-legged mechanisms. However, a robot moving in a dangerous or disaster-hit environment is prone to leg failure and cannot be repaired manually. A robot with a foot fault is considered faulttolerant if it can find a gait that will allow itself to continue to move in a particular environment. This will improve the applicability of foot robots in navigating unknown environments.
Presently, research on the fault tolerance of legged robots is focused on gait planning and execution. Mostafa et al. proposed a removable sliding-leg approach to solving this problem. A faulty leg can be detached, and other legs can slide to a better position by the command of the operator to obtain the optimum alternative gait configuration. 5 Asif et al. proposed a gait based on fault detection and diagnosis that can generate adaptive walking patterns with joint or sensor faults. [6][7][8] Ding et al. specifically described several fault-tolerant gaits of a hexapod robot with one-and two-leg failures and carried out simulation and experimental verification on the NOROS. 9, 10 Du proposed a method of motion planning through linear, fault-tolerant Jacobian matrices. 11 This method enables the robot to accomplish the desired movement using broken legs along with certain other concomitant motions as compensation.
Schleyer and Russell proposed an adaptive gait generation algorithm that is aimed at combining multiple failed legs. 12 By calculating the motion trajectories of the support and swing legs of a robot, stable linear motion can be obtained in any desired direction, and maximum walking stability can be ensured.
When walking, the hexapod robot with single-leg failure optimizes the actual irregular and unreasonable foot end contact force to solve the problems of internal force confrontation between the foot ends of the support phase and, ultimately, to maintain its body posture in a stable state. This results in excessive joint torque of individual legs, structural damage, excessive energy loss, and foot end slip. Various scholars have studied the optimization of the foot force of robots. Chen et al. 13 proposed a galloping gait control method based on a full-scale virtual model and optimal plantar force distribution. By transforming the force distribution calculated by the virtual model of the robot trunk into a quadratic optimization problem, the stability of the robot under flight trot gait can be improved. Valsecchi et al. 14 proposed a reaction motion strategy for a torque-controllable quadruped robot based on a sensing foot. The contact zero space was used to minimize the tangential force, minimizing the risk of slipping. Liu et al. 15 studied the relationship between the walking mode and foot force of an electric heavy hexapod robot in a three-legged gait. According to the structural characteristics of an electric heavy hexapod walking robot, a mathematical model of the normal foot force under a tripod gait in a typical walking mode was established. Biswal and Mohanty 16 calculated the optimal foot force of the joint torque of the quadrupedal robot, carried out dynamic modelling of the foot end and trunk of the quadruped robot, and realized the stability of the motion process through optimal foot force control.
In this study, we focused on improving the robustness and stability of a hexapod robot with single-leg failure. Based on previous research, we investigated fault-tolerant motion planning for a hexapod robot with a single-leg failure using a foot force control method.
The main contributions of this article are summarized as follows.
(1) Targeting the single-leg fault of a hexapod robot, the fault-tolerant triangular gait was designed and the gait parameters were determined. Compared with the fault-tolerant gait by Mostafa et al., 5 this study optimized the initial angle of the joint based on the static stability margin (SSM) and designed an online trajectory generator based on predictive control. The trajectory generator based on zeromoment point (ZMP) information generated a smooth desired trajectory for the body centroid to improve the robot ZMP trajectory tracking effect and improve the motion stability. (2) To further improve the motion stability of the robot, foot force control was added to the above control method. By decomposing the inertia force of the body mass center and compensating for the foot end position of each leg, the internal force between the feet caused by the tumbling moment of the body can be reduced. Based on the dynamic balance equation, friction constraints, driving force constraints, and touchdown constraints of the hexapod robot, the force distribution algorithm based on torque optimization selects the minimum sum of squares of the driving force as the objective function, reduces the number of constraint equations through QR decomposition to improve the calculation speed, and solves the expected contact force at the foot end.
The remainder of this article is organized as follows. In the second section, the kinematic and dynamic models are described. The third section describes the development of a fault-tolerant motion planning method. In the fourth section, a driving-force distribution method based on dual quadratic programming is proposed. The proposed method is verified in the fifth section through simulation experiments. The final section concludes the article.

Kinematics and dynamics modelling
The configuration of the hexapod robot used in this study is shown in Figure 1. The robot was composed of a body and six legs. The body has a hexagonal structure and six legs are distributed outside the body. Each leg had the same structure and three degrees of freedom. The heel joint is a rotating joint connecting the body and base joint, which is a primary pitching joint that connects the base joint with the thigh, and the knee joint is a secondary pitching joint that connects the thigh and lower leg. The heel, hip, and knee angles were a, b, and g, respectively. The base section, thigh, and lower leg were L 1 , L 2 , and L 3 , respectively. P G À X g Y g Z g is defined as the world coordinate system, as the heel joint coordinate system, P HÀ X h Y h Z h as the hip joint coordinate system, P K À X k Y k Z k as the knee joint coordinate system, and P F À X f Y f Z f as the foot end coordinate system.

Kinematic modelling
where c stands for cos and s stands for sin. When the foot position vector and heel joint position are known, the single-leg inverse kinematic equation is as follows as stands for arcsin, ac stands for arccos, and at stands for arctan.
According to the foot position information, the joint velocity _ q and acceleration € q can be obtained based on the Jacobian matrix The foot position vector is B

Dynamic modelling
The matrix form of the joint load torque generated by the leg i dynamics can be expressed as The joint driving torque of hexapod robot i leg is where t i is the load torque of leg i caused by dynamics, which is obtained from equation (3); J T i 2 R 3Â3 is the force Jacobian matrix of the leg, and F i 2 R 3Â1 is the foot end contact force of leg i. When leg i is a swinging leg, The hexapod robot was affected by gravity, friction, and inertial forces during motion. When a single robot leg fails, the actions of various forces affect the stability of the robot's motion. The force condition of the hexapod robot during movement is shown in Figure 2. 17 A powerful balance formula was proposed to maintain the stability of the robot during motion where F G is the gravity of the real-time center of gravity of the body, F ri is the contact force generated by the contact between the anchor and ground, F I is the equivalent inertial  force of the robot, and n is the number of robot support legs in the current state. During movement, the gravity direction of the robot is always perpendicular to the ground; however, the real-time change in the position of the center of gravity will have a significant impact on the robot movement. Failure of the support leg of the robot leads to excessive force on the failed leg, foot slip, or rotational instability around the instability tipping sideline. Therefore, to prevent the robot foot from slipping, the following friction constraints must be satisfied ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi ffi where m is the friction coefficient and F const is a force constant determined according to the characteristics of the robot and terrain conditions. To prevent the robot from rotating around the unstable tipping sideline, it needs to satisfy equation (9) to maintain its torque balance where M G ,M ri , and M I represent the gravity at the real-time center of gravity of the fuselage, ground support force on the landing foot, and torque generated by the equivalent inertial force, respectively.

Fault tolerant gait
When a hexapod robot moves in complex environments, such as when performing engineering exploration, disaster rescue, and extraterrestrial exploration, it faces mechanical, electrical, and control damage or failure owing to the interference and impact of the external environment, resulting in a lack of leg support and an inability to support its body.
In this study, we considered only the loss of one leg. The hexapod robot is isotropic in the direction of each leg; thus, to avoid repeated planning, we assumed that the leg failed and could not work. Thus, the robot lifted it as a load continuously; it was not considered in fault-tolerant gait planning. A five-step fault-tolerant triangular gait with a gait cycle in which three legs support the body and two swing legs was designed. 18 In the designed gait, each leg experiences two swing stages and three support stages. Therefore, the duty cycle of the fault-tolerant triangular gait is In the fault-tolerant gait sequence diagram in Figure 3, the black line represents the support phase of the corresponding leg in the gait cycle and the direct blanks of the two black lines represent the swing phase. Evidently, the time lengths of the two support phases of the leg were different.
The gait sequence in phases is as follows

Design of a predictive controller for fault-tolerant gait
When moving in outdoor terrain, the robot is affected by interference from external and inertial forces. These interference are exacerbated by complex ground fluctuations. In such scenarios, the classical SSM and other static stability determination methods that only use fuselage position information and centroid distribution to determine the stability of the robot are no longer applicable. The dynamic stability determination method can better solve the problem of determining the system stability of the robot in the process of motion, mainly because it can use the D'Alembert principle to equate the above disturbance to the centroid position and then analyze it. In summary, because the hexapod robot uses sensors to obtain the real-time foot force of the supporting foot, we used the ZMP method as the basis for judging the stability of the robot. Its advantage is that the disturbance can be equated to the centroid position using the D'Alembert principle, which is suitable for the stability analysis of a robot in complex terrain. The ZMP is the minimum value of the distance from the ZMP, which has zero moments in X and Y directions, on the plane to each side of the projection of the support polygon. As shown in Figure 4, let the coordinate of the ZMP be expressed as x zmp ; y zmp , and let f i be the foot force component of landing leg i in the vertical direction. The calculation method is as follows The ZMP stability margin of the robot was the minimum distance from the ZMP to the support polygon.
In this study, the "table car" model was used to approximate the value of the ZMP Applying modern control theory to the table car model, the differential of car acceleration versus time was defined as the system input variable. Therefore, equation (3) can be rewritten as the following system state equation 19 d dt x _ x € x The continuous system equation (14) is discretized using time Dt To make the output p k of the system track the target ZMPp ref k as accurately as possible, consider the problem of minimizing the tracking performance index, that is, define the performance index function where Q and R are the positive weighting coefficients. According to the predictive control theory, this performance index can be minimized by using the input of the target reference value of the next N steps . . . where The preview controller consists of state feedback (the first term on the right), feed-forward of the inner product of the target reference value f 1 ; f 2 ; Á Á Á f N ½ , and the weighting factor in the next N steps (the second term on the right).
A ZMP tracking deviation is observed when generating a long-distance walking mode using equation (19). To remedy this, equation (15) can be rewritten in the following extended form The new input and state vectors are taken as A controller was designed for the system defined by equation (22) to minimize the following performance indicators The preview controller is given as follows By using the above trajectory generator based on future ZMP information, a smooth desired trajectory can be generated for the body centroid to improve the robot's ZMP trajectory tracking effect and motion stability. Based on the mechanical configuration, step height, gait cycle, and duty cycle of the hexapod robot, the expected ZMP trajectory in the future is designed to ensure that the expected ZMP has a sufficient dynamic stability margin. The discrete Riccati equation is solved using the dlqr function in the MATLAB control system toolbox to obtain the numerical solutions of P, K, and f i . Subsequently, the prediction gain and state feedback gain are calculated, and their values are used to calculate the control input signal u k . The control input signal was then inputted into the trajectory prediction controller to obtain an appropriate smooth centroid trajectory.
In the predictive control theory, the associated control parameters are the hexapod robot body height z c , acceleration due to gravity g, system sampling time Dt, control parameters Q, and R, and prediction step N. Among the above control parameters, the first three parameters take different constant values according to the motion state and terrain conditions of the hexapod robot; however, the latter three control parameters require further discussion. 20 By multiplying both sides of equation (21) by 1=R simultaneously, we obtain where X ¼ P=R.
From equation (28) and the uniqueness of the solution of the Riccati equation, when Q R is a fixed value, the value of X is unique and the values of the feedback gain K and prediction gain f i remain unchanged. The effect of the weighting coefficients Q and R on the feedback gain K and prediction gain f i is called correlation.
After g is determined, z c and Dt are provided, and the change in the predicted gain is obtained for Q and R, as shown in Figure 5. It can be observed from the figure that the prediction gain approaches zero at 1.15s, and the expected trajectory after this time has a minimal effect on the control performance of the system.

Driving force distribution based on dual quadratic programming
First, the static balance equation of the hexapod robot system was established. The specific form of this equation is as follows Ã T is the combined external force and moment on the body centroid and I is the unit matrix. The number of support legs of the hexapod robot is not less than three at any time; essentially, 3 n 5. The solution of equation (29) is not unique; as there are 3n unknowns and six equations that are not ranked, there are countless groups of solutions. Taking this equation as an equality constraint, it is necessary to add other constraints, set optimization objectives according to their own needs, and obtain the optimal solution through mathematical programming.
In the process of foot ground contact of the hexapod robot, the foot end of the robot support leg must meet friction constraints to avoid relative sliding between the robot support leg and the ground. Because the size of the foot end can be regarded as a point relative to the body, point contact friction is assumed to exist between the robot's foot end and ground ffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffiffi where m is the static friction coefficient. The optimization problem of the foot end contact force distribution of a hexapod robot is essentially a nonlinear programming problem, and finding its solution is a complex process. To improve the speed at which a solution to the optimization problem is determined, the foot end friction cone constraint is usually used instead of the inner pyramid constraint. As shown in Figure 6, the friction constraint was linearized. 21 The inequality constraints shown in equation (32) can be replaced by the following To ensure effective contact between the ground and support leg, the foot end contact force should satisfy the following constraints Considering the limit driving force constraint, the following driving force constraints must be considered where t imax is the joint torque constraint of the second supporting leg.
From equations (32) to (35), all have the same mathematical representation; therefore, the above formula can be abstracted into a standard inequality constraint form with the same mathematical representation The sum of squares of the joint driving forces is then selected as the objective function where G ¼ The quadratic programming problem with equality constraints is transformed into a problem with inequality constraints, which can reduce computational cost. The QR decomposition of A T was obtained where Q is an orthogonal matrix, and R is a row full-rank upper triangular matrix. Decomposing Q into Q 1 and Q 2 yields equation (40) The dimensions of Q 1 are 3nÂ6, the dimensions of Q 2 are 3n Â (3nÀ6), and Q 1 Then, EY ¼ I and EZ ¼ 0. Furthermore where F r 2 R 3nÀ6 is obtained by substituting equation (42) into equation (37) min The optimal distribution of the driving torque of each support leg can then be obtained using equation (6). 22

Simulation verification
As shown in Figure 7, this study used CoppeliaSim and MATLAB to jointly build the simulation experiment platform, a shared memory plug-in to complete the communication between them and the Real-timePacer plug-in to synchronize the MATLAB numerical calculation time with the actual running time of CoppeliaSim. The simulation platform was divided into three parts. First, mechanical modelling of the hexapod robot was performed. The model was then imported into a simulation environment. Finally, a closed-loop joint simulation was conducted. The CPU model of the simulation platform was Intel(R) Pentium G4600. The parameter settings for the simulation are listed in Table 1.
The walking motion simulation experiment of the hexapod robot with a single-leg fault took leg 1 as the fault leg and used the remaining five legs for planning control. The total simulation time is 200s. The desired ZMP trajectory of the next gait cycle generates the desired position trajectory of the robot body through a trajectory generator based on predictive control. Because the simulation environment was an ideal flat terrain, and the motion speed set by the hexapod robot was low, the trajectory expected by the ZMP was designed as a continuous and smooth curve. Figure 8 shows the position-tracking trajectory curve of the hexapod robot body with single-leg failure. The red solid line represents the feedback of the robot position sampled by the simulation system, and the blue dotted line represents the target position trajectory of the robot body.
The position trajectory and target trajectory in each direction of the hexapod robot body were generated by the trajectory generator, and the target trajectory in the Z direction was determined by the height of the body. The tracking effect of the centroid position of the robot body was satisfactory in three directions of the world coordinate system. The control error in the X direction of the coordinate system was between À0.015 and 0.003 m, the control error in the Y direction was between À0.018 and 0.018 m, and the control error in the Z direction was between À0.05 and 0.05 m. Figure 9 shows the attitude tracking trajectory curve of the hexapod robot body with single-leg failure. The dotted line represents the target attitude trajectory of the robot body, and the solid line represents the feedback of the robot attitude angle information sampled by the simulation system. The yaw, pitch, and roll angles of the robot's desired position and attitude were 0. In the world coordinate system, the yaw angle deviation of the robot's attitude was  between À0.3 and 0.5 , the pitch angle deviation of the attitude was between À0.65 and 0.95 , and the roll angle deviation of the attitude was between À0.45 and 0.65 . It can be observed from the figure that the yaw angle tracking control effect of the robot is satisfactory, and the deviation is controlled within a small range. The yaw, pitch, and roll angles of the hexapod robot exhibited periodic changes. It can be observed from the figure that the hexapod robot with single-leg failure will not collapse or experience instability, and the yaw angle control effect of the hexapod robot with single-leg failure is satisfactory. As shown in Figure 10, the foot end contact forces in the X, Y, and Z directions show periodic changes. Because the foot end contact forces in the X and Y directions are very small when the robot runs at a uniform speed on a horizontal plane, when feet 2, 4, and 5 switch from the swing phase to the support phase, with the forward movement of the center of gravity, the foot ground contact force of the legs gradually increases until the other swing legs share part of the gravity when they land. The legs are then lifted and enter the swing phase. It can be seen from the figure that when feet 2, 4, and 5 are in the support phase, the contact force at the foot end in the Z direction is not significantly different, and it does not exceed 1500 N.
The positional relationship between the foot end and the body center of gravity in the projection coordinate system can be obtained according to the coordinates and inertial navigation information of the foot end in the body coordinate system. With this information, the minimum value of the distance between the body's center of gravity and each side of the leg support polygon during the movement of the hexapod robot with single-leg failure at any time can be determined.
In this study, the stability margin of fault-tolerant gait based on ZMP and foot strength optimization and typical fault-tolerant gait presented in Mostafa et al. are compared. According to Figure 11, the stability margin of the human body under the fault-tolerant gait based on ZMP and foot benefit optimization proposed in this paper was maintained between 517 mm and 935 mm and that of the robot under the classical fault-tolerant gait was maintained between  425 mm and 935 mm. Compared with traditional methods, the minimum stability margin of this method was increased by 21%; thus, the hexapod robot with single-leg failure has higher motion stability under the joint action of faulttolerant gait planning and foot force optimization control of the ZMP hexapod robot.
The simulation results reveal that the fault-tolerant motion planning online generation algorithm of the hexapod robot based on predictive control enables the hexapod robot with a single-leg failure to realize fast fault-tolerant walking on flat terrain. The actual ZMP trajectory has a good tracking effect on the target ZMP and ensures the dynamic stability of the robot during the motion process. Under the joint action of the predictive control and force optimization algorithm, the desired robot centroid trajectory generated by the trajectory generator based on the predictive control achieved a good tracking effect. Simultaneously, the stability margin of the robot significantly improved.

Conclusions
Considering the leg fault of the hexapod robot, a faulttolerant triangular gait was designed, and the gait parameters were determined. An online trajectory generator based on predictive control was designed. The trajectory generator based on the ZMP information can generate a smooth desired trajectory for the body centroid to improve the robot ZMP trajectory tracking effect and improve the motion stability of the robot. Second, to improve the motion stability of the robot that considers the dynamic balance equation, friction, driving force, and touchdown constraint conditions of the hexapod robot, the force distribution algorithm based on torque optimization selects the minimum sum of squares of the driving force as the objective function and reduces the number of constraint equations through QR decomposition to reduce the speed at which the desired contact force at the foot end is calculated.
An online generation algorithm for fault-tolerant motion planning for a hexapod robot based on predictive control is proposed, which makes the hexapod robot with single-leg failure realize fast fault-tolerant walking on flat terrain. Furthermore, force distribution algorithm based on torque optimization is proposed. Finally, QR decomposition was used to improve the calculation speed of the algorithm and further improve the stability of fault-tolerant gait walking.

Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.

Funding
The author(s) disclosed the receipt of the following financial support for the research, authorship, and/or publication of this article: This work is funded by approach of Cooperative Perception, Decision, Control and Experimental Verification for Largescale Hexapod Robots Traversing on Complex Environments (91948202) and research on Fault-tolerant Control Method and Switching Strategy of Heavy-duty Hexapod Robot with Lack of Full-state Motion Ability (52175012).