# Head-Raising of Snake Robots Based on a Predefined Spiral Curve Method
## 3 Simulation on Head-Raising Motion
The phase-shifting process is used to obtain the joint trajectory and does not exist in reality if the snake robot has no active wheels with which to move its body along the predefined spiral curve. Meanwhile, the head-raising process is the actual head-raising motion produced using the joint trajectory, and in this case, the tail of the snake robot is fixed. Figure 11 shows the two kinds of simulations of head-raising process. Those simulations are in kinematic level and do not take dynamic factors into consideration. The Simulation in labels 1-5 are implemented in Adams, and the roll, pitch and roll angles are integrated into spline curves to guide the model's movement. The simulation in labels 6-9 are carried out using Matlab, based on the following algorithm:  
1. Determine the basic posture as Equation (6), and set motion step \(i=1\);
2. Proceed to motion step \(i=2\). The link \(n\) is fixed. Calculate the position of link \(n-1\) on the basis of angles \({}^{2}\alpha_{n}\), \({}^{2}\beta_{n}\), and \({}^{2}\gamma_{n}\);
3. Make an iteration to calculate all of the positions of the links, that is, link \(j=n-2,n-3,\ldots,1\), on the basis of angles \(({}^{2}\alpha_{n-2}\), \({}^{2}\beta_{n-2}\), \({}^{2}\gamma_{n-2})\), \(({}^{2}\alpha_{n-3}\), \({}^{2}\beta_{n-3}\), \({}^{2}\gamma_{n-3}),\ldots,({}^{2}\alpha_{1}\), \({}^{2}\beta_{1}\), \({}^{2}\gamma_{1})\);
4. Proceed to motion step \(i=i+1\) and repeat steps 2 and 3 until \(i=n_{step}\). In this algorithm, step 2 is important. During the phase-shifting and head-raising processes, their link vectors \({}^{i}l_{j}\), as shown in Figure 5, are same in orientation and different in position. Therefore, the position of joint point \({}^{i}P_{j}\) can be obtained as follows:  
\[ \begin{array}{l}{}^{i}l_{j-1}={}^{i}l_{j}R_{z}({}^{i}\alpha_{j})R_{y}({}^{i} \alpha_{j})R_{x}({}^{i}\alpha_{j})\\ {}^{i}P_{j}={}^{i}P_{j-1}+{}^{i}l_{j-1}\\ \end{array}  \tag{13}\]  
Considering that the method of head-raising should be adaptive to deal with different situations, more simulations are implemented as described in Figure 12, where different parameters of the predefined spiral curves are adopted and they are listed in Table 2. In Figure 12, only final postures are shown, and more detailed simulations can be found in Supplementary Materials. Compared with the result in Figures 11 and 12a, the radius of the supporting part BS becomes larger when increasing the value of parameter \(a\) (Figure 12b-d); the height of every circle becomes larger if the parameter \(c\) increases (Figure 12b-d). When changing the parameter \(b\), the amplitudes of \(x_{s}(t)\) and \(y_{s}(t)\) change unequally. Additionally, the LP part changes accordingly (Figure 12c,d) when changing the parameters \(l_{link}\) and \(n\), and it should be noted that \(\varphi_{0}\) is set to ensure the initial phases of the sine and cosine functions. All the simulations confirm the feasibility and validity of the proposed method. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Step \(i\)** & **Head \({}^{i}\)P\({}_{1}\) (mm)** & \begin{tabular}{c} **Index of** \\ **Head \({}^{i}\)\(Inv_{p_{1}}\)** \\ \end{tabular} & \begin{tabular}{c} **Yaw Angle** \\ **\({}^{i}\)\(a_{1}\) (rad)** \\ \end{tabular} & \
\begin{tabular}{c} **Pitch Angle** \\ \({}^{i}\)\(B_{1}\) (rad)** \\ \end{tabular} &
\begin{tabular}{c} **Roll Angle** \\ \({}^{i}\)\(\gamma_{1}\) (rad) \\ \end{tabular} \\ \hline
1 & (151.8, \(-\)12.8, 0) & 15,520 & 0 & 0 & 0 \\
2 & (151.3, \(-\)15.7, 0) & 15,541 & \(-\)0.0047 & 0 & 0 \\ \(\vdots\) & \(\vdots\) & \(\vdots\) & \(\vdots\) & \(\vdots\) & \(\vdots\) \\
300 & (57.3, \(-\)61.8, 188.1) & 22,544 & \(-\)0.8964 & 0.2259 & \(-\)0.3775 \\ \(\vdots\) & \(\vdots\) & \(\vdots\) & \(\vdots\) & \(\vdots\) & \(\vdots\) \\
499 & (\(-\)0.546, 0.015, 606.7) & 31,174 & \(-\)2.5001 & 2.1308 & \(-\)0.8348 \\
500 & (\(-\)0.0036, \(-\)0.003, 609.4) & 31,230 & \(-\)2.5309 & 2.1658 & \(-\)0.8225 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Data during phase-shifting process. Figure 11: Head-raising motion process.