Changes between Version 80 and Version 81 of UserGuideGit


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

--

Legend:

Unmodified
Added
Removed
Modified
  • UserGuideGit

    v80 v81  
    33= User guide (git) =
    44
    5 ''This documentation tries to follow the developement version of Py4bot. It may or may not be up-to-date.''
     5''This documentation tries to follow the development version of Py4bot. It may or may not be up-to-date.''
    66
    77For installation instructions, see [InstallationGuide here].
     
    161161[[Image(design_gait.png, 300px)]]
    162162
    163 ==  Remote controllers ==
     163==  Remote controls ==
    164164
    165165The {{{RemoteControl}}} translates user orders to {{{Robot}}}/{{{GaitSequencer}}} methods calls.
     
    167167[[Image(design_remote-control.png, 300px)]]
    168168
    169 As you can see on the UML diagram, a {{{RemoteControl}}} object is build with {{{Components}}}; a {{{Component}}} can be a {{{Button}}}, a {{{Switch}}} an {{{Analog}}} axis, or a {{{Joystick}}}, which is several {{{Analog}}} axes bound together.
     169As you can see on the UML diagram, a {{{RemoteControl}}} object uses {{{Components}}}; a {{{Component}}} can be a {{{Button}}}, a {{{Switch}}} an {{{Analog}}}, or a {{{Joystick}}}.
     170
     171{{{RemoteControl}}} has the following virtual methods which must be override in a custom remote control class:
     172
     173* {{{_createFrontend(self)}}}
     174
     175This method must return an input frontend.
     176
     177* {{{_buildComponents(self)}}}
     178
     179Here, we create the components of the remote control
     180
     181The following methods are used to setup the remote control:
     182
     183 * {{{_addConfig(self, config)}}}
     184 * {{{_addComponent(self, cls, **kwargs)}}}
     185
     186(See below)
     187
     188Then, a number of objects/methods can be used as components commands:
     189
     190 * selectPreviousConfig(self)
     191 * selectNextConfig(self)
     192 * {{{robot}}}
     193
     194The {{{robot}}} object is used to reach the robot methods from the components.
    170195
    171196=== Components ===
    172197
    173 '''Py4bot''' implements different components to build a custom remote control mapping:
     198'''Py4bot''' implements different components to build a custom remote control. All components
    174199
    175200==== Button ====
     
    200225=== Configurations and modifiers ===
    201226
    202 There are many commands to control the robot, and not enough physical buttons/axis on a gamepad. So, a solution is to multiplex these buttons/axis. There are 2 ways to do that: ''configurations'' and ''modifiers''. ''configurations'' allow us to change the entire mapping; ''modifiers'' only changes a button meaning.
    203 
    204 To create several ''configurations'', we use the {{{_addConfig()}}} method. This method take a string as argument, the name of the config.
     227There are many commands to control the robot, and not enough physical buttons/axis on a gamepad. So, a solution is to multiplex these buttons/axis. There are 2 ways to do that: ''configurations'' and ''modifiers''. ''Configurations'' allow us to change the entire mapping; ''modifiers'' only changes a button meaning.
     228
     229To create several ''configurations'', use the {{{_addConfig()}}} method. This method take a string as argument, the name of the config.
    205230
    206231=== Mappers ===
     
    208233'''Mappers''' are simple objects helping to adapt params from '''!RemoteControl''' '''Components''' output to '''Robot'''/'''!GaitSequencer''' methods input.
    209234
    210 For example, to control the robot walk, we can create a '''Joystick''' component with 3 axes: X, Y, RZ.
    211 
    212 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]].
    213 
    214 See [[https://framagit.org/fma38/Py4bot/blob/master/py4bot/inputs/mappers/mapper.py|py4bot/inputs/mappers/mapper.py]] to see how this mapper is defined.
    215 
    216 Of course, you can define your own '''Mappers'''.
     235Custom '''Mappers''' can be defined.
    217236
    218237=== Add a new Frontend ===
     
    220239{{{Frontend}}}s are responsible of generating states. This is where specific controllers implementation live.
    221240
    222 There are some usefull {{{Frontend}}}s defined in '''Py4bot''', mainly USB-based, using ''event'' interface. See [[Tutorial4AddInputFrontendSupport|tutorial 4]] to see how to add a new frontend.
     241There are some usefull {{{Frontend}}}s defined in '''Py4bot''', mainly USB-based, using ''event'' interface. See [Tutorial4AddInputFrontendSupport tutorial 4] to see how to add a new frontend.