# VRPN

VRPN (Virtual-Reality Peripheral Network) is a device-independent, network-based interface for accessing virtual reality peripherals in VR applications. It was originally designed and implemented by Russell M. Taylor II at the Department of Computer Science of the University of North Carolina at Chapel Hill. VRPN was maintained and supported by Sensics while it was business. It is currently maintained by ReliaSolve and developed in collaboration with a productive community of contributors. It is described more fully at vrpn.net and in VRPN-VRST.
The purpose of VRPN is to provide a unified interface to input devices, like motion trackers or joystick controllers. It also provides the following:
* Time-stamping of data
* Multiple simultaneous access to peripheral devices
* Automatic re-connection of failed servers
* Storage and playback of sessions
The VRPN system consists of programming interfaces for both the client application and the hardware drivers and a server application that communicates with the hardware devices. The client interfaces are written in C++ but have been wrapped in C#, Python and Java.
A typical application of VRPN is to encode and send 6DoF motion capture data through the network in real time.

## Networking

A VRPN client can establish a connection with a VRPN server (the device providing the data) in two ways: either over TCP (reliable, but less efficient), or over UDP (unreliable, but lower-latency and more efficient). The "unreliable" mode is generally preferred when the latency is critical.
The "unreliable" connection initialization sequence makes use of both the TCP and UDP protocols. It works as follows:
* the client opens a TCP socket for listening on an arbitrary port;
* the client sends the port number of this socket, along with its own machine name, in a UDP datagram directed to a well known port of the VRPN server (the default is 3883);
* the server opens a TCP connection with the client, to the port number communicated at step 2;
* if the TCP connection is established, each device tells to the other the supported VRPN version;
* if the versions are not compatible, the connection is dropped;
* otherwise, each device begins to listen on a new UDP port (different from those used before) and sends the port number to the other device, by using the previously created TCP connection;
* from now on, all the data is sent over the two UDP ports opened at step 6.
The advantages of this approach are: fast connection time and fast failure detection during connection.
However, the "unreliable" connection initialization protocol does not honor the strict layering protocol design principle, as the application-level VRPN payload leaks information about lower levels in the network stack, namely the machine names and TCP/UDP port numbers. Because of this design choice, it is impossible to establish a VRPN connection between two devices connected through a NAT: the router would need to translate not only the layer-3 information in the packet headers, but also the references to IP addresses and port numbers inside the VRPN payload.
To deal with this problem, VRPN offers a second "reliable", TCP-only connection initialization mode, which is a standard TCP server-client interaction: the VRPN server listens on a well-known TCP port and the client initiates a connection. In this mode, all the data is sent on the same TCP connection, and no UDP communication is required.

## Supported Devices
### Trackers (listed alphabetically)

* 3rdTech HiBall-3000 Wide Area Tracker (formerly the UNC Ceiling tracker).
* Antilatency positional tracking system.
* ART optical tracking systems, including Flystick2 and Flystick3. The receiving code is part of the standard source distribution.
* Analog devices used as a tracker (Magellan, CerealBox with joysticks attached, Radamec SPI, Mouse, ...).
* ARToolkit VRPN tracker available from Universidad de los Andes.
* Ascension Flock-of-birds (either running through one serial port, or with each sensor connected to its own serial port). This driver (and the other tracker drivers) resets the tracker in case of power cycle, serial disconnect or other flukes. Use of this driver on a Nest of Birds will burn out the transmitter drive circuitry.
* Button devices used as teleporters or trackers (Global Haptics GeoOrb, ...).
* Crossbow RGA300 accelerometer using a serial interface.
* GameTrak devices.
* Immersion Microscribe.
* Inertialmouse and Event Mouse from Bauhaus University Weimar.
* InterSense IS-600 and IS-900 (using augmented Fastrak interface on any architecture).
* Logitech 3D mouse.
* Microsoft Kinect (two different VRPN servers available.)
* Motion Analysis Corporation (VRPN server is built into the vender's server)
* MotionNode inertial tracking device.
* NDI Polaris optical tracking system.
* Novint force-feedback device.
* OptiTrack Motive (was NaturalPoint OptiTrack Tracking Tools) (VRPN server is built into vendor server).
* Origin Systems DynaSight tracker (with passive reflector). This driver also supports the older tracker in the SeeReal D4D stereo Display.
* OSVR Hacker Developer Kit
* Other InterSense trackers (using InterSense native library, even USB-based ones); there is currently a discussion on the VRPN email list about whether the position and orientation information are returned consistently when using this interface.
* PS-Tech optical tracking system.
* PhaseSpace tracking system.
* PNI SpacePoint.
* Polhemus Fastrak tracker and 3Space trackers on several architectures, Liberty and LibertyHS tracker under at least Linux. The Patriot tracker is supported using the Liberty driver. G4 Powertrack.
* Razer Hydra game controller.
* Sensable Technologies PHANToM force-feedback device.
* Sensics dSight tracker.
* Sensics zSight tracker.
* Serial-port GPS device.
* Vicon (VRPN server is built into the vendor's server).
* Viewpoint Eye tracker.
* Wintracker III magnetic tracking system from Virtual Realities Ltd.
* WorldViz Precision Position Tracker PPT 1.2.
* Yost Labs 3Space Sensor (and wireless 3Space sensors).
* zSpace immersive interactive hardware and software platform (VRPN server built into vendor server).

### Other devices (listed alphabetically)

* 3DConnexion SpaceNavigator, SpaceExplorer, Spacemouse Pro, Navigator for Notebooks, SpaceTraveler devices, and SpaceMouseWireless (buttons and 6DOF differential analog).
* 5DT glove tracker (analog device with five values for the fingers plus pitch and roll). Also, the 5DT16 glove is supported along with a driver to convert the 16 analog values into button presses.
* B&G systems CerealBox button/dial/slider/joystick controllers plugged into any server-capable machine.
* Biosciences Tools thermal-control system.
* CH Products Fighterstick
* DirectInput enabled joysticks (including force-feedback joysticks) on Windows (see howto). Also, DirectInput enabled rumble packs on Windows.
* Dream Cheeky USB drum kit.
* Euclideon Holographics Hologram Devices (Hologram Table, Hologram Room, Hologram Wall).
* Fraunhofer IMK ADBox and Fakespace Cubic Mouse.
* Global Haptics GeOrb (buttons and analogs).
* Haydon-Kerk IDEA drives, linear-motion controllers.
* Hillcrest Labs' Freespace devices.
* Joystick controllers: Contour ShuttleXpress, Futaba InterLink Elite, Griffin PowerMate, Logitech Extreme 3D Pro, Saitek ST290 Pro, Microsoft SideWinder Precision 2, Microsoft SideWinder, Microsoft Xbox S (raw controller on all O/S), Microsoft Xbox 360 (raw controller on all O/S), Afterglow Ax1 For Xbox 360 (raw controller on all O/S).
* Keyboard on Windows.
* Logitech Magellan and Spaceball 6DOF motion controllers with buttons (including the Spaceball 5000).
* LUDL XY stages through LibUSB.
* Mouse devices on Linux (when logged in at the console) and Windows.
* National Instruments A/D cards.
* Nintendo Wii Remote (also acting as a tracker).
* NRL ImmersionBox serial driver (support for buttons only).
* Other joysticks on Windows.
* PC joysticks running under Linux.
* Radamec Serial Position Interface video/movie camera tracker (unscaled zoom/focus, untested motion base).
* Retrolink GameCube.
* Serial mice: The buttons on several styles of serial mice plugged into a serial port.
* SGI button and dial boxes (on an SGI or other machines).
* Totally Neat Gadget (TNGs) from MindTel (buttons and analogs).
* Xbox 360 game controller.
* UNC's hand-held controller (or any device with up to 5 buttons; can be plugged into the parallel port on a Linux or Windows box—its use is deprecated, use the TNG3 instead).
* Wanda analog/button device.
* Win32 sound servers, based on the Miles SDK (obsolete), the AuSIM sound hardware, and Microsoft DirectSound.
* XKeys devices from P.I. Engineering: the Desktop, Professional, Jog&Shuttle, Joystick, and foot pedal.
* Zaber.com's linear positioning elements.