Revision 11 as of 2009-09-29 19:25:10

Clear message

Supported Hardware

Any joystick with a driver that publishes a joy/Joy message can be used with the joystick_remapper.

API Stability

This is a relatively new and untested package. While we do not currently foresee incompatible changes to its ROS API, it is likely that we will find a better way of doing things once we have more experience with joystick remapping.

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="8 -1 -1 9 -1 -1 -1 -1 6 7 4 5 3 2 1 0" />
  <param name="axis_mappings" type="str" value="=" />
</node>

The above example leaves the axes the same, but changes button 1 on the Logitech joystick to 14, button 3 to 12, etc. Both joysticks will publish on the "joy" topic, and can both publish to a single teleop node.

Node

  • joystick_remapper.py

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

See Using the Joystick Remapper.