Aller au contenu

Working with VRPN

A documentary section presenting VRPN is available here.

Standard Repository / Vicon

A VRPN server can propose to send data according to a different axis system than the one used in VRmaze. VRmaze offers a possibility to modify on the fly the received coordinates when the sending coordinate system does not match the one used in Unity/VRmaze. The datum can be Standard (no conversion) or Vicon (axis inversion). Here is the code integrated and available in the VRPN tracking script:


    public static class VRPN
    { 
        ...
        // VRPN data acquisition code 

        public static Vector3 vrpnTrackerPos(string address, int channel)
        {
            return new Vector3(
                (float)vrpnTrackerExtern(address, channel, 0, Time.frameCount),
                (float)vrpnTrackerExtern(address, channel, 1, Time.frameCount),
                (float)vrpnTrackerExtern(address, channel, 2, Time.frameCount));
        }

        public static Quaternion vrpnTrackerQuat(string address, int channel)
        {
            return new Quaternion(
                (float)vrpnTrackerExtern(address, channel, 3, Time.frameCount),
                (float)vrpnTrackerExtern(address, channel, 4, Time.frameCount),
                (float)vrpnTrackerExtern(address, channel, 5, Time.frameCount),
                (float)vrpnTrackerExtern(address, channel, 6, Time.frameCount));
        }
    }



    public static class ViconVRPN
    {
        //Code for acquiring VRPN data in a Vicon repository

        public static Vector3 vrpnTrackerPos(string address, int channel)
        {
            var vector = VRPN.vrpnTrackerPos(address, channel);
            return new Vector3(vector.x, vector.z, vector.y);
        }

        public static Quaternion vrpnTrackerQuat(string address, int channel)
        {
            var quaternion = VRPN.vrpnTrackerQuat(address, channel);
            return new Quaternion(quaternion.x, quaternion.z, quaternion.y, -quaternion.w);
        }
    }

Axis inversion

The choice of the reference frame can solve an axis inversion problem, however, when setting up the VRPN server, it is important to define the origin of the reference frame that will be used to express the coordinate system. Indeed, a bad rotation of the axes of the reference frame cannot be corrected by changing the Standard/Vicon reference frame.

Ensure communication

VRmaze offers a display system to check and validate the good connection between the VRPN server and the software. This system only indicates if the communication is established, but will not give any answer in case of an impossible connection.

Displaying information

To display information about VRPN trackers, you need to activate the [Debug] mode(../../ui/preferencesExtended.en.md) of VRmaze.

Communication Impossible

In case the VRPN server cannot be reached, the X,Y,Z positions will have the value -505

Values equal to -505!

In the case of a position value equal to -505, communication is missing between the VRPN server and VRMaze. In this case, it is necessary to proceed in order and to ensure first that the VRPN server is launched. The VRPN server is often provided with an executable named VRPN_print_device which allows you to get the tracking information of a specific object. The command to run is the following, requiring the supply of the address of the object to be tracked in the form object_name@ip_address:

vrpn_print_devices.exe Head@192.168.10.10

Lowercase/shift

VRPN servers are case sensitive and upper and lower case must be respected.

The name of the object and the address of the VRPN server are also required in VRmaze tracking nodes. It is therefore possible to copy the information to check if the VRPN_print_device executable has the same behavior as VRmaze.

If the behavior is different (ie. VRPN_print_device displays the correct values) then we must look at the network and the communication between the two computers, the VRPN server and the computer running VRmaze. Windows provides tools to check the communication, the DOS command ping allows to validate the communication.

A communication validated by the DOS command ping may not be sufficient. Indeed, the VRPN server uses a specific communication port, in this sense, the communication can be blocked either by the installed firewall or by an antivirus software. Disabling these two systems can solve the communication problems.