# Stability Criterion for Dynamic Gaits of Quadruped Robot
## 2 ZMP for Irregular Terrain  
In this section, the traditional _ZMP_ is modified to deal with the motion on irregular terrain. Because most of the mass is concentrated in the body of the robot, the mass of the legs is ignored to simplify our stability analysis. Traditional _ZMP_ refers to a point on the ground at which the net torque caused by gravity, the inertial force, and the inertial moment of each part of the robot is zero; it is only applicable when analyzing the motion on the horizontal plane. In this paper, _ZMP_ is extended to 3D space by defining and adjusting the plane of the support feet, and the velocity term is introduced to reflect the motion more efficiently and accurately. On irregular terrain, _ZMP_ should be considered as a point in 3D space. As shown in Figure 1, the position of the body's CoM (\(C\)) in the inertial coordinate system (\(i\)) is \(P_{\rm C}^{i}=\left[ \begin{array}{cc}x_{\rm C}^{i}&y_{\rm C}^{i}&z_{\rm C}^{i} \end{array} \right]^{T}\). The gravity of the body is \(G^{i}=\left[ \begin{array}{cc}G&0&0\end{array} \right]^{T}\), the inertial force at CoM is \(F_{I}^{i}=\left[ \begin{array}{cc}F_{Ix}^{i}&F_{ly}^{i}&F_{Iz}^{i}\end{array} \right] ^{T}\), and the inertial moment is \(N_{I}^{i}=\left[ \begin{array}{cc}N_{Ix}^{i}&N_{ly}^{i}&N_{Iz}^{i}\end{array}  \right]^{T}\). The position of _ZMP_ in the inertial coordinate system is assumed to be \(P_{\rm ZMP}^{i}=\left[ \begin{array}{cc}x_{\rm ZMP}^{i}&y_{\rm ZMP}^{i}&z_{ \rm ZMP}^{i}\end{array} \right]^{T}\); hence, according to the definition of _ZMP_,  
\[\left(P_{\rm C}^{i}-P_{\rm ZMP}^{i}\right)\times F_{I}^{i}+\left(P_{\rm C}^{i} -P_{\rm ZMP}^{i}\right)\times G^{i}+N_{I}^{i}=0. \tag{1}\]  
The following can be obtained from Equation (1):  
\[-\left(z_{\rm C}^{i}-z_{ZMP}^{i}\right)F_{ly}^{i}+\left(y_{\rm C}^{i}-y_{ZMP}^ {i}\right)F_{Iz}^{i}+N_{Ix}^{i}=0; \tag{2}\]  
\[\left(z_{\rm C}^{i}-z_{ZMP}^{i}\right)\left(F_{Ix}^{i}+G_{x}^{i}\right)-\left( x_{\rm C}^{i}-x_{ZMP}^{i}\right)F_{Iz}^{i}+N_{ly}^{i}=0; \tag{3}\]  
\[-\left(y_{\rm C}^{i}-y_{ZMP}^{i}\right)\left(F_{Ix}^{i}+G_{x}^{i}\right)+ \left(x_{\rm C}^{i}-x_{ZMP}^{i}\right)F_{ly}^{i}+N_{Iz}^{i}=0. \tag{4}\]  
Only two of the three equations are linearly independent [14], but there are three unknowns. An additional condition must be given to solve this problem. Referring to the assumptions made in traditional _ZMP_, it is stipulated in this paper that _ZMP_ is always located on the current support plane (which can be nonhorizontal). For the convenience of calculation, the support coordinate system (\(s\)) (Figure 2) is defined. The origin of this coordinate system is located at the midpoint \(S\) of the current support line \(\overline{AB}\), the direction of \(z_{s}\) is from the rear foot to the front foot of the current support line, and \(x_{s}\) is perpendicular to the current support plane and points downward. Another coordinate system used in this paper is the principal axes coordinate system of the body (\(c\)), whose origin is located at the body's CoM. Figure 1: Force-schematic diagram of the robot body. Figure 2: Settings of the coordinate systems. The position of _ZMP_ in the support coordinate system \(P_{ZMP}^{s}=\left[ \begin{array}{cc}0&y_{ZMP}^{s}&z_{ZMP}^{s}\end{array} \right]^{T}\) is calculated by considering the force and moment balance in this system:  
\[x_{ZMP}^{s}=0; \tag{5}\]  
\[y_{ZMP}^{s}=y_{\mathbb{C}}^{s}-\frac{x_{\mathbb{C}}^{s}\left(F_{ly}^{s}+G_{y}^ {s}\right)+N_{Iz}^{s}}{F_{lx}^{s}+G_{x}^{s}}; \tag{6}\]  
\[z_{ZMP}^{s}=z_{\mathbb{C}}^{s}-\frac{x_{\mathbb{C}}^{s}\left(F_{1z}^{s}+G_{z}^ {s}\right)-N_{ly}^{s}}{F_{lx}^{s}+G_{x}^{s}}. \tag{7}\]  
It is difficult to ascertain the actual support plane for some dynamic gaits (trotting, pacing, bounding, etc.) because only two support feet are used most of the time.