wiki:Tutorial6AddGait

Add gait

Introduction

From my point of view, implementing gaits is certainly the most tricky part of multi-legs robot programming. Let me explain why.

Unlike wheels-based robots, feet can't slip on the ground, and must be lifted, moved, and put again on the ground in a certain order at a certain speed. This is what we call a gait.

For each foot (or group of feet) of the robot, there are two phases: the swing phase (transfer), and the stance phase (support). The gait defines the order of changing between these phases, and computes all successive feet positions so the robot follows the wanted trajectory.

There are many papers describing gaits, mostly found from insects studies. For 6-legs robots, tripod, tetrapod, ripple and wave are the most common ones (there are many site showing them). These gaits are called periodic, as they reproduce the same pattern over and over. Well, not exactly...

Gait sequences

Usually, when we switch on a multi-legs robot, all legs are at neutral position: all feet are grounded, and all coxa are in mid-position. This is similar for us humans when we don't walk: our feet are side by side. But when a robot (or a human) is walking, its feet never reach that neutral position (try to walk this way, you will understand why!). So, there are special sequences to do when starting or stopping.

For a 2-steps gait (like the tripod gait of an hexapod), this is easy to do: the group of swinging legs directly reaches it's target position from neutral, while the groups of stancing legs move back at the same time of the same amount, because they have the same distance to move. For gaits with a higher number of steps, this can't be done anymore! Let's see on a graph (only 1 complete step shown):

Note: the gaits are shown using the same step speed. As we can see, wave gait is much slower than tripod gait, as it needs more steps to complete a full stride. On the other hand, there are always 5 legs on the floor, instead of 3, so the robot could carry much more weight. In real life, insects constantly switch from one gait to another, according to the task they have to do.

Here, swinging phases are shown by dashed rising lines, stancing phases are show by plain falling lines. We clearly see that except for the tripod gait, the feet are never at neutral position all at the same time. So, before reaching the periodic cycle, we need to use a start sequence. And to quit the periodic cycle, we need to use a stop sequence, to return to neutral.

These sequences are never mentioned in the papers talking about gaits: they where described by Edgar, a friend of mine, who helped me to solve this problem. Here is the current implementation of these start/stop sequences in Py4bot:

As you see, we use a swing phase for the legs out of phase in order to put them in the correct positions. Then, periodic cycle can be used.

A better implementation I'm currently working on is this one:

Here, the start/stop sequences are shorter.

There is another sequence we need to talk about, as it is used in the framework: the static sequence. It is used when we need to change the feet neutral positions while at neutral position. As said, feet can't slip, so we need to do a complete walk sequence, without really moving. Here, legs only use the swing phase. Note that it is possible to adjust the feet neutral position while walking; in this case, no need to perform a static sequence; new feet neutral positions are used to compute the new target during the swing phases.

Gait tables

in Py4bot, all steps of a gait are defined in a table. As we've just seen, there are 4 sequences (start, walk, static, stop), so there are 4 tables. For example, let's see how the tripod gait tables look like, in the py4bot/gaits/gaitTripod.py module:

from py4bot.gaits.gait import Gait


class GaitTripod(Gait):
    def _createTables(self):
        startTable = (
        )

        walkTable = (
            (( 0., 1.), ( 0., 0.)),  # step 0
            (( 1., 0.), (-1., 0.)),
            (( 0., 0.), ( 0., 1.)),
            ((-1., 0.), ( 1., 0.)),  # step 3
        )

        staticTable = (
            (( 0., 1.), ( 0., 0.)),  # step 0
            (( 0., 0.), ( 0., 0.)),
            (( 0., 0.), ( 0., 1.)),
            (( 0., 0.), ( 0., 0.)),  # step 3
        )

        stopTable = (
            (( 0., 0.), ( 0., 0.)),  # step 0
        )

        return startTable, walkTable, staticTable, stopTable

A table is no more than a list of feet positions. Or, to be more precise, a list of feet groups positions. In the case of the tripod gait, we have 2 groups of legs, each group containing 3 legs forming a tripod (2 legs of one side and 1 leg of the other side).

Notes: there is no specific start table, as we are able to reach the first walk step from the neutral position (see first line of images above).

So, the first line of the table contains the feet positions for the first (half) step: first tuple for the first group, second tuple for the second group. First value of each tuple is the movement in the XY plane, from -1 to +1 (-1 means full stride backward, 0 means neutral position, +1 means full stride forward). Second value is the movement in the Z plane, from 0 to 1 (0 means on the ground, 1 means lifted full height).

In the walk table, we have:

  • step 0: first group of legs lifts up at neutral position; second group of legs stays on floor, at neutral position
  • step 1: first group of legs moves forward and go back on floor; second group of legs moves backward on the floor
  • step 2: first group of legs moves backward on floor to neutral position; second group of legs lifts up toward the neutral position
  • step 3: first group of legs moves backward on the floor; second group of legs moves forward and go back on floor

This sequence is repeated over and over. As you see, the swing phase is just a triangle (it could be more complex, with additional interpolated steps):

  • first group is in swing phase in steps transitions 0 -> 1 and 3 -> 0, and is is stance phase in steps transitions 1 -> 2 and 2 -> 3.
  • second group is in swing phase in steps transitions 1 -> 2 and 2 -> 3, and is is stance phase in steps transitions 0 -> 1 and 3 -> 0.

As we see, the static table is the same table as the walk table, but the feet don't move in the XY plane.

Last modified 8 years ago Last modified on Dec 16, 2017, 4:00:53 PM

Attachments (3)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.