# Straight Gait Research of a Small Electric Hexapod Robot
## 4 Straight Gait Planning
### Description Based on Discretization and Time Sequence Diagram  
In this paper, a method based on the discretization and time sequence diagram is proposed, which can easily describe the straight gait of the hexapod robot. Gait discretization is an effective way to implement biological gait precisely [33]. Suppose \(S\) is the distance that the leg will support the body to move forward when it is in the support phase in each cycle. Discrete points can be used to describe support positions [34]. Now \(S\) is divided into 10 equal parts in Figure 6, and 11 integers of \(-5\) to \(5\) are used to correspond to the beginning and end positions of each small distance, which represents the foot positions that can be selected at the beginning and end of each step. Figure 5: Time sequence diagram of the robot walking forward in tripod gait: (**a**) The general tripod gait; (**b**) The tripod gait with “increasing duty factor”; (**c**) The quadrangular gait with “increasing duty factor”; (**d**) The pentagonal gait with “increasing duty factor”. If the discrete point corresponding to the foot position of the leg \(i\) is \(p_{i}\) (\(p_{i}\) is an integer between \(-5\) and \(5\)), the foot position of the leg \(i\) under \(\{\)O\({}_{\text{IB}}\}\) can be easily drawn:  
\[\left[ \begin{array}{c}P_{ix}\\ P_{iy}\\ P_{iz}\end{array} \right]=\left[ \begin{array}{c}p_{i}/10\times S\\ 0\\ -H\end{array} \right] \tag{8}\]  
where \(H\) represents the current height of the body relative to the ground. Suppose that \(p_{i}\) changes from \(p_{i\_1}\) to \(p_{i\_2}\) over a period of time. When the robot is moving forward, if \(p_{i\_1}>p_{i\_2}\), it can be known that leg \(i\) swings, and if \(p_{i\_1}<p_{i\_2}\), leg \(i\) has supported the body to move forward. The distance the foot moves can be expressed as \(|p_{i\_1}-p_{i\_2}|/10\times S\). Based on the discrete point, this paper defines the set \(P=\){\(p_{1}\), \(p_{2}\), \(p_{3}\), \(p_{4}\), \(p_{5}\), \(p_{6}\)} to represent the foot position state of the robot's six legs. For the initial state, the robot is crouching, and \(P_{C}=\){0, 0, 0, 0, 0, 0} can be used to describe the foot positions of the robot at this time. Next, combining with the time sequence diagram, determine the foot positions of the robot at the beginning and end of each step, and intuitively describe the change process of the foot positions under all kinds of straight gaits. Referring to Figure 5b, for tripod gait, a cycle contains two foot position states: \(P_{T\_1}=\){\(-\)5, 5, 5, \(-\)5, \(-\)5} and \(P_{T\_2}=\){5, \(-\)5, \(-\)5, 5, \(-\)5}. In a cycle (such as 0\(T\)\(\sim\)2\(T\)), when the robot walks forward using the tripod gait, the change in foot positions can be expressed as \(P_{T\_1}\)\(\rightarrow\)\(P_{T\_2}\)\(\rightarrow\)\(P_{T\_1}\), as shown in Figure 7. \(P_{T\_2}\) represents the foot position state of the robot at \(T\), while \(P_{T\_2}\) can represent the foot position state at 0\(T\) and 2\(T\). Each cycle of the tripod gait includes two steps. Firstly, leg 2, leg 3, and leg 6 are used as supporting legs to support the body to move forward for the distance \(S\). At the same time, leg 1, leg 4, and leg 5 swing forward from behind and move forward relative to the body. In the second step, the swing and support state of the two groups of legs are interchanged, and the robot advances the distance \(S\) again. All of the information can be obtained from the expression \"\(P_{T\_1}\)\(\rightarrow\)\(P_{T\_2}\)\(\rightarrow\)\(P_{T\_1}\)\". Referring to Figure 5c, for the quadrangular gait, a cycle contains three foot position states: \(P_{Q\_1}=\){\(-\)5, 5, 0, \(-\)5, 5, 0}, \(P_{Q\_2}=\){5, 0, \(-\)5, 5, 0, \(-\)5}, and \(P_{Q\_3}=\){0, \(-\)5, 5, 0, \(-\)5, 5}. In a cycle (such as 0\(T\)\(\sim\)3\(T\)), when the robot walks forward using the quadrangular gait, the change in foot positions can be conveniently expressed as \(P_{Q\_1}\)\(\rightarrow\)\(P_{Q\_2}\)\(\rightarrow\)\(P_{Q\_3}\)\(\rightarrow\)\(P_{Q\_1}\). In each step, the body moves \(S/2\).