Changes between Version 8 and Version 9 of Tutorial5AdvancedRemoteControlUsage


Ignore:
Timestamp:
Nov 22, 2017, 3:48:09 PM (8 years ago)
Author:
fma
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Tutorial5AdvancedRemoteControlUsage

    v8 v9  
    1 = Tutorial 5: Advanced remote control usage =
     1 = Tutorial 5: Advanced remote control usage =
    22
    33As we've seen in [wiki:Tutorial1FirstRobot tutorial 1], we created a {{{Gamepad}}} class in order to control our robot. This class inherits from {{{RemoteControl}}}, and implements a few virtual methods. As an example, we will use my setup for my big 4 DoF hexapod, '''Cronos''':
     
    5050}}}
    5151
    52 The first method, {{{_createFrontend()}}} must return a valid frontend (we just saw in [wiki:Tutorial4AddInputFrontendSupport previous tutorial] how to create such frontends). This methods takes as first argument the frontend path in '''{{{/dev}}}'''. An additional argument can be given to override the {{{DEFAULT_AXIS_CALIBRATION}}} table.
     52The first method, {{{_createFrontend()}}} must return a valid frontend (we just saw in [wiki:Tutorial4AddInputFrontend previous tutorial] how to create such frontends). This methods takes as first argument the frontend path in '''{{{/dev}}}'''. An additional argument can be given to override the {{{DEFAULT_AXIS_CALIBRATION}}} table.
    5353
    5454In the second method, {{{_buildComponents()}}}, interesting things take place: this is where {{{Component}}}s ({{{Button}}}, {{{Analog}}}...) of our remote control are created.
     
    5858Then we add the components, using the {{{_addComponent()}}} method helper. This method takes the component class, the command to execute, the frontend key, a optional modifier, and a mapper.
    5959
     60Blah
    6061
     62{{{Mapper}}}s are simple objects helping to adapt params from {{{RemoteControl}}} {{{Component}}}s output to {{{Robot}}}/{{{GaitSequencer}}} methods input.
    6163
     64For example, to control the robot walk, we can create a {{{Joystick}}} component with 3 axes: X, Y, RZ.
    6265
    63 
    64 '''Mappers''' are simple objects helping to adapt params from '''!RemoteControl''' '''Components''' output to '''Robot'''/'''!GaitSequencer''' methods input.
    65 
    66 For example, to control the robot walk, we can create a '''Joystick''' component with 3 axes: X, Y, RZ.
    67 
    68 But the '''!GaitSequencer''' {{{walk()}}} method expects '''speed''', '''direction''', '''length''' and '''angle''' params. Using the '''!MapperWalk''' mapper, you can compute all these params from X/Y/RZ axes, and send them to the '''walk()''' method. That's what we did in the [[Tutorials|tutorials]].
     66But the {{{GaitSequencer}}} {{{walk()}}} method expects '''speed''', '''direction''', '''length''' and '''angle''' params. Using the {{{MapperWalk}}} mapper, you can compute all these params from X/Y/RZ axes, and send them to the {{{walk()}}} method. That's what we did in the [wiki:Tutorial1FirstRobot tutorial 1].
    6967
    7068See [https://framagit.org/fma38/Py4bot/blob/master/py4bot/inputs/mappers/mapper.py py4bot/inputs/mappers/mapper.py] to see how this mapper is defined.
    7169
    72 Of course, you can define your own '''Mappers'''.
     70Of course, wa can define our own {{{Mappers}}}.
    7371
    7472