Lighthouse — A How-to document for interfacing Vive Lighthouse tracking with FreeVR
The Vive Lighthouse ...
NOTE: Presently all the methods presented are for use with the Linux operating system. As methods are ascertained
Each of the following subsections provide instructions on how each of the interfaces listed above can be used to accomplish Wiimote interaction with FreeVR.
The Vrui toolsuite includes the RunViveTracker.sh shell script.
For CAVE-style VR, we don't have an HMD, so the Vrui interface to Lighthouse tracking was altered to allow a non-HMD version.
% /home/wrs1/local/bin/RunViveTrackerNoHMD.sh VRDeviceDaemon: Reading configuration file VRDeviceDaemon: Initializing device manager VRDeviceManager: Loading device Vive of type OpenVRHost VRDeviceManager: Managing 4 trackers, 14 buttons, 6 valuators VRDeviceManager: Managing 4 virtual devices VRDeviceManager: Initializing 1 device driver modules VRDeviceDaemon: Initializing device server VRDeviceServer: Listening for incoming connections on TCP port 8555
After this, there will be various updates on the status of the tracker devices, including the battery levels.
NOTE: there will be many lines that report:
ioctl (SFEATURE): Broken pipethese can be safely ignored.
The Vrui system reports values in the unit of meters. So to convert those values to feet, multiply (scale) by 3.28.
For example:
# Button mappings:
For configuration on the FreeVR side, there is a difference as to
control "print_struct" = "2switch(key[Home])"; input "2switch[1]" = "2switch(key[Prog1])";
Thus, both of the following will work:
input "2switch[2]" = "2switch(button[A])"; input "2switch[3]" = "2switch(key[Btn:B])";
And for valuators:
input "wii-roll" = "valuator(abs[X])"; input "wii-elev" = "valuator(abs[Y])";
# export PYTHONPATH=<...>/python/build/lib.linux-x86_64-2.6
First, find it's input id:
% xinput list --short | grep Wiimote Nintendo Wiimote id=10 [slave keyboard (3)]
The next step is determine the property number for the "Device Enabled property of the input device with the id above (e.g. "10" in this example):
% xinput list-props 10 | grep "Device Enabled" Device Enabled (117): 1
With the id ("10") and enable/disable property code ("117"), the device's effect on the X11 input system can now be turned off. The command to change a property also takes arguments for the number of bits of the datum as well as the value. As the enable/disable flag only requires one byte (which is in effect the minimum), the command is (along with verification):
% xinput set-int-prop 10 117 8 0 % xinput list-props 10 | grep "Device Enabled" Device Enabled (117): 0
VRPN is not generally included with Linux distributions, but it is easy to download and compile.
Enabling the basic "WiiMote" input is straightforward:
% cat wiimote_vrpn.cfg vrpn_WiiMote WiiMote0 1 0 0 1 % vrpn_server -f wiimote_vrpn.cfg
There is also a tracking form of VRPN interface with the WiiMote which involves the use of the IR sensor information along with some post-processing (all handled within VRPN):
% cat wiimote_vrpn.cfg vrpn_WiiMote WiiMote0 1 1 1 1 vrpn_Tracker_WiimoteHead Tracker0 WiiMote0@localhost % vrpn_server -f wiimote_vrpn.cfgNOTE: that the middle two flags ("useMotionSensing" and "useIR") must be enabled to create tracking output.
Here are the VRPN configuration arguments for the two input types:
for vrpn_WiiMote: 1) name_of_this_device (string) 2) Player number (int) 3) Use motion Sensing (bool/int) — from the base Wiimote, not motion sensor 4) Use IR tracking (bool/int) 5) Reorder the buttons (bool/int) 6) [optional] Bluetooth address — provided in all uppercase with colons for vrpn_Tracker_WiimoteHead 1) name_of_this_device (string) 2) name_of_vrpn_WiiMote_device (string) 3) [optional] min_update_rate (default=60) (float) [Hz] 4) [optional] led_distance (default=0.205) (float) [meters]On the FreeVR side, these can be mapped into inputs with configuration settings similar to:
input "2switch[A]" = "2switch(WiiMote0:button[1])"; input "2switch[B]" = "2switch(WiiMote0:button[2])"; input "2switch[3]" = "2switch(WiiMote0:button[3])"; input "val[x]" = "Valuator(WiiMote0:analog[ 1])"; # roll/twist input "val[y]" = "Valuator(WiiMote0:analog[-2])"; # pitch/elevation input "val[u]" = "Valuator(WiiMote0:analog[ 3])"; # right-side-upidness input "val[b]" = "Valuator(WiiMote0:analog[ 0])"; # battery level input "wand2" = "6sensor(Tracker0:tracker[0])";
NOTE: Analog values 1 and 3 are specifically the ...
The Vrui "VRDeviceDaemon" server can handle a variety of input devices, much like VRPN. And the Nintendo Wii™ remote is one input device it can handle.
In fact it is fairly straightforward. The only real requirement is that the Vrui system be compiled with the Bluetooth feature enabled.
Once Vrui is compiled, a "VRDevices.cfg" configuration file for the VRDeviceDaemon program must be created. To collect button and valuator inputs only (valuators with an attached Nunchuk of course), use this configuration (replacing the hostname with the correct value):
section "<hostname>" section DeviceManager deviceNames (Wiimote1) section Wiimote1 deviceType WiimoteTracker # Set this to the Bluetooth ID of the Wiimote devicename "00:24:1E:7A:CC:2D" # Set the LED pattern for this Wiimote (any 4-bit value) ledMask 1 # Disable motion tracking using the Wiimote's camera enableTracker false endsection endsection endsection
and then run the Vrui VRDeviceDaemon:
% bin/VRDeviceDaemon VRDeviceDaemon: Reading configuration file VRDeviceDaemon: Initializing device manager VRDeviceManager: Loading device Wiimote1 of type WiimoteTracker WiimoteTracker: Connecting to first compatible Bluetooth device. WiimoteTracker: Please press buttons 1 and 2 to initiate connection... done WiimoteTracker: Connected wiimote's battery level is 145% VRDeviceManager: Managing 0 trackers, 13 buttons, 2 valuators VRDeviceManager: Managing 0 virtual devices VRDeviceDaemon: Initializing device server VRDeviceServer: Waiting for client connection
In another shell, the inputs can be tested with the FreeVR "vruiddtest" program:
% ./vruiddtest
For position tracking, there are a handful of additional options that must be specified. However, position tracking with the Vrui system only works with physical LED configurations that have four LED markers rather than the customary two. So this system does not work with the standard Wii sensor bar.
The additional configuration options are:
cameraCenter (512, 384) cameraFocalLength 1280 targetPoints ((-2.0, 0.0, 0.0), (0.0, -1.0, 2.0), (2.0, 0.0, 0.0), (0.0, -1.0, -2.0)) targetTransformation identity homeTransform identity
xinput(1), wminput(1), eviotest(1fv)
The sample FreeVR configuration file for VRPN:
Web sites:
Video:
https://www.youtube.com/watch?v=Jd3-eiid-Uw
Copyright 2022, Bill Sherman, All rights reserved.