Changes between Version 3 and Version 4 of Tutorial5AdvancedRemoteControlUsage
- Timestamp:
- Nov 22, 2017, 11:22:07 AM (8 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Tutorial5AdvancedRemoteControlUsage
v3 v4 3 3 == Introduction == 4 4 5 As we've seen in [[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:5 As we've seen in [[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: 6 6 7 7 {{{ … … 28 28 }}} 29 29 30 The first method, '''{{{_createFrontend()}}}''' must return a valid frontend (we just saw in [[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.30 The first method, {{{_createFrontend()}}} must return a valid frontend (we just saw in [[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. 31 31 32 The second method, '''{{{_buildComponents()}}}'''is where interesting things take place. Here, we create the buttons/axis mapping to the robot controls.32 The second method, {{{_buildComponents()}}} is where interesting things take place. Here, we create the buttons/axis mapping to the robot controls. 33 33 34 34 == Components == … … 36 36 '''Py4bot''' implements different components to build a custom remote control mapping: 37 37 38 === '''{{{Button}}}'''===38 === {{{Button}}} === 39 39 40 40 This is a simple push button, whith several ''triggers'', in order to control its behavior: … … 49 49 Default trigger is ''click'' (you must press and release the button quickly). 50 50 51 === '''{{{Switch}}}'''===51 === {{{Switch}}} === 52 52 53 53 This is a button toggling between 2 states when you press it. 54 54 55 === '''{{{Analog}}}'''===55 === {{{Analog}}} === 56 56 57 57 This component handles a single analog axis. 58 58 59 === '''{{{Joystick}}}'''===59 === {{{Joystick}}} === 60 60 61 Combines several '''{{{Analog}}}''' axis.61 Combines several {{{Analog}}} axes. 62 62 63 63 == Configurations and modifiers == … … 65 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 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).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 68
