| 171 | | === Using Mappers === |
| | 171 | === Components === |
| | 172 | |
| | 173 | '''Py4bot''' implements different components to build a custom remote control mapping: |
| | 174 | |
| | 175 | ==== {{{Button}}} ==== |
| | 176 | |
| | 177 | This is a simple push button, whith several ''triggers'', in order to control its behavior: |
| | 178 | |
| | 179 | * click |
| | 180 | * double-click |
| | 181 | * press |
| | 182 | * release |
| | 183 | * hold |
| | 184 | * double-hold |
| | 185 | |
| | 186 | Default trigger is ''click'' (you must press and release the button quickly). |
| | 187 | |
| | 188 | ==== {{{Switch}}} ==== |
| | 189 | |
| | 190 | This is a button toggling between 2 states when you press it. |
| | 191 | |
| | 192 | ==== {{{Analog}}} ==== |
| | 193 | |
| | 194 | This component handles a single analog axis. |
| | 195 | |
| | 196 | ==== {{{Joystick}}} ==== |
| | 197 | |
| | 198 | Combines several {{{Analog}}} axes. |
| | 199 | |
| | 200 | === Configurations and modifiers === |
| | 201 | |
| | 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. In our example, we created 2 ''configurations'', one to dynamically control the robot (make it walk), the other one to statically control the robot (move the body). |
| | 205 | |
| | 206 | === Mappers === |