| 34 | | == Components == |
| 35 | | |
| 36 | | '''Py4bot''' implements different components to build a custom remote control mapping: |
| 37 | | |
| 38 | | === {{{Button}}} === |
| 39 | | |
| 40 | | This is a simple push button, whith several ''triggers'', in order to control its behavior: |
| 41 | | |
| 42 | | * click |
| 43 | | * double-click |
| 44 | | * press |
| 45 | | * release |
| 46 | | * hold |
| 47 | | * double-hold |
| 48 | | |
| 49 | | Default trigger is ''click'' (you must press and release the button quickly). |
| 50 | | |
| 51 | | === {{{Switch}}} === |
| 52 | | |
| 53 | | This is a button toggling between 2 states when you press it. |
| 54 | | |
| 55 | | === {{{Analog}}} === |
| 56 | | |
| 57 | | This component handles a single analog axis. |
| 58 | | |
| 59 | | === {{{Joystick}}} === |
| 60 | | |
| 61 | | Combines several {{{Analog}}} axes. |
| 62 | | |
| 63 | | == Configurations and modifiers == |
| 64 | | |
| 65 | | 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. |
| 66 | | |
| 67 | | 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). |
| 68 | | |