Tutorial?

Introduction

The aim of this tutorial is to show how PlayStation Move can be integrated and used with SIGVerse to control the behavior of the agents.


If you questions after reading this page: Please feel free to email at: sigverse-users@googlegroups.com


The device: PS Move Controller

playstationController.jpg
camera.png
  • The Playstation Move Motion Controller (left image)
  • The Playstation Eye Camera (right image): Used for Tracking in 3D space

The SDK: PSMoveAPI

We used The PS Move API, which is an open source library for Linux, Mac OS X and Windows to access the Sony Move Motion Controller via Bluetooth and USB directly from your PC without the need for a PS3. Its details can be found on its website.

Requirements

  • Ubuntu 32/64 bit PC. (Ubuntu installed on virtual machine is also fine)
  • Bluetooth capability via either embedded Bluetooth or external Bluetooth dongle.
  • A PSMove Motion Controller.
  • Any suitable camera source. Though the Playstation Eye Camera is preferred, but in-built web-cam works fine too.

Creating the Development Environment

  • SIGService library:
    • If you use Ubuntu 64 bit, please download the SIGService libraries from here . But keep in mind that you will also need the SIGService header files in the next steps so you should also download the source code as detailed in the 32 bit section.
  • If you use Ubuntu 32 bit, please download the SIGService source code from here and compile the 'makefile' using the 'make' command to create the SIGService library.
  • Download the Playstation Move API from the Github using the link here

$ git clone https://github.com/thp/psmoveapi.git

  • Installation of Playstation Move API

cd to the newly created psmoveapi folder. You can follow the steps provided by the README.ubuntu file. After installing the build dependencies (step 4), I recommend to build the API as a standalone (step 5.b) rather than as an Debian package. During this step I also recommend adding "-DPSMOVE_USE_DEBUG=true -DPSMOVE_USE_DEBUG_CAPTURE=true -DPSMOVE_USE_MADGWICK_AHRS=true" options to cmake command. If you want more options you can install cmake-gui and run it exactly the same way as the cmake command in order to see the other options you may need in a more convenient way.

WARNING : some dependencies are not listed in the README file. You may need to install SDL library from you package manager (libsdl1.2-dev when this tutorial was written). But also bluez, udev and some other libraries that should be preinstalled with your Ubuntu system but sometimes they may not be installed with the system.

You can then go to the build directory you created by following the steps, plug you PSMove controller via USB to your computer and run :

$ sudo psmovepair

If you use a virtual machine, don't forget to plug the bluetooth hardware to your virtual machine so that it can be visible from it. It seems that there are issues with the bluetooth devices sharing on VMWare. Just giving the virtual machine a total control on the hardware should solve such problems.

Don't forget that you should have bluetooth hardware connected to your machine, enabled and set as visible for other devices.

Now you can unplug your device and press the PS button. Your device should establish bluetooth connection with your computer. As a feedback, after pressing the PS button the PSMove led will start blinking and as soon as it connects with the computer the led will stop blinking and be lit continuously.

You can now run :

$ ./example

You should see your PSMove lighting, rumling and then see the captured data in the terminal window. You can also run the test_tracker and test_opengl files that use the PSEye and show some capabilities of the tracker. You can also play arround with the different examples provided in psmoveapi/examples.

If you use a virtual machine, don't forget again to plug your camera to the virtual machine, but you have to know that video capture on virtual machine sometimes won't work. You can try to install cheese from the package manager to check if your video capture is working well. But if you see a black screen even in this programm you have to know that the problem has not been troubleshooted yet, so you won't be able to use tracker data unless you find a solution to this issue.

  • To finalize the installation process run :

$ sudo make install

Development of SIGService for PSMoveController

Download the source code from GitHub

Once you have correctly configured and install the Playstation Move API you can then start to develop SIGVerse programs using the PSMove. First, Install the PSMove SIGService on your computer. You can get the source code here on Github. You can also clone the entire repository by running :

$ git clone https://github.com/SIGVerse/Client.git

on your machine and then cd to SIGVerse_test/Plugin/PSMove/

Build the project

Now you should be in a directory with a PSMoveAPIService.cpp file, a PSMoveData.h file and a Makefile. Edit the Makefile to provide the path to you installation directory of SIGService include and lib directory. Then you can just run the make command and it will create a PSMoveAPIService.sig file.

Run the service

You can now run the service. Here is the steps to follow in order to make the service runnig fine.

  • First you should blug your PSMove to your computer via USB and run the 'psmovepair' command as superuser ($ sudo psmovepair) in order to pair the device with your computer.
  • unplug the controller and press the PS button. The device should establish the bluetooth connection with your computer.
  • plug the PSEye camera to your computer or a normal webcam if you wish to use the tracker.
  • run an instance of the SIGServer and look for the port number (and get the adress of the host of the server if you are running it on a different machine)
  • run the PSMoveAPIService.sig file with the adress of the host, the port number and at least the name of one entity in the running server to which you will send the messages containing the data. You can also give the option --enable-tracker if you want to use the tracker data.

For example if you want to send your messages to "man_001" in the FollowMe sample program :

$ ./PSMoveAPIService.sig localhost 9000 man_001 --enable-tracker

Develop your program

As you may notice the PSMoveAPIService won't have any impact on your program if you don't implement a specific behaviour in your entities' code. If we take the previous example, we are sending messages with the data from the controller and the tracker to "man_001". So we have to handle these messages in the onRecv() method of the entity named "man_001" on the server. When you downloaded the source code of the PSMoveAPIService you got a PSMoveData.h file. This file contains the decoder of the messages sent by the service. just include this file in the implementation of your entity ("man_001" in our example) and use the buildMoveData function on the message received from the PSMoveAPIService. It will format the data from the service in a MoveData struct that you can see in the PSMoveData.h file. There will be one struct for each connected psmove sending data. They are then returned as a std::vector by the buildMoveData method. You can then use the data in your program.

Counter: 5527, today: 1, yesterday: 0

Attach file: fileplaystationController.jpg 2362 download [Information] filecamera.png 2045 download [Information]

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   Help   RSS of recent changes
Last-modified: 2015-01-30 (Fri) 00:18:26 (2370d)