Changes between Version 6 and Version 7 of Tutorial6AddGait


Ignore:
Timestamp:
Dec 14, 2017, 3:21:55 PM (8 years ago)
Author:
fma
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorial6AddGait

    v6 v7  
    11= Add gait =
     2
     3== Introduction ==
    24
    35From my point of view, implementing gaits is certainly the most tricky part of multi-legs robot programming. Let me explain why.
     
    810
    911There 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...
     12
     13== Gait sequences ==
    1014
    1115Usually, 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.
     
    3236
    3337There is another sequence we need to talk about, as it is used in the framework: the '''hop''' 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 hop sequence; new feet neutral positions are used to compute the new target during the swing phases.
     38
     39== Gait tables ==
     40
     41in '''Py4bot''', all steps of a gait are defined in a table. As we've just seen, there are 4 sequences (start, walk, hop, stop), so there are 4 tables. For example, let's see how the tripod gait tables look like, in the [https://framagit.org/fma38/Py4bot/tree/master/py4bot/gaits/gaitTripod.py py4bot/gaits/gaitTripod.py] module:
     42
     43{{{
     44#!python
     45from py4bot.gaits.gait import Gait
     46
     47
     48class GaitTripod(Gait):
     49    def _createTables(self):
     50        startTable = (
     51        )
     52
     53        walkTable = (
     54            (( 0., 1.), ( 0., 0.)),  # step 0
     55            (( 1., 0.), (-1., 0.)),
     56            (( 0., 0.), ( 0., 1.)),
     57            ((-1., 0.), ( 1., 0.)),  # step 3
     58        )
     59
     60        hopTable = (
     61            (( 0., 1.), ( 0., 0.)),  # step 0
     62            (( 0., 0.), ( 0., 0.)),
     63            (( 0., 0.), ( 0., 1.)),
     64            (( 0., 0.), ( 0., 0.)),  # step 3
     65        )
     66
     67        stopTable = (
     68            (( 0., 0.), ( 0., 0.)),  # step 0
     69        )
     70
     71        return startTable, walkTable, hopTable, stopTable
     72}}}
     73
     74A 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). Before we look closer of the tables, note that 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).
     75
     76So, the first line of the table contains the feet positions for the first step, first tuple for the first group, second tuple for the second group. First value of tuples is the movement in the XY plane, from -1 to +1. +-1 means full stride (forward or backward), 0 means neutral position. Second value is the movement in the Z plane, from 0 to 1. 0 mean on the ground, 1 mean lifted full height.
     77
     78In the walk table, we have:
     79
     80 - step 0: first group of legs lifts up at neutral position; second group of legs stays on floor, at neutral position
     81 - step 1: first group of legs moves forward and go back on floor; second group of legs moves backward on the floor
     82 - step 2: first group of legs moves backward on floor to neutral position; second group of legs lifts up toward the neutral position
     83 - step 3: first group of legs moves backward on the floor; second group of legs moves forward and go back on floor
     84
     85This 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).
     86
     87The 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.
     88The 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.