## 2 Analysis of the Gait Pattern
### Robot Dynamics Description  
After simplifying the bipedal robot to a bipedal robot model, it is necessary to apply joint torques to the robot throughout its entire motion space to control the joints to move along the specified trajectory, in order to facilitate the control of the robot's walking gait. In this section, the dynamic analysis of the bipedal robot is performed utilizing the Lagrange equations, aiming to explore optimal energy efficiency. The variations in the system's kinetic and potential energy are elucidated via the application of the principle of energy conservation. Dynamic analysis serves as a fundamental framework for energy optimization, and the utilization of mathematical modeling to analyze energy conversion has demonstrated successful applications in other fields [34; 35]. The Lagrangian function is defined as Equation (2):  
\[L\big{(}q,\ddot{q}\big{)}=E-K \tag{2}\]  
where \(L\) represents the Lagrange equation, and q represents the generalized coordinates in a dynamic system. \(E\) and \(K\) are the system's kinetic and potential energies, respectively, both of which are functions of \(q\); the system's dynamics can be shown as Equation (3):  
\[\frac{d}{dt}\bigg{(}\frac{\partial L}{\partial\dot{q}}\bigg{)}-\frac{\partial L }{\partial q}=J^{T}u \tag{3}\]  
Kinetic Analysis  
1. Swing phase:  
The relationship between the links is derived, and the total vector \(X_{\text{w}}\) of the robot walking model can be shown as Equation (4):  
\[X_{\text{w}}= \begin{bmatrix}x_{st}\\ y_{st}\\ x_{hip}\\ y_{hip}\\ x_{b}\\ y_{b}\\ x_{sw}\\ y_{sw}\end{bmatrix} = \begin{bmatrix}x_{0}-l_{sh}sin(q_{1})\\ y_{0}+l_{sh}cos(q_{1})\\ x_{0}-lsin(q_{1})\\ y_{0}+lcos(q_{1})\\ x_{0}-lsin(q_{1})-l_{b}sin(q_{1}+\frac{q_{2}}{2})\\ y_{0}+lcos(q_{1})+l_{b}cos(q_{1}+\frac{q_{2}}{2})\\ x_{0}-lsin(q_{1})+l_{th}sin(q_{1}+q_{2})\\ y_{0}+lcos(q_{1})-l_{th}cos(q_{1}+q_{2})\end{bmatrix}  \tag{4}\]  
The energy (kinetic energy \(E\) and potential energy \(K\)) of the bipedal robot can be shown as Equations (5)-(10):  
\[E=\frac{1}{2}\Big{[}m_{b}\Big{(}\dot{x_{b}}^{2}+\dot{y_{b}}^{2}\Big{)}+m_{h} \Big{(}\dot{x}_{hip}^{2}+\dot{y}_{hip}^{2}\Big{)}+m_{l}\Big{(}\dot{x}_{st}^{ 2}+\dot{y}_{st}^{2}\Big{)}+m_{l}\Big{(}\dot{x}_{sw}^{2}+\dot{y}_{sw}^{2} \Big{)}\Big{]} \tag{5}\]  
\[K=K_{b}+K_{h}+K_{st}+K_{sw} \tag{6}\]  
\[K_{b}=m_{b}g(y_{0}+l\cos(q_{1})-l_{th}\cos(q_{1}+q_{2})) \tag{7}\]  
\[K_{h}=m_{h}g(y_{0}+l\cos(q_{1})) \tag{8}\]  
\[K_{st}=m_{l}g(y_{0}+l_{sh}sin(q_{1})) \tag{9}\]\[K_{sw}=m_{l}g(y_{0}+lcos(q_{1})-l_{th}cos(q_{1}+q_{2})) \tag{10}\]  
Combining with Equation (4), the equation for the swing phase can be shown as Equation (11):  
\[M(q)\ddot{q}+C(q,\dot{q})\dot{q}+G(q)=J_{r}^{T}u+T \tag{11}\]  
where \(M(q)\) is the \(4\times 4\) matrix of \(\ddot{q}\), \(C(q,\dot{q})\dot{q}\) and \(G(q)\) are both \(4\times 1\) matrices, \(J_{r}^{T}u\) is the constraint force of the stance foot, including the support force \(u_{\rm N}\) and friction force \(u_{\rm N}\), and \(T\) is the joint torque, shown as Equations (12)-(16):  
\[\mathfrak{u}=\left[u_{f},u_{N}\right]^{T} \tag{12}\]  
\[M(q)=\left[ \begin{array}{cccc}M_{11}&M_{12}&M_{13}&M_{14}\\ M_{21}&M_{22}&M_{23}&M_{24}\\ M_{31}&M_{32}&M_{33}&M_{34}\\ M_{41}&M_{41}&M_{43}&M_{44}\end{array} \right] \tag{13}\]  
\[C(q,\dot{q})\dot{q}=\left[ \begin{array}{c}C_{1}\\ C_{2}\\ C_{3}\\ C_{4}\end{array} \right] \tag{14}\]  
\[G(q)=\left[ \begin{array}{c}G_{1}\\ G_{2}\\ G_{3}\\ G_{4}\end{array}