wiki:Plugins/joystick
Last modified 8 years ago Last modified on 15.02.2011 11:31:38

Joystick Plugin

Hardware driver plugin to enable access to a Joystick connected locally to the robot, e.g. wireless joystick, or the control machine. The plugin converts axes to the Fawkes coordinate system and supports force feedback. It currently works only on Linux using the Kernel joystick and input event device APIs.

The ffjoystick? tool can be used to show updates to the joystick interface to verify the joystick is working, and it can provide a joystick connected locally to a remote Fawkes instance, e.g. if the joystick is connected to a separate control machine and the robot is running Fawkes. The ffkbjoystick? tool can provide a fake joystick taking input from a keyboard.

The joystick must be connected on initial loading, or an exception is thrown. Once loaded, the joystick can be disconnected and reconnected. The plugin will notice this, update the blackboard interface accordingly (number of axes is 0 if no joystick is connected), and reopen the device when reconnected.

Joystick axes are labeled with respect to the Fawkes coordinate system. On standard joysticks, pushing the joystick "up" is positive, as is pushing "left". Use ffjoystick to see the actual output for your joystick, it can vary between models. Most six axis joystick seem to use the following axis mapping, already converted to Fawkes (tested with Logitech Cordless, Microsoft SideWinder Precision 2, and a cheap Trust joystick):

Axis (in Interface)Direction (positive, +1)Direction (negative, -1)
0leftright
1updown
2twist lefttwist right
3max speedmin speed
4hat lefthat right
5hat uphat down

For a Logitech WingMan RumblePad with force feedback the mapping is:

Axis (in Interface)Direction (positive, +1)Direction (negative, -1)
0left stick/leftleft stick/right
1left stick/upleft stick/down
2slider rightslider left
3right stick/leftright stick/right
4right stick/upright stick/down
5cross/leftcross/right
6cross/upcross/down

Note that force feedback on this joystick is available only with Linux kernel 2.6.36 and later (and thus unfortunately not out-of-the box in Fedora 14, inclusion requested in bug #676577).

Requires

Config Values

PathTypeDescriptionDefaultR
/hardware/joystick/device_filestringDevice file of the joystick/dev/input/js0*

Provides

BlackBoard Interfaces

  • JoystickInterface::Joystick

Compilation and Runtime Requirements

  • Linux-based operating system with kernel (presumably) 2.6.19 or later, tested with 2.6.35 and later

Usage Instructions

We assume you have one USB joystick connected to the machine running Fawkes. After loading the plugin, the joystick is immediately available. Run

ffjoystick -l

on the same host and move the joystick. You should see lines printing the different axes values.