Reading Sensor Data from JVKCave & VKCave

Both JVKCave and VKCave support the retrieval of sensor data that can come in the form of the tracked sensors (TrackD) or a normal gamepad or joystick the Reflex Studio have. This documentation is meant as an aid to understanding what the return values of the sensors mean and how they can be used and hence applicable to both JVKCave and VKCave applications.

In keeping with the philosophy of JVKCave and VKCave, programs based on these applications can be designed away from the Reflex Studio on normal hardware and without any modification will run directly on the Reflex specific hardware. To that end, when any program is run on a platform and either of the input devices requested are absent, JVKCave and VKCave will automatically detect this and provide simulated support for the sensors via keyboard entry.

Sensor Configuration

The sensor configuration built into JVKCave and VKCave is as follows:
Sensor 1 - Head tracking sensor
Sensor 2 - Wand tracking sensor
Sensor 3 - Left glove tracking sensor
Sensor 4 - Right glove tracker sensor
Sensor 5 - Input from gamepad or joystick

The tracking sensors (1 - 4) can only be initialised all together using the TRACKD constant in the InitInputDevice() method while the gamepad can be initialised independently using the GAMEPAD constant in the same method. If you wish to have all 5 sensors active you should call InitInputDevice() once with the combination of these fields (i.e. InitInputDevice(GAMEPAD|TRACKD) ). This is demonstrated in the example tracking demos provided.

Each sensor has the following data members that can be queried once the data is updated within your program using the GetDeviceData() method.
3D absolute position - X, Y, Z
3D absolute angle - X, Y, Z
3D current speed - X, Y, Z
Current button press state.

Both the position and speed are mapped to be within the range of -1 and +1 while the angle has no range and is stored in a decimal degree value (as opposed to radians). The button presses are an array of 128 bytes where each slot represents a button. If the button is down, the corresponding array slot will be non-zero.

The speed value of the tracked sensors relate to Valuator on the wand (the little joystick thingy) while the button pressed relate to either the buttons on the wand or the pinch glove contacts depending on the TrackD session you start on the Reflex machines. It should be noted that the buttons presses will only appear on the corresponding sensor - i.e. the head sensor will never show any buttons, the wand buttons relate to the buttons on the wand and the glove sensors report the status of finger presses. This is a change to the original version of the sensor input routine where the buttons were duplicated across all the sensors.

The sensor data for the gamepad should be interoperated slightly differently to the tracked sensors. Since the gamepad is not tracked, there is no true concept of absolute position and angle therefore these values are more pseduo ones generated by the device input. Similar to the wand, the speed component of the gamepad sensor represents the analogue value of the joystick position and using this value, a position is calculated based upon the current pseduo position, the current pseduo angle, the update speed and the current gamepad speed. This gives the ability to have the gamepad simulate any position and orientation in the allowable 3D space so that this information can be read in much the same way as the tracked sensors. The angle values are updated using the joystick of the gamepad (similar to position) however with a predefined button held down (the default button is the first one however this can be changed using the corresponding method).

Keyboard Simulation

If one or more of the devices that you wish to initialise is not present, JVKCave and VKCave will automatically detect this and allow you to simulate the input device using the keyboard. The following key mappings are used:
Arrow Left & Arrow Right - Move x
Home & End - Move y
Arrow Up & Arrow Down - Move z
"," & "." - Rotate x
S & X - Rotate y
A & Z - Rotate z
0, 1, 2, 3, 4, 5, 6, 7, 8, 9 - Buttons

The following function keys are used to specify which sensor the above key mappings relate to:
F1 - Sensor 1 (head tracking sensor)
F2 - Sensor 2 (wand tracking sensor)
F3 - Sensor 3 (left glove tracking sensor)
F4 - Sensor 4 (right glove tracking sensor)
F5 - Sensor 5 (gamepad)

Sensor Orientation

The following diagram illustrate the global axes with respect to the Reflex Studio set up:

Sensor Global Axis of the Reflex Studio