Playstation Move tracking is a work in progress and the implementation described here will be improved/changed over time.

Requirements

Controller setup

USB/HID Permissions

Even when connected over bluetooth, your user will require the permissions to access the psmove’s hid-over-bluetooth device.

If you use the “xr-hardware” udev rules, you don’t need to do anything, it includes rules to set permissions for the psmove controllers.

If you want to install only rules specific to the psmove instead, you can follow the psmove documentation.

Bluetooth pairing the controllers

Bluetooth pairing the controllers requires a USB connection. However IMU data can only be read through bluetooth, once the controllers are paired, reading IMU data through USB is not supported.

The pairing procedure is detailed at https://github.com/thp/psmoveapi/blob/master/docs/pairing.rst.

In short:

git clone --recursive https://github.com/thp/psmoveapi.git
cd psmoveapi
cmake .
make
sudo ./psmove pair

Pairing doesn’t always work reliably, it might be necessary to restart the bluez daemon sudo systemctl restart bluetooth and repeat pairing until it works. When powering on the controller with its power button, it should automatically connect to the PC, and bluetooth tools should show the controller (“Motion Controller”) as connected. Trying to initiate a connection from the PC usually does not work.

Camera Setup

PS4 camera: firmware

By default the ps4 camera does not work as a camera, a firmware file has to be loaded first.

Download the firmware upload script, and a firmware.bin file (firmware.bin with md5sum 99ca1e97ea2bb9edaf4c6f511292b4e2 comes with uvc support and has been tested with Monado).

wget https://raw.githubusercontent.com/ps4eye/ps4eye/master/python/ps4eye_init.py
wget -O firmware.bin 'https://github.com/psxdev/luke_firmwares/blob/master/101_85C8E0_64036.bin?raw=true'

Uploading the firmware file has to be repeated every time the camera is powered (after restarting the PC, or after plugging it in):

sudo ./ps4eye_init.py

This should print PS4 camera firmware uploaded and device reset.

The camera should now work with standard UVC tools like guvcview (in Video Controls, choose the first entry called USB Camera-OV580: USB Camera-OV).

If the camera does not show up, or guvcview can not produce images, try a different USB port/host controller. The ps4 camera is known to not work on all USB controllers and hubs.

Calibrating the camera with monado

In the future a calibration file will be distributed with monado. For now, calibration has to be performed by the user.

The monado-gui utility is used to calibrate the camera before using it with Monado. This is necessary to compensate for the usual camera/lens distortion. In a monado build tree the gui utility is located at

./src/xrt/targets/gui/monado-gui

The calibration procedure is

1. Get a Checkerboard grid ready, it can be displayed on your monitor
    a. Set up https://calib.io/pages/camera-calibration-pattern-generator for checkerboard pattern with 7 rows and 9 columns.
    b. Show the resulting image/pdf on screen or print it and measure the size of one square
2. Choose `Calibrate` from the monado-gui menu
3. Choose the `USB Camera-OV580` camera (PS4 camera)
4. Choose the second resolution 1748x408 (the full resolution takes quite some CPU power)
5. Leave the default 7 rows, 9 columns setting, set `Checker Size` to the previously measured size of one square and click Done.
6. Move the camera around, until it captures enough images. It's a good idea to tilt the camera and view the checkerboard from different angles, in different parts of the camera field of view.
7. After the calibration finishes, click exit. A calibration file should be stored at ~/.config/monado/PS4_EYE.calibration

Usage

The psmove poses and buttons are fully exposed through a monado specific interaction profile /interaction_profiles/mnd/ball_on_stick_controller (see bindings in the code), and limited bindings are available through the khronos simple controller interaction profile.

When a PS4 camera with uvc enabled firmware is connected, a calibration file is present, and a paired and connected psmove controller is connected, monado should automatically enable positional tracking for the psmove controllers.

As an example, hello_xr -g Vulkan should have the psmove controller enabled as a positionally tracked “khronos simple controller”, including the trigger and haptic feedback.

To debug issues, monado implements a debug UI in a separate window which can be enabled with an environment variable: OXR_DEBUG_GUI=1 hello_xr -g Vulkan. If monado can find and enable the camera, there will be windows HSV Filter and PSMV Tracker #1 and PSMV Tracker #2 available in the debug UI, showing the raw camera image as well as the color filtered camera images.