Changes between Version 41 and Version 42 of Tutorials


Ignore:
Timestamp:
Apr 3, 2016, 12:56:50 PM (10 years ago)
Author:
fma
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorials

    v41 v42  
    455455As you can see, this time, we used the {{{Servo}}} and {{{ServoPool}}} classes, which inherit, respectively, {{{Actuator}}} and {{{ActuatorPool}}} classes.
    456456
    457 
    458 
     457In the same time, we are going to add a few more pre-defined gaits, in {{{main()}}}:
     458
     459{{{
     460#!python
     461
     462def main():
     463    def addGait(gaitClass, gaitName):
     464        gait = gaitClass(gaitName, settings.GAIT_LEGS_GROUPS[gaitName], settings.GAIT_PARAMS[gaitName])
     465        GaitManager().add(gait)
     466
     467    addGait(GaitTripod, "tripod")
     468    addGait(GaitTetrapod, "tetrapod")
     469    addGait(GaitRiple, "riple")
     470    addGait(GaitWave, "metachronal")
     471    addGait(GaitWave, "wave")
     472    GaitManager().select("riple")
     473}}}
     474
     475As we now have more than one gait, we explicitely tell which one we are going to use as default. Note that it is possible to change the current gait using some buttons of the remote control. See [UserGuideGit#Controllers|documentation].
     476
     477The rest is similar to tutorial 2.
     478
     479=== Settings ===
    459480In addition, we must modify/add a few things in the '''{{{settings.py}}}''' module:
    460481
     
    497518    21: {'offset':   0., 'pulse90': 1500, 'ratio': 1000/90.},  # tibia leg LF
    498519}
    499 }}}
    500 
    501 '''TBC'''
    502 
     520
     521# Gaits
     522GAIT_LEGS_GROUPS = {
     523    'tripod':      (('RM', 'LF', 'LR'), ('RF', 'LM', 'RR')),
     524    'tetrapod':    (('RR', 'LM'), ('RF', 'LR'), ('RM', 'LF')),
     525    'riple':       (('RR',), ('LM',), ('RF',), ('LR',), ('RM',), ('LF',)),
     526    'metachronal': (('RR',), ('LM',), ('RF',), ('LR',), ('RM',), ('LF',)),
     527    'wave':        (('RR',), ('RM',), ('RF',), ('LR',), ('LM',), ('LF',))
     528}
     529
     530GAIT_PARAMS = {
     531    'tripod': {'length': 40., 'angle': 10., 'height': 40., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 200.},
     532    'tetrapod': {'length': 40., 'angle': 10., 'height': 30., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 200.},
     533    'riple': {'length': 40., 'angle': 10., 'height': 30., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 300.},
     534    'metachronal': {'length': 40., 'angle': 10., 'height': 30., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 200.},
     535    'wave': {'length': 40., 'angle': 10., 'height': 30., 'minLength': 4., 'minAngle': 2., 'speedMin':  50., 'speedMax': 200.}
     536}
     537}}}
    503538=== Settings ===
    504539