Changes between Version 9 and Version 10 of Tutorials


Ignore:
Timestamp:
Mar 8, 2016, 1:41:15 PM (10 years ago)
Author:
fma
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials

    v9 v10  
    248248Let's discuss about settings used in the previous part.
    249249
    250 
    251 
    252 
    253250''TODO: add graphics with all angles''
    254251
     252{{{
     253#!python
     254
     255LEGS_INDEX = ('RF', 'RM', 'RR', 'LR', 'LM', 'LF')
     256}}}
     257
     258{{{LEGS_INDEX}}} contains the names used to define legs; they can be freely chosen, but these values must be used as keys for other params.
     259
     260{{{
     261#!python
     262
     263LEGS_GEOMETRY = {
     264    'RM': {'coxa': 25, 'femur': 45, 'tibia': 50},
     265    'RF': {'coxa': 25, 'femur': 45, 'tibia': 50},
     266    'LF': {'coxa': 25, 'femur': 45, 'tibia': 50},
     267    'LM': {'coxa': 25, 'femur': 45, 'tibia': 50},
     268    'LR': {'coxa': 25, 'femur': 45, 'tibia': 50},
     269    'RR': {'coxa': 25, 'femur': 45, 'tibia': 50}
     270}
     271}}}
     272
     273{{{LEGS_GEOMETRY}}} dict contains the lengths of the differents parts of the legs, in mm.
     274
     275{{{
     276#!python
     277
     278LEGS_ORIGIN = {
     279    'RM': {'x':  50., 'y':   0., 'gamma0' :   0.},
     280    'RF': {'x':  35., 'y':  80., 'gamma0' :  30.},
     281    'LF': {'x': -35., 'y':  80., 'gamma0' : 150.},
     282    'LM': {'x': -50., 'y':   0., 'gamma0' : 180.},
     283    'LR': {'x': -35., 'y': -80., 'gamma0' : 210.},
     284    'RR': {'x':  35., 'y': -80., 'gamma0' : 330.},
     285}
     286config.initOrigin(LEGS_INDEX, LEGS_ORIGIN)
     287}}}
     288
     289{{{LEGS_ORIGIN}}} dict contains the positions and orientation of the origin of the legs: {{{(x, y)}}} defines the center of rotation of '''coxa''' joint, and {{{gamma0}}} is the angle of the legs at neutral position.
     290
     291Note that we need to call the {{{initOrigin()}}} function of the '''{{{config.py}}}''' module, in order to initialize internal configuration (some matrix are defined, in order to avoid further maths).
     292
     293{{{
     294#!python
     295
     296LEGS_NEUTRAL = {
     297    'RM': {
     298        'l': LEGS_GEOMETRY['RM']['coxa'] + LEGS_GEOMETRY['RM']['femur'],
     299        'z': LEGS_GEOMETRY['RM']['tibia']
     300    },
     301    'RF': {
     302        'l': LEGS_GEOMETRY['RF']['coxa'] + LEGS_GEOMETRY['RF']['femur'],
     303        'z': LEGS_GEOMETRY['RF']['tibia']
     304    },
     305    'LF': {
     306        'l': LEGS_GEOMETRY['LF']['coxa'] + LEGS_GEOMETRY['LF']['femur'],
     307        'z': LEGS_GEOMETRY['LF']['tibia']
     308    },
     309    'LM': {
     310        'l': LEGS_GEOMETRY['LM']['coxa'] + LEGS_GEOMETRY['LM']['femur'],
     311        'z': LEGS_GEOMETRY['LM']['tibia']
     312    },
     313    'LR': {
     314        'l': LEGS_GEOMETRY['LR']['coxa'] + LEGS_GEOMETRY['LR']['femur'],
     315        'z': LEGS_GEOMETRY['LR']['tibia']
     316    },
     317    'RR': {
     318        'l': LEGS_GEOMETRY['RR']['coxa'] + LEGS_GEOMETRY['RR']['femur'],
     319        'z': LEGS_GEOMETRY['RR']['tibia']
     320    }
     321}
     322config.initNeutral(LEGS_INDEX, LEGS_NEUTRAL)
     323}}}
     324
     325{{{LEGS_NEUTRAL}}} dict contains the
     326
     327Here too, we need to call the {{{initNeutral()}}} function of the '''{{{config.py}}}''' module, in order to initialize internal configuration.
     328
     329{{{
     330#!python
     331
     332LEGS_SERVOS_MAPPING = {
     333    'RF': {'coxa':  0, 'femur':  1, 'tibia':  2},
     334    'RM': {'coxa':  4, 'femur':  5, 'tibia':  6},
     335    'RR': {'coxa':  8, 'femur':  9, 'tibia': 10},
     336    'LR': {'coxa': 15, 'femur': 14, 'tibia': 13},
     337    'LM': {'coxa': 19, 'femur': 18, 'tibia': 17},
     338    'LF': {'coxa': 23, 'femur': 22, 'tibia': 21}
     339}
     340}}}
     341
     342{{{LEGS_SERVOS_MAPPING}}} dict contains a table to map all joints to servos nums.
     343
     344{{{
     345#!python
     346
     347GAITS = ("tripod", "tetrapod", "riple", "metachronal", "wave")
     348}}}
     349
     350As {{{LEGS_INDEX}}} contains the names used to define legs, {{{GAITS}}} contains names to defined known gaits. Yhey can also be freely chosen, but these values must be used as keys for other params.
     351
     352{{{
     353#!python
     354
     355
     356GAIT_LEGS_GROUPS = {
     357    'tripod':      (('RM', 'LF', 'LR'), ('RF', 'LM', 'RR')),
     358    'tetrapod':    (('RR', 'LM'), ('RF', 'LR'), ('RM', 'LF')),
     359    'riple':       (('RR',), ('LM',), ('RF',), ('LR',), ('RM',), ('LF',)),
     360    'metachronal': (('RR',), ('LM',), ('RF',), ('LR',), ('RM',), ('LF',)),
     361    'wave':        (('RR',), ('RM',), ('RF',), ('LR',), ('LM',), ('LF',))
     362}
     363}}}
     364
     365{{{GAIT_LEGS_GROUPS}}} dict contains the legs grouped together and controlled at the same time during the gait usage.
     366
     367For example, the '''tripod''' gait is made of 2 groups of 3 legs.
     368
     369Note that we need to define sequences, so don't forget the comma to define a tuple with a unique element.
     370
     371{{{
     372#!python
     373
     374
     375GAIT_PARAMS = {
     376    'tripod': {'length': 40., 'angle': 10., 'height': 40., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 200.},
     377    'tetrapod': {'length': 40., 'angle': 10., 'height': 30., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 200.},
     378    'riple': {'length': 40., 'angle': 10., 'height': 30., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 300.},
     379    'metachronal': {'length': 40., 'angle': 10., 'height': 30., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 200.},
     380    'wave': {'length': 40., 'angle': 10., 'height': 30., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 200.}
     381}
     382}}}
     383
     384{{{GAIT_PARAMS}}} dict contain some additional gaits params:
     385
     386* {{{length}}} is the distance each leg will move for an entire cycle when the robot translate;
     387* {{{angle}}} is the angle each leg will turn for an entire cycle when the robot rotate;
     388* {{{minLength}}} is the minimum translating length, even when speed is very low;
     389* {{{minAngle}}} same as above for angle;
     390* {{{speedMin}}}, {{{speedMax}}} are the range for speed.
    255391=== More complexe example ===
    256392