• Diff for "joystick_remapper"
Differences between revisions 3 and 4
Revision 3 as of 2009-09-21 23:44:45
Size: 897
Editor: KevinWatts
Comment:
Revision 4 as of 2009-09-22 00:15:44
Size: 1633
Editor: KevinWatts
Comment:
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:

=== Launch File Example ===

This example shows how to remap a Logitech-type joystick to a PS3 button mapping for controlling the PR2.
{{{
<node pkg="joy" type="joy_node" name="logitech_joy" >
  <remap from="joy" to="logitech" />
</node>

<node pkg="joystick_remapper" type="joystick_remapper.py" name="logitech_to_ps3" >
  <remap from="joy_source" to="logitech" />
  <remap from="joy_des" to="joy" />
  <param name="button_mappings" type="str" value="0 14 2 12 10 11 8" />
  <param name="axis_mappings" type="str" value="=" />
</node>
}}}
Line 13: Line 29:
 * '''button_mapping''' (string) - A space separated list of integers that defines the button mapping. The k^th^ integer indicates which input button maps to the k^th^ output button. (Buttons are counted from zero.) If the parameter is not set or is "=" then the input buttons are copied directly to the output.
  For example: "1 0 5" means that axis 1 goes to 0, axis 0 goes to 1 and axis 5 goes to 2.
The mapping parameters are given as strings, with each value in the string giving the new axis or button number. The k^th^ integer indicates which input button maps to the k^th^ output button. For example:
{{{
2 3 0 1
}}}
Maps button (or axis) 2 to output button 0, 3->1, 0->2 and 1->3. Any axis or buttons that are not remapped are left in original order. Note that axes and button indices start from zero.
Line 16: Line 35:
 * '''axis_mapping''' (string) - Same as '''button_mapping''' for mapping the axes. If "=" is given as the remapping parameter, or none is given, the joystick buttons or axes are not remapped.

 * '''~button_mapping''' (string) - Buttons mappings.

 * '''~axis_mapping''' (string) - Same as '''~button_mapping''' for mapping the axes.

ROS API

Launch File Example

This example shows how to remap a Logitech-type joystick to a PS3 button mapping for controlling the PR2.

<node pkg="joy" type="joy_node" name="logitech_joy" >
  <remap from="joy" to="logitech" />
</node>

<node pkg="joystick_remapper" type="joystick_remapper.py" name="logitech_to_ps3" >
  <remap from="joy_source" to="logitech" />
  <remap from="joy_des" to="joy" />
  <param name="button_mappings" type="str" value="0 14 2 12 10 11 8" />
  <param name="axis_mappings" type="str" value="=" />
</node>

Topics

  • joy_source (joy/Joy) - Topic on which joystick commands are arriving. This will usually get remapped.

  • joy_dest (joy/Joy) - Topic on which the remapped joystick events are sent out.

Parameters

The mapping parameters are given as strings, with each value in the string giving the new axis or button number. The kth integer indicates which input button maps to the kth output button. For example:

2 3 0 1

Maps button (or axis) 2 to output button 0, 3->1, 0->2 and 1->3. Any axis or buttons that are not remapped are left in original order. Note that axes and button indices start from zero.

If "=" is given as the remapping parameter, or none is given, the joystick buttons or axes are not remapped.

  • ~button_mapping (string) - Buttons mappings.

  • ~axis_mapping (string) - Same as ~button_mapping for mapping the axes.

Tutorials

Links to relevant tutorials

Wiki: joystick_remapper (last edited 2022-06-22 13:04:01 by Keegan Neave)