joystick_drivers: joy | ps3joy | spacenav | spacenav_node | wiimote
- Code API
- diamondback
- electric
- fuerte
- unstable - Tutorials
- Troubleshooting
- FAQ
- Reviews (Doc reviewed)
Used by (4)
Package Summary
Driver for the Sony PlayStation 3 SIXAXIS or DUAL SHOCK 3 joysticks. In its current state, this driver is not compatible with the use of other Bluetooth HID devices. The driver listens for a connection on the HID ports, starts the joystick streaming data, and passes the data to the Linux uinput device so that it shows up as a normal joystick.
- Author: Blaise Gassend, pascal@pabr.org, and Melonee Wise
- License: BSD
- Repository: ros-pkg
- Source: svn https://code.ros.org/svn/ros-pkg/stacks/joystick_drivers/trunk/ps3joy
Contents
Overview
This package provides a driver for the PS3 (SIXAXIS or DUALSHOCK3) bluetooth joystick. This joystick is currently used with the PR2 robot.
This driver exists because Linux's native support for the PS3 joystick is unreliable, and does not give access to the joystick's accelerometers and gyroscope. This driver solves both problems. However in its current form, this driver will not coexist with any other bluetooth device. In future releases, we plan to allow first non-HID and later any bluetooth device to coexist with this driver. If you have a need for such functionality, let it be known.
It has been observed that coexistence is possible, at least in the two following cases:
- Non-HID devices using a userland driver, such as one written using pybluez.
- Keyboards or mice running in HID proxy mode, which appear to the kernel as USB devices.
Hardware Support
This driver may only work with Bluetooth 2.0 adapters.
In our experience, the driver works with most 2.x Bluetooth adapters. Please report other incompatible Bluetooth adapters to blaise@willowgarage.com .
Adapters that are known not to work:
- Linksys USBBT100 version 2 (Bluetooth 1.1).
- USB device 0a12:0x0001
Supported Distributions
ps3joy.py is known to work with Ubuntu Hardy 8.04 and Ubuntu Jaunty 9.04. To make it work with Ubuntu Karmic 9.10, you will have to follow these instructions.
Sixpair runs on all platforms that have been tested.
API Stability
We do not anticipate any incompatible changes to the API of this package. With maturing support for the PS3 joystick in BlueZ and the Linux kernel, we hope that most people will no longer need this package unless they want to use the gyroscope and accelerometer axes.
Getting Started
The How to Pair the PS3 Joystick with a Bluetooth Dongle is a good starting point for how to use this package.
ROS API
New in ROS Electric
ps3joy.py
Joystick driver for the PS3 Joystick.Subscribed Topics
joy/set_feedback (sensor_msgs/JoyFeedbackArray)- Set the rumble and leds of the joystick. The PS3 has 4 leds (ids:0-3) and two rumblers (ids:0-1). The high frequency rumbler is id 1 and the low frequency rumbler is id 0.
Published Topics
diagnostics (diagnostic_msgs/DiagnosticArray)- Publishes the battery status, charging status, connection.
Setting Feedback
To set the led or rumble from the command line:
rostopic pub /joy/set_feedback sensor_msgs/JoyFeedbackArray '[[0, 3, 1], [1,1,0.8]]'
Command-Line Options
$ ./ps3joy.py --help usage: ps3joy.py [--inactivity-timeout=<n>] [--no-disable-bluetoothd] [--redirect-output]=<f> <n>: inactivity timeout in seconds (saves battery life). <f>: file name to redirect output to. Unless --no-disable-bluetoothd is specified, bluetoothd will be stopped.
--inactivity-timeout
- Turn off the joystick after a certain period of inactivity. This is useful to save batteries and reduce contention on the 2.4 GHz network.
--no-disable-bluetoothd
Tells ps3joy.py not to take down bluetoothd. For this option to work, bluetoothd must be configured not handle input devices, otherwise you will get an "Error binding to socket" error message. (New in 1.1.1 and 1.0.3)
--redirect-output
Allows the standard output and error to be redirected to a file. This is useful when ps3joy.py is run in the background. (New in 1.1.1 and 1.0.3)
PS3 Joystick Buttons and Axes
Buttons 4-15 are reported as axes as well as buttons. The axis corresponding to a button can be used to determine how hard the user is pressing on the button, ranging from 1 when there is no press, to -1 for a hard press. For these buttons, the axis number is the same as the button number.
ps3joy.py also exposes the joystick's three-axis accelerometer and the single-axis gyroscope:
Axis |
Description |
16 |
Right-Left (positive is left) |
17 |
Forward-Backward (positive is forward) |
18 |
Up-Down (positive is up) |
19 |
Yaw axis (positive is clockwise) |
Direct Download Link
Because this package can be used independently of ROS by people wishing to use a PS3 joystick in linux, I am providing a direct link to the driver here. In order to run this python file, you will have to have the following system dependencies installed: python, bluez, python-bluez, joystick, libusb-dev. Please report any problems you have with this driver to blaise@willowgarage.com .






