User Manual

Table Of Contents
79
13 Gait Generation Method of A Hexapod Robot
For the hexapod robot, the gait generation method is almost the most complicated part of the program,
because it needs to coordinate dozens of servos to move at the same time, and keeps every moment when
walking forward and backward there must be at least three legs on the ground, which means that only three
legs can be in the swing pair at least at any moment, and at least three legs should be in the support pair.
In order to make it more intuitive, we represent the position of each leg of the robot as 1, 2, 3, 4
respectively and divide the robot legs into two groups.
T
aking forward heading of the robot as forward direction,
we name `I` including the left front leg, the left back leg, and the right middle leg; `II` including the right front leg,
the right back leg, and the left middle leg.
Code/Global Gait
1
2
3
4
I
1
2
3
4
II
3
4
1
2
For example, when the first group of legs in the global gait is in the `1` position, the second group of legs
is in the `3` position.
When the global gait changes to a cycle of 1, 2, 3, 4, 1, 2, ..., the robot moves forward in a diagonal gait.
When the global gait changes to a cycle of 4, 3, 2, 1, 4, 3, ..., the robot walks backward in a diagonal
gait.
When the three legs on the right side of the robot walk forward and the two legs on the left side walk
backward, the robot turns to the left.
●When the left three legs of the robot walk forward and the left two legs walk backward, the robot turns to
the right.
●The codes related to the robot gait are as shown below:
#Fast gait
def move(step_input, speed, command):
step_I = step_input
step_II = step_input + 2
if step_II > 4:
step_II = step_II - 4
if speed == 0: