Playstation Move UDP API

From Immersive Visualization Lab Wiki
Revision as of 13:16, 27 January 2016 by Locksmith (Talk | contribs)

Jump to: navigation, search

Contents

Project Overview

This project is an attempt to create a simple interface to the PS Move API via a local UDP server.

Features

  • Ability to receive all physical data from the move including:
    • Button presses
    • Analogue trigger value
    • Accelerometer data
    • Gyroscope data
    • Magnetometer data
  • Visual tracking of the Move with the Eye
  • Multiple Controllers
  • Rumble and LEDs can be set by client.

TODO

  • Ability to send data back the to Move controllers such as Rumble and LED requests

Installation

Download for Windows.

Setting up the Playstation Eye

Adapted from this guide.

  1. Navigate to /move_api/Install/PS Eye/
  2. Insert PS Eye into an USB 2.0 port or above. Should appear as 'USB Camera-B4.09.24.1' or something similar in device manager.
  3. Run Zadig and install libusb-win32 onto 'USB Camera-B4.09.24.1' (Interface 0 on my machine)
    • Don't install onto 'Interface 1', this will already have usbaudio installed.
    • If no devices appear for installation tick "Options->'List All Devices'"
  4. Test the performance of the camera with 'test_camera.exe'. Hopefully a video stream appears!

If there is visible tearing/laggy footage:

  • Try installing the WinUSB driver with Zadig instead.
  • Ensure the Eye is the only USB device connected to the USB hub if possible.

Other notes:

  • Camera is calibrated for the blue zoom.
  • Red light should come on when it is recording.

Setting up a Playstation Move Controller

Adapted from this guide.

  1. Make sure the controller has charge before beginning or you won't be able to pair via bluetooth.
    • NOTE: Windows 10 and wall chargers have trouble charging the Move Controller.
    • Windows 7 and Mac work from my own testing.
    • When the controller is charged pressing the 'PS' button will cause the LED on the controller to flash.
  2. Navigate to /move_api/Install/PS Move/
  3. Connect the PS Move Controller with USB
  4. Use the 'psmovepair.exe' utility to save the Bluetooth address to the controller. The util will fail past this point though.
  5. Warning: This step is easily the most frustrating. The controller seems to pair fairly randomly, once it does pair however you only need to press the 'PS' button to connect the next time. Best of luck!
    Run 'psmove-pair-win.exe'.
    • Press the 'PS' button and allow the utility to run. If the LED stops flashing press the 'PS' button again.
    • Basically continue this process until you get a successful connection, there doesn't seem to be a trick to it unfortunately.
    • NOTE: If the controller is low on battery a successful connection can look like it's still pairing (flashing LED)
  6. Once the controller has paired run the 'magnetometer_calibration.exe' utility.
    1. Rotate the controller until you get a value 250+
    2. Stand the controller on its end on a flat surface with the 'PS' button facing you.

Using Move Server

Open 'move_udp_server.exe'.

  • To calibrate each controller, hold each respectively approx 10cm from the camera.
  • At the end of this process you should see 'Server Started'

To listen for data bind to the UDP stream at:

IP: '127.0.0.1'
Port: 23459

Data Format

The server sends 2 different messages.

  • Type 'a': Move Physical Data (High frequency, around 100hz)
  • Type 'b': Move Positional Data (Slower, depends on machine)

Type 'a' message

msgType msgNo controller currButtons triggerVal ax ay az gx gy gz mx my mz
Example a 1022 0 128 54 1.000 -0.456 0.234 0.123 0.123 -0.435 -0.363 0.234 0.635
  • msgType: char - 'a'
  • msgNo: int - Begins at 0 and increments for each 'a' type message
  • controller: int - Controller number (starts at 0)
  • currButtons: int - Between 0-255. Stores button presses bitwise.
CROSS, SQUARE, TRIANGLE, CIRCLE, MOVE, START, SELECT, PS
eg - 01001000 Means SQUARE and MOVE are pressed.
  • triggerVal: int - Between 0-255, 0 means trigger is unpressed, 255 means fully pressed.
  • ax, ay, az: float - Accelerometer values. Measured in 'g' m.s-2. Standing the move on its end approx az = -1.
  • gx, gy, gz: float - Gyroscope values. Measured in rad.s-1. x-axis pitch, y-axis roll, z-axis yaw.
  • mx, my, mz: float - Magnetometer values. Between -1 and 1.

Type 'b' message

msgType msgNo controller tx ty tz ux uy trackingMove
Example b 52313 0 10.24 20.53 10.3 0.342 0.623 1
  • msgType: char - 'b'
  • msgNo: int - Begins at 0 and increments for each 'b' type message
  • controller: int - Controller number (starts at 0)
  • tx, ty: float - x and y position of the PS Move light measured in cm from the center of the camera.
Note that as you move further from the camera you can get further horizontally/vertically
  • tz: float - z position of the PS Move light measured in cm.
  • ux, uy: float - normalised x and y positions between 0 and 1. Like tx and ty, the further you are from the camera the larger the viewing plane of the camera.

Troubleshooting

Bad Tracking

Large amounts of natural light and bright spots (such as lights) affect the ability of the Eye to track the Move. Unfortunately the only real solution to this is to move to a darker area.

Bad Calibration

If you find you are getting bad gyro/accel/magnetometer values (even after you have re-calibrated) you can clear the calibration files. They are found at 'C:\Users\<username>\AppData\Roaming\.psmoveapi'

Additional Information

Developers

Software Developer

  • Lachlan Smith

Project Advisor

  • Jurgen Schulze

Resources