# Quadrupedal Robots' Gaits Identification via Contact Forces Optimization
## 2 Mathematical Model for the Gait Optimization  
The considered quadrupedal model is sketched in Figure 1, where the body, suspended on four legs, transmits forces and moments thanks to the interaction with the ground. The optimization model proposed in this paper consists of an optimal gait identification, capable of moving the quadrupedal body through the succession of four alternating thrusts generated by legs with some desirable characteristics. This approach is innovative. In fact, the kinematic linkages and actuators of the leg mechanism are not directly involved but left to a second engineering phase of design, not investigated in the present paper. The legs are labelled as \(FL\) (front left), \(FR\) (front right), \(HL\) (hind left), \(HR\) (hind right). The period during which a single leg maintains its contact with the ground is the _contact phase_ (\(CP\)), while the one during which the leg is flying in the air moving towards the next contact point, is the _swing phase_ (\(SP\)). In general, these times can be set differently for each leg. The legs sequencing, sketched in Figure 2, originates a periodic motion of each leg, of period \(T\). The time at which each leg touches the ground is \(t_{i}\in[0,T]\), where \(i=FR\),\(FL\), \(HR\), \(HL\). The time duration of the contact phase is \(T_{i}\), and the time duration of the swing phase is \(T-T_{i}\). Newton-Euler equations of rigid body dynamics are:  
\[ \begin{split}& m\ \ddot{\mathbf{r}}=\mathbf{f_{e}}\\ &\mathbf{I\dot{\omega}}=\mathbf{m_{e}}-\mathbf{\omega}\times(\mathbf{I\omega})\\ &\dot{\mathbf{\theta}}=\mathbf{E}(\mathbf{\theta})\mathbf{\omega}\end{split}  \tag{1}\]  
where the first equation holds in the fixed reference frame, the second in the body reference frame (principal inertia axes), \(\mathbf{r}=[x,y,z]\) identifies the gravity center position of the quadruped body of total mass \(m,\mathbf{f_{e}}\) is the total external force, \(\mathbf{I}=diag\big{[}I_{x},I_{y},I_{z}\big{]}\) the matrix of inertia, \(\mathbf{m_{e}}\) is the total external moment, \(\mathbf{\theta}=[\psi,\theta,\phi]\), the Tait-Bryan angles (yaw pitch and roll), \(\mathbf{\omega}\) is the angular velocity, and \(\mathbf{E}\) is the Jacobian matrix. Assuming small pitch and roll angles and vanishing yaw, the equations can be reduced into the same fixed reference frame:  
\[ \begin{split}& m\ddot{x}=F_{x}\\ & m\ddot{y}=F_{y}\\ & m\ddot{z}=F_{z}\\ & I_{x}\ddot{\phi}=M_{x}\\ & I_{y}\ddot{\theta}=M_{y}\end{split}  \tag{2}\]  
where \(F_{x}\), \(F_{y}\), \(F_{x}\), \(M_{x}\), \(M_{y}\) are the total force and moment transmitted by the four legs \(FR\), \(FL\), \(HR\), and \(HL\), respectively. When the quadruped moves on the ground, the leg-ground contact produces a reaction force. Its vertical component \(F_{z}\) supports the quadrupedal weight, the horizontal component \(F_{x}\) drives the longitudinal motion of the body, and \(F_{y}\) affects the lateral body oscillations. The vertical force \(F_{z_{i}}\) for each leg acts only in the \(CP\); that implies \(F_{z_{i}}(t_{i})=0\) and \(F_{z_{i}}(t_{i}+T_{i})=0\), that is, its time history, during the \(CP\), starts and ends with vanishing values, associated with the incipient contact and incipient detachment of the leg with and from the ground, respectively. The force-time history along the \(CP\) is identified through three additional points \(\big{[}P_{1_{i}};P_{2_{i}};P_{3_{i}}\big{]}\) (besides the two previously identified) and is fitted by a suitable spline (Figure 3a). Figure 1: 3D view of the quadruped. The longitudinal and lateral ground reactions for each leg are assumed to belong to the static friction cone. With this assumption, any contact slip condition is absent, and the contact model is purely conservative. Therefore:  
\[\sqrt{F_{x_{i}}^{2}+F_{y_{i}}^{2}}\leq\mu_{s}F_{z_{i}} \tag{3}\]  
where \(\mu_{s}\) is the static friction coefficient. For the planar forces \(F_{x_{i}}\) and \(F_{y_{i}}\), one can introduce suitable constitutive relationships (Figure 3).