## 3 Trajectory Planning for Quadruped Robot
### Foot Trajectory Planning of Quadruped Robot  
Each leg of the hydraulic quadruped robot has three degrees of freedom, according to the above kinematic analysis, the joint trajectories can be calculated from the foot trajectories. The position of the robot foot is affected by the attitude of the trunk and the angle of the joint. The foot trajectory should not only meet the requirement of minimizing the contact force between the ground and the foot, but also ensure that the contact velocity of the foot is zero. Up to now, a variety of foot trajectory planning methods have been proposed, such as compound cycloid trajectory [34], modified compound cycloid trajectory [35; 36], quintic polynomial curve trajectory [37], sine function trajectory [38], a combination trajectory of cubic polynomial and straight line trajectories [17] and elliptical trajectory [39]. However, the disturbance of the robot trunk is not considered in the above methods.  
After comparing the various foot trajectory planning methods mentioned above, for this paper, the cycloid trajectory planning method proposed in reference [40] was decided on. The trajectory equations can be written as:  
\[\left\{\begin{array}{ll}p_{x}=S\Big{(}\frac{t}{t_{\text{m}}}-\frac{1}{2\pi} \sin(2\pi\frac{t}{t_{\text{m}}})\Big{)}-\frac{S}{2}&0\leq t\leq T_{\text{m}} \\ p_{y}=0&0&0\leq t\leq T_{\text{m}}\\ p_{z}=2H\Big{[}\frac{t}{t_{\text{m}}}-\frac{1}{4\pi}\sin(4\pi\frac{t}{t_{\text {m}}})\Big{]}&0\leq t\leq\frac{T_{\text{m}}}{2}\\ p_{z}=2H\Big{[}1-\frac{t}{t_{\text{m}}}+\frac{1}{4\pi}\sin(4\pi\frac{t}{t_{ \text{m}}})\Big{]}&\frac{T_{\text{m}}}{2}\leq t\leq T_{\text{m}}\end{array}\right. \tag{16}\]  
where \(H\) is the maximum height of the foot, \(p_{x}\), \(p_{y}\) and \(p_{z}\) represent the horizontal displacement, lateral displacement and vertical displacement of the robot foot, respectively. \(p_{x}\), \(p_{y}\) and \(p_{z}\) are the positions of the foot in the reference coordinate frame \(\{O_{w}\}\). Hence, the homogeneous coordinate of \(\mathbf{p}_{ie}=\{p_{x}\)\(p_{iy}\)\(p_{iz}\)\(1\}^{\text{T}}\) can be determined by:  
\[\mathbf{p}_{ie}=\mathbf{R}\cdot{}^{b}\mathbf{T}_{i0}\cdot{}^{0}\mathbf{p}_{ie} \tag{17}\]  
in which, \({}^{0}\mathbf{p}_{ie}\) is the homogeneous coordinate of the foot in the transitional coordinate frame \(\{O_{i0}\}\). \(\mathbf{R}\) is the rotation matrix of the torso coordinate frame with respect to the reference coordinate frame, which can be expressed as:  
\[\mathbf{R}=\left[\begin{array}{cccc}cq_{2}cq_{3}&-cq_{1}s_{3}+sq_{1}sq_{2}cq_{3} &sq_{1}sq_{3}+cq_{1}sq_{2}cq_{3}&0\\ cq_{2}sq_{3}&cq_{1}cq_{3}+sq_{1}sq_{2}sq_{3}&-sq_{1}cq_{3}+cq_{1}sq_{2}sq_{3}&0 \\ -sq_{2}&sq_{1}cq_{2}&cq_{1}cq_{2}&0\\ 0&0&0&1\end{array}\right] \tag{18}\]  
Figure 3: Height model of the robot supported by two feet.  
where \(cq_{1}=\cos q_{1}\), \(sq_{1}=\sin q_{1}\), and \(q_{1}\) and \(q_{3}\) are the attitude angles of the robot trunk, which are, roll angle and yaw angle. These attitude angles can be detected in real time by an inertial measurement unit (IMU) attached to the robot trunk.  
Once the trajectory of the foot is determined, the position of the foot in the transitional coordinate frame can be written in the form:  
\[{}^{0}\mathbf{p}_{ie}={}^{b}\mathbf{T}_{i0}{}^{-1}\cdot\mathbf{R}^{-1}\cdot\mathbf{p}_{ie} \tag{19}\]  
The joint angles of the hydraulic quadruped robot could be solved by substituting Equation (19) back into Equation (6). The driving functions of hydraulic cylinder can be calculated by the geometric relationship of the legs of the hydraulic quadruped robot. Thus, the servo drive control of the hydraulic quadruped robot is carried out. The control device switches to the touch stage once one leg touches the ground.