Immersive Visualization / IQ-Station Wiki
This site hosts information on virtual reality systems that are geared toward scientific visualization, and as such often toward VR on Linux-based systems. Thus, pages here cover various software (and sometimes hardware) technologies that enable virtual reality operation on Linux.
The original IQ-station effort was to create low-cost (for the time) VR systems making use of 3DTV displays to produce CAVE/Fishtank-style VR displays. That effort pre-dated the rise of the consumer HMD VR systems, however, the realm of midrange-cost large-fishtank systems is still important, and has transitioned from 3DTV-based systems to short-throw projectors.
Difference between revisions of "VRPN"
m (Added a new oddity) |
m (Added some additional ways FreeVR can benefit VRPN usage) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
communications protocol developed at the University of North Carolina's Virtual Reality | communications protocol developed at the University of North Carolina's Virtual Reality | ||
research group. It provides a cross-platform/cross-device mechanism to link peripherals | research group. It provides a cross-platform/cross-device mechanism to link peripherals | ||
of various types (mostly related to VR) with applications. It works across the network, | |||
so there can be a host that interfaces with the peripheral and another computer (or computers) | so there can be a host that interfaces with the peripheral and another computer (or computers) | ||
that read that data to provide the interaction with the virtual reality rendering software. | that read that data to provide the interaction with the virtual reality rendering software. | ||
Line 32: | Line 32: | ||
a particular configuration. For example: | a particular configuration. For example: | ||
< | <syntaxhighlight> | ||
% vrpn_server -f vrpn_dtrack.conf | % vrpn_server -f vrpn_dtrack.conf | ||
</ | </syntaxhighlight> | ||
'''''NOTE Also''': The [[FreeVR | FreeVR VR Integration Library]] can also serve as a | |||
VRPN client — though presently only handles TCP interchanges, and only | |||
a single client. Limitations aside, it works as a great tool for emulating | |||
VRPN inputs.'' | |||
==The Client== | ==The Client== | ||
Line 66: | Line 71: | ||
are being sent, and thus what input devices are active on the server. | are being sent, and thus what input devices are active on the server. | ||
< | <syntaxhighlight> | ||
% vrpn_print_messages | % vrpn_print_messages <vrpnhost> | ||
</ | </syntaxhighlight> | ||
====VRPN's vrpn_print_devices==== | ====VRPN's vrpn_print_devices==== | ||
Line 75: | Line 80: | ||
One thing to note is that the user must already know the name of the | One thing to note is that the user must already know the name of the | ||
device to read from a server in order to request the data. | device to read from a server in order to request the data. | ||
Also, while the UDP protocol is typically used for it's | Also, while the UDP protocol is typically used for it's attribute of | ||
lower-latency, TCP is sometimes preferred, for example to ensure that | lower-latency, TCP is sometimes preferred, for example to ensure that | ||
none of the data values are skipped. | none of the data values are skipped. | ||
Line 81: | Line 86: | ||
Here's an example of reading data from a DTrack device on the machine <TT>vrpnhost</TT>: | Here's an example of reading data from a DTrack device on the machine <TT>vrpnhost</TT>: | ||
< | <syntaxhighlight> | ||
% vrpn_print_devices DTrack@tcp://vrpnhost | % vrpn_print_devices DTrack@tcp://vrpnhost | ||
</ | </syntaxhighlight> | ||
The data will then stream to the terminal window. | The data will then stream to the terminal window. | ||
Line 95: | Line 100: | ||
The rendering of the cube is done with OpenGL in a Glut window. | The rendering of the cube is done with OpenGL in a Glut window. | ||
< | <syntaxhighlight> | ||
% vrpn_orientation SpinAE@tcp:127.0.0.1 | % vrpn_orientation SpinAE@tcp:127.0.0.1 | ||
</ | </syntaxhighlight> | ||
====VRPN's vrpn_print_performance==== | ====VRPN's vrpn_print_performance==== | ||
Line 104: | Line 109: | ||
This test client can handle multiple input requests: | This test client can handle multiple input requests: | ||
< | <syntaxhighlight> | ||
% vrpn_print_performance SpinAE@tcp:127.0.0.1 SpinAz@tcp:127.0.0.1 | % vrpn_print_performance SpinAE@tcp:127.0.0.1 SpinAz@tcp:127.0.0.1 | ||
</ | </syntaxhighlight> | ||
Different input types can be disabled by preceding the input-specifier | Different input types can be disabled by preceding the input-specifier | ||
Line 128: | Line 133: | ||
inputs with the <TT>-screen</TT> option: | inputs with the <TT>-screen</TT> option: | ||
< | <syntaxhighlight> | ||
% vrpntest vrpnhost | % vrpntest [vrpnhost] | ||
% vrpntest -screen [vrpnhost] | |||
% vrpntest -screen vrpnhost | </syntaxhighlight> | ||
</ | |||
=The VRPN Protocol= | =The VRPN Protocol= | ||
Line 138: | Line 142: | ||
the basic description of the VRPN protocol. (In the past the file was named | the basic description of the VRPN protocol. (In the past the file was named | ||
simply "<TT>format</TT>" which made it near-impossible to find if you didn't | simply "<TT>format</TT>" which made it near-impossible to find if you didn't | ||
already know the name of the file!) | already know the name of the file!) The contents of that file are primarily | ||
about the general header format and the opening handshake sequence, but really | |||
say nothing about the messages containing actual input/tracking data between | |||
the client and the server, so the rest of the protocol was left as "an exercise | |||
for the reader." | |||
The information | The information in this Wiki page is a combination of information from that protocol | ||
description file and empirical exploration (which might have | description file and empirical exploration (which might have included | ||
exploring the source code as well). | exploring the source code as well). | ||
Line 165: | Line 173: | ||
==The VRPN "Cookie" Format== | ==The VRPN "Cookie" Format== | ||
The "cookie" string is 24 characters long and contains the ASCII string: | The "cookie" string is 24 characters long and contains the ASCII string: | ||
< | <syntaxhighlight> | ||
vrpn: ver. XX.YY L\0\0\0\0\0 | vrpn: ver. XX.YY L\0\0\0\0\0 | ||
</ | </syntaxhighlight> | ||
where: | where: | ||
Line 173: | Line 181: | ||
* YY = minor version number ("34" as of this writing) | * YY = minor version number ("34" as of this writing) | ||
* L = remote log mode requested ("0", "1", "2", or "3") | * L = remote log mode requested ("0", "1", "2", or "3") | ||
==Specific VRPN Message Packets== | |||
(TODO: This section still needs to be written. | |||
In the meantime, the top-comments contained in the source file <TT>vr_output.vrpn.c</TT> | |||
of the [http://freevr.org FreeVR VR integration library] toolkit describe all the | |||
key message package types — at least those needed for a standard VR system.) | |||
=Known Bugs and Oddities= | =Known Bugs and Oddities= | ||
Line 183: | Line 197: | ||
* [https://en.wikipedia.org/wiki/VRPN VRPN's Wikipedia entry] | * [https://en.wikipedia.org/wiki/VRPN VRPN's Wikipedia entry] | ||
* [https://github.com/vrpn/vrpn/wiki VRPN on GitHub] | * [https://github.com/vrpn/vrpn/wiki VRPN on GitHub] | ||
* [https://gitter.im/vrpn/vrpn VRPN Gitter chat] [https://gitter.im/vrpn/vrpn?at=57fa745770fcb5db0c413c07 (at OpenVR conversation)] | |||
* [http://www.cs.unc.edu/~taylorr/cyberinfrastructure/vrpn_html UNC document describing VRPN (older)] | * [http://www.cs.unc.edu/~taylorr/cyberinfrastructure/vrpn_html UNC document describing VRPN (older)] | ||
* [https://web.archive.org/web/20160126032444/http://lists.unc.edu/read/?forum=vrpn VRPN Forum (older — from the Wayback Machine)] | * [https://web.archive.org/web/20160126032444/http://lists.unc.edu/read/?forum=vrpn VRPN Forum (older — from the Wayback Machine)] | ||
* [https://gitlab.com/karlun/vrpn-openvr OpenVR for VRPN effort] (from 2017) | |||
* [http://docs.ros.org/en/kinetic/api/vrpn_client_ros/html/vrpn__client__ros_8cpp_source.html ROS VRPN Client code] |
Latest revision as of 21:04, 2 July 2024
VRPN library & protocol
VRPN is a library (API) and communications protocol developed at the University of North Carolina's Virtual Reality research group. It provides a cross-platform/cross-device mechanism to link peripherals of various types (mostly related to VR) with applications. It works across the network, so there can be a host that interfaces with the peripheral and another computer (or computers) that read that data to provide the interaction with the virtual reality rendering software. (NOTE: the link at the beginning of this paragraph has some worthwhile details, but is somewhat out of date -- see the GitHub repo version below for the up-to-date version.)
Repositories
- VRPN on Github: VRPN has transitioned to the GitHub repository.
- VRPN at UNC: This is the old UNC ftp repository.
Usage
VRPN operates in a client/server model. The server resides on the host computer with the direct connections to the peripheral devices. The server is configured to read one or more devices, in some cases transmogrify the data, and then listen for client connections, serving the data to connected clients.
The Server
The configuration file contains an ASCII list of devices for the server to gather data from, including information of serial ports, or device files, etc, along with possible configuration options. By default, VRPN will listen on port 3883.
The general procedure for running the VRPN server is to edit the "vrpn.conf" file to uncomment the options needed for the particular input devices handled by that server and then either run the server with no arguments if the configuration file can be found in the default location, or to use the "-f" option to specify a particular configuration. For example:
% vrpn_server -f vrpn_dtrack.conf
NOTE Also: The FreeVR VR Integration Library can also serve as a VRPN client — though presently only handles TCP interchanges, and only a single client. Limitations aside, it works as a great tool for emulating VRPN inputs.
The Client
In most cases, the client will be a particular VR application that has been compiled with the VRPN client library. This can include anything from individual VR applications to modules that are included within another system, such as the Unity game engine.
Test Clients
Typically, as a system is being configured, the administrator will want to confirm correct operation of the server, including correct reading of the data from the inputs themselves. For this, there are test clients, which read data from the server, and then display that data in a way that allows the VR system administrator to confirm that the values are as expected. The VRPN package of course includes such a test program, but there are third party solutions as well, including FreeVR.
VRPN's test clients
VRPN provides a handful of programs that serve as test clients, providing different aspects of information from the VRPN server. The most interesting of these are:
- vrpn_print_messages
- vrpn_print_devices
- vrpn_orientation
- vrpn_print_performance
VRPN's vrpn_print_messages
When the user is not aware of what messages are being provided by a VRPN server, then the vrpn_print_messages tool is useful for seeing what messages are being sent, and thus what input devices are active on the server.
% vrpn_print_messages <vrpnhost>
VRPN's vrpn_print_devices
The most commonly used test client program that is provided with the VRPN package for observing the data from a VRPN server is: vrpn_print_devices. One thing to note is that the user must already know the name of the device to read from a server in order to request the data. Also, while the UDP protocol is typically used for it's attribute of lower-latency, TCP is sometimes preferred, for example to ensure that none of the data values are skipped.
Here's an example of reading data from a DTrack device on the machine vrpnhost:
% vrpn_print_devices DTrack@tcp://vrpnhost
The data will then stream to the terminal window.
VRPN's vrpn_orientation
For analyzing the quality of the orientation component of a position tracker input, the vrpn_orientation tool is very handy in that it shows a colored cube rotate based on the quaternion component of a position tracker input.
The rendering of the cube is done with OpenGL in a Glut window.
% vrpn_orientation SpinAE@tcp:127.0.0.1
VRPN's vrpn_print_performance
To analyze the update rate of an input device, the vrpn_print_performance tool outputs the number of data packets received in 1 second intervals for the given input device. This test client can handle multiple input requests:
% vrpn_print_performance SpinAE@tcp:127.0.0.1 SpinAz@tcp:127.0.0.1
Different input types can be disabled by preceding the input-specifier with the options: -notracker[sic], --nobutton, and --noanalog.
The reporting interval can be changed with the --reportinterval <seconds>.
FreeVR's vrpntest
The FreeVR VR integration library also provides a sample client program that is useful for confirming the working operation of a VRPN server — vrpntest. The vrpntest program combines many of the features available individually in the VRPN test client examples. For instance, unlike the VRPN vrpn_print_devices, vrpntest does not require foreknowledge of what devices are provided by a server, but will request a full list of all known devices, and report the inputs from all of them.
By default vrpntest will read from a VRPN server on the local system (localhost), but an alternate hostname can be provided. Also, vrpntest can output in a curses-style full-terminal layout with an enhanced represenation of position trackers and valuator inputs with the -screen option:
% vrpntest [vrpnhost]
% vrpntest -screen [vrpnhost]
The VRPN Protocol
In modern VRPN distributions, the file "Format_Of_Protocol.txt" contains the basic description of the VRPN protocol. (In the past the file was named simply "format" which made it near-impossible to find if you didn't already know the name of the file!) The contents of that file are primarily about the general header format and the opening handshake sequence, but really say nothing about the messages containing actual input/tracking data between the client and the server, so the rest of the protocol was left as "an exercise for the reader."
The information in this Wiki page is a combination of information from that protocol description file and empirical exploration (which might have included exploring the source code as well).
The VRPN handshake connection sequence
- Server starts and opens a TCP socket for listening on port 3883 (by default)
- VRPN client connects to TCP port 3883
- Introductory messages ("cookies") are exchanged (basically simultaneously):
- Server sends a "cookie" with it's version number and logging status
- Client sends a "cookie" with it's version number and logging status
- VRPN version numbers are compared for compatibility
- If either peer indicates logging should be done, a message is sent
- Server and client both open UDP sockets
- (I think this is not done when "tcp:" is specified.)
- Server and client both send udp_description messages
- (I think this is not done when "tcp:" is specified.)
- Server and client both send sender_description messages for all senders registered locally
- (This provides a mapping between ASCII device description names to integer numbers)
- (It isn't clear what benefit there is in having the client send what it wants to the server — the server only cares if it was compiled with the "vrpn_FILTER_MESSAGES" flag, which it never is!)
- Server and client both send type_description messages for all types registered locally
- (This provides a mapping between ASCII information type names to integer numbers)
- (It isn't clear what benefit there is in having the client send what it wants to the server — the server doesn't care!)
The VRPN "Cookie" Format
The "cookie" string is 24 characters long and contains the ASCII string:
vrpn: ver. XX.YY L\0\0\0\0\0
where:
- XX = major version number ("07" as of this writing)
- YY = minor version number ("34" as of this writing)
- L = remote log mode requested ("0", "1", "2", or "3")
Specific VRPN Message Packets
(TODO: This section still needs to be written. In the meantime, the top-comments contained in the source file vr_output.vrpn.c of the FreeVR VR integration library toolkit describe all the key message package types — at least those needed for a standard VR system.)
Known Bugs and Oddities
This list of things to watch out for are not necessarily bugs, but also things that just seem odd (and maybe it will be mostly the latter):
- When unknown devices are requested by a client, the vrpn_server will remember these as though they are known devices and will report them in the future when sending all the known device names.
- The protocol for SENDER_DESCRIPTION and TYPE_DESCRIPTION messages includes sending the length of the string as a separate value, but this is redundant with the "Total Length" value in the header, so wasn't necessary. (Too late now though.)