-
Notifications
You must be signed in to change notification settings - Fork 146
PSMoveService Programmer Notes
PSMoveService is a background service that manages connections to Sony controllers (PSMove, DualShock4, PSNavi), Sony tracking cameras (PSEye), and Sony Head Mounted Displays (PSVR*). The service computes tracking pose for controllers and HMDs using a sensor fusion model. It then feeds the pose and button data to one or more client applications over a network socket connection. Controller data is served over an unreliable UDP network socket. Client requests (e.g., pair controller, change controller tracking colour, set camera gain, etc) are sent via a reliable TCP network socket. All network data is serialized using the Google Protocol Buffers API.
PSMoveService does not integrate with other VR systems itself. It's up to the other developers to create plugins that use the PSMoveService Client API for other VR systems. For example, PSMoveServiceSteamVRBridge is one such plugin for SteamVR.
*Note: PSVR support is still under development and is not in a usable state.
The PSMoveService application can be broken down into the following major systems:
This class handles incoming requests from connecting clients. These requests include operations like starting tracking for controller, adjusting tracking camera settings, and pairing controllers. It also keeps track of persistent state for requests (like which controllers have an active data stream going to the client).
More details can be found in ServerRequestHandler Programmer Notes
This container class updates all of the specific device managers for PSMoveService. It also is the front end for OS specific device queries.
More details can be found in DeviceManager Programmer Notes
The TrackerManager class is responsible for managing all connected Sony tracking cameras that PSMoveService cares about (i.e. the PS3Eye). On a regular interval it polls all connected tracking cameras and extracts any tracking projections it can find. These tracking projections are used to compute an optical tracking pose for each controller.
More details can be found in TrackerManager Programmer Notes
The ControllerManager class is responsible for managing all connected Sony controllers that PSMoveService cares about (PSMove, DualShock4, and PSNavi). The controller manager will add and remove controller entries as new controllers are add or removed from the system. Connected controllers are polled regularly for IMU sensor and button data. The controller manager will also compute a controller pose using sensor fusion of the optical tracking pose with the IMU sensor data.
More details can be found in ControllerManager Programmer Notes
The HMDManager class is responsible for managing all connected Sony Head Mounted displays that PSMoveService cares about (PSVR). The HMD manager will add and remove HMD entries as new HMDs are add or removed from the system. Connected HMDs are polled regularly for IMU sensor data. The HMD manager will also compute an HMD pose using sensor fusion of the optical tracking pose with the IMU sensor data.
More details can be found in HMDManager Programmer Notes
The USBDeviceManager acts as both a wrapper around other lower level USB APIs (LibUSB). It supports bulk, interrupt, control USB transfer requests manages by a separate worker thread. It also provides an interface for iterating over currently connected USB devices.
More details can be found in USBDeviceManager Programmer Notes
The ServerNetworkManager class is responsible for doing the TCP and UDP socket management. It also handles the serialization of message structures into raw byte streams that are read from and written to network sockets. Incoming request messages are forwarded on to the ServerRequestHandler.
More details can be found in ServerNetworManager Programmer Notes
PSMoveService
|-- ServerRequestHandler
| +-- Connection State Map
| +-- Request Connection State
| |-- Connection ID;
| |-- Active Controller Streams Bitmask
| |-- Active Tracker Streams Bitmask
| |-- Active HMD Stream Bitmask
| |-- Pending AsyncBluetoothRequest
| |-- ControllerStreamInfo List
| |-- TrackerStreamInfo List
| +-- HMDStreamInfo List
|-- DeviceManager
| |-- DeviceManagerConfig
| |-- IPlatformDeviceAPI
| | +-- PlatformDeviceAPIWin32
| |-- ControllerManager
| | +-- ServerControllerView List
| | |-- IControllerInterface -> PSNaviController | PSMoveController | PSDualShock4Controller
| | |-- ControllerOpticalPoseEstimation
| | |-- IPoseFilter -> CompoundPoseFilter | KalmanPoseFilter
| | +-- PoseFilterSpace
| |-- TrackerManager
| | |-- TrackerManagerConfig
| | +-- ServerTrackerView List
| | +-- ITrackerInterface -> PS3EyeTracker
| +-- HMDManager
| |-- HMDManagerConfig
| +-- ServerHMDView List
| +-- IHMDInterface -> MorpheusHMD
|-- USBDeviceManager
| |-- USBManagerConfig
| |-- IUSBApi -> LibUSBApi | WinUSBApi | NullUSBApi
| |-- Lock Free Request Queue
| |-- Lock Free Result Queue
| +-- Worker Thread
+-- ServerNetworkManager
|-- NetworkManagerConfig
|-- Boost::ASIO I/O Service
|-- TCP Connection Acceptor;
|-- UDP Socket
|-- TCP Client Connection Map
+-- Client Connection
|-- IServerNetworkEventListener
|-- TCP Socket
|-- Read Buffer
|-- Write Buffer
|-- Pending Response Queue
+-- Pending Device Output Data Frame UDP Queue