Commit graph

181 commits

Author SHA1 Message Date
Lubosz Sarnecki 04467942c1 d/vive: Add and use vive_lighthouse from ouvrt. 2020-07-31 13:30:12 +02:00
Lubosz Sarnecki bb7d05a918 d/vive: Print report type names.
Be fault tolerant on unexpected report.
2020-07-31 12:45:47 +02:00
Lubosz Sarnecki c3ba93c1ce d/vive: Poll pulse reports.
Make sensor polling function take processing callback and be more
generic.
2020-07-31 12:45:47 +02:00
Lubosz Sarnecki 2db3b6b218 d/vive: Open and enable watchman on Vive, Vive Pro and Index. 2020-07-31 12:45:13 +02:00
Lubosz Sarnecki cbb1dd82da d/vive: Remove unnesseccary clang-format off. 2020-07-31 12:35:03 +02:00
Ryan Pavlik 4220638afd xrt: use _USE_MATH_DEFINES to make sure M_PI gets defined. 2020-07-17 13:53:39 -05:00
Christoph Haag b073e3dfb9 xrt: Add support for assigned device roles
Abandons the assumption that in oxr_system.xdevs[], index 0 is HMD,
1 is left controller, 2 is right controller.

Now to represent the dynamically assigned roles, oxr_system.role contains
the index for a device in oxr_system.xdevs[] for head, left and right.

This role assignment happens on the client side and currently can not be updated
from the server side.

Also adds an enum that device drivers set indicating allowed assignments
(many controllers are physically designed to be held in a specific hand).

This also adds support for configurations with only a HMD and a right controller.
2020-07-13 18:03:01 +02:00
Christoph Haag 5788fb90a2 drivers: Add rotation/position tracking bool to xdev
xrGetSystemProperties() will return these values to application in XrSystemTrackingProperties
using the xdev assigned to head.
2020-07-13 18:03:01 +02:00
Lubosz Sarnecki 499751e4fa d/vive: Use VIVE_ERROR when vive_device is available. 2020-07-09 14:11:35 +02:00
Lubosz Sarnecki 4d412edaa1 d/vive/protocol: Port to u_logging. 2020-07-09 13:38:07 +02:00
Lubosz Sarnecki dce8da5130 d/vive/controller: Port to u_logging. 2020-07-09 13:38:07 +02:00
Lubosz Sarnecki 5dff60a93d d/vive: Create common header for controller and hmd. 2020-07-09 13:38:07 +02:00
Lubosz Sarnecki dfcff5e806 d/vive/device: Use VIVE_WARN and VIVE_INFO. 2020-07-09 13:38:07 +02:00
Lubosz Sarnecki 7121c260ae d/vive/device: Replace old debug macros with new ones. 2020-07-09 13:38:07 +02:00
Lubosz Sarnecki 7be5efbe82 d/vive/prober: Prettify logging. rename methods. 2020-07-09 13:38:07 +02:00
Lubosz Sarnecki eaea6888a7 d/vive: Port logging to u_logging. 2020-07-09 13:37:58 +02:00
Lubosz Sarnecki fdffbfc68a d/vive/controller: Print spew when receiving lighthouse data. 2020-07-02 19:29:14 +02:00
Lubosz Sarnecki 1071d7a50b d/vive/controller: Uncomment and improve spew prints. 2020-07-02 19:29:14 +02:00
Lubosz Sarnecki d047ce8af4 d/vive/controller: Add Vive tracker gen 2 support. 2020-07-02 19:29:14 +02:00
Lubosz Sarnecki 6662e0caef d/vive/controller: Add Vive tracker gen 1 support. 2020-07-02 19:29:14 +02:00
Lubosz Sarnecki 2fd6fe2f16 d/vive/prober: Print error before device init. 2020-07-02 19:29:14 +02:00
Lubosz Sarnecki 260cfd8d26 d/vive/controller: Use u_json and move config to vive_config.
To be consistent with the headset implementation, move all config
related code to vive_config and use u_json consistently with static
string sizes.
2020-07-02 18:42:42 +02:00
Lubosz Sarnecki 53619fa64e d/vive/controller: Move prober interface to vive_prober.
Create propper initializer for the controller and move the proper
interface to vive_prober to be more consistent with the device. This
will also allow to share more code like the config parsing in a later
patch.
2020-07-02 18:42:42 +02:00
Lubosz Sarnecki f33c6356d7 d/vive: Rename vive_controller files.
To be more consistent with the rest of the driver, rename the controller
files to match the others style.
2020-07-02 18:42:42 +02:00
Lubosz Sarnecki eb51b89e9c d/vive_config: Move config and json related code to vive_config.
Isolate JSON config related code in vive_config.
2020-07-02 18:42:42 +02:00
Lubosz Sarnecki 2580958e2c d/vive: Use functions from u_json.
Uses the old and newly moved u_json functions.
Creates defines to keep short syntax.
Strings are now stored with static sizes in favor of being allocated
dynamically and not freed.
2020-07-02 18:42:42 +02:00
Lubosz Sarnecki bb52a673eb d/vive/controller: Parse vec3 correctly as arrays.
The u_json_get_vec3 function only works for json vec3 objects with x, y,
z members. The function unnoticedly returned false before.
2020-07-02 18:42:42 +02:00
Lubosz Sarnecki efd351f5c1 d/vive/controller: Initialize debug and spew before it's used. 2020-07-02 18:36:21 +02:00
Lubosz Sarnecki f9d92890ce d/vive: Fix crash on Vive Pro as it's missing a json key.
The key "lens_separation" is not available in my Vive Pro config.
2020-07-02 18:35:18 +02:00
Christoph Haag 08c6fe9744 d/vive_controller: Fix imu timestamp calculation
Philipp Zabel looked into it and it turns out the timestamp from the
imu sample should be the third byte, not the fourth.
2020-07-02 11:33:58 +02:00
Christoph Haag acdda780b6 d/vive_controller: implement remaining "gen2" input events
v2: document and clarify imu sample timestamp
2020-07-01 18:36:41 +02:00
Christoph Haag d8de19d4ae d/vive_controller: Add and set Index "Gen2" input names 2020-07-01 18:36:41 +02:00
Ryan Pavlik bc6cc85e7d xrt: Improve doxygen documentation. 2020-06-03 16:28:18 -05:00
Christoph Haag 854272a7d0 d/vive_controller: Don't infinitely loop in device update
This prevented the update thread from being joined and the driver from being destroyed.
2020-05-14 00:25:34 +02:00
Christoph Haag 653ca1d39d d/vive: Declare struct forward declaration as extern
Fixes build with gcc on arch.
2020-05-12 15:38:04 +02:00
Christoph Haag aaa2f0a0bd d/vive_controller: read from usb with timeout
This aligns with the vive HMD driver and fixes high CPU usage.
2020-05-07 21:24:43 +02:00
Christoph Haag dc4dcf15a9 d/vive_controller: Fix left index controller imu
The IMU in the left index controller has a different orientation
than the right one.
2020-05-05 19:50:20 +00:00
Christoph Haag f8b2e179cb d/vive_controller: index controller trackpad: send 0,0 position after release 2020-05-05 14:19:37 +00:00
Christoph Haag a1b6efd16b d/vive_controller: Report zero values for trigger and trackpad
Turns out we actually want to know when theose transition into/over zero.
2020-05-04 21:25:03 +02:00
Christoph Haag d62c2d2011 st/oxr: properly enable binding to /x and /y
Store Thumbstick, Trackpad etc. data internally in a vec2f.
The knowledge that a binding path ../x and ../y refers to the x and y components of this vec2f
is stored as an INPUT_REDIRECT_VEC2_X_TO_VEC1 or INPUT_REDIRECT_VEC2_Y_TO_VEC enum.

Actions now also store the index of the binding paths it matched to,
e.g. when an action binds ../trackpad/y to an input that provides bindings [../trackpad, ../trackpad/x, ../trackpad/y],
the index 2 is stored.

v2: Clarify preferred binding path index variable
2020-05-03 22:58:47 +00:00
Ryan Pavlik ee90eb1d7e d/vive: Fix typos 2020-04-28 16:49:13 -05:00
Ryan Pavlik cb3096128a d/vive: Fix build on Android NDK by switching byte order utilities. 2020-04-28 21:40:57 +00:00
Christoph Haag d4e4a690db d/vive_controller: Add basic 3dof vive_controller_driver
v2: Add basic 3DOF Index Controller support

Only the "gen1" watchman usb protocol is supported (almost same as vive wand).
Note: Lighthouse v2 data is not properly ignored, the IMU data is only parsed correctly
when controller is not hit by lighthouse lasers.

Supported:
* trigger value
* trigger button
* trackpad x, y
* trackpad touch
* thumbstick x, y
* thumbstick click
* system click
* a click,
* b click

Not supported:
* trigger touch
* touchpad force
* thumbstick touch
* system touch
* a touch
* b touch
* grip squeeze
* finger tracking
2020-04-28 10:22:42 +00:00
Christoph Haag e3b74c2e70 d/vive: Fix _json_get_string 2020-04-28 10:22:42 +00:00
Christoph Haag 04ebc42666 d/vive: Make common functions available through vive_protocol.h
Move common code to vive_protocol.c
2020-04-28 10:22:41 +00:00
Jakob Bornecrantz e37d8f4cf5 xrt: Remove timestate from xrt_device interface 2020-04-16 17:29:34 +01:00
Jakob Bornecrantz de20d87f87 xrt: Make it possible for the prober to pass in JSON data to the drivers 2020-04-10 12:29:21 +00:00
Jakob Bornecrantz 99eda56d39 d/vive: Use new 3DOF fusion 2020-03-25 13:58:51 +00:00
Ryan Pavlik 0cb53a8c53 d/vive: Add missing include 2020-03-04 11:15:35 +00:00
Ryan Pavlik 8f0082e810 drivers: Clean up documentation.
Making the Modules page in Doxygen more consistent.
2020-03-02 12:35:49 -06:00
Ryan Pavlik 84dfbf241f d/vive: Fix typo. 2020-01-31 10:47:52 +01:00
Jakob Bornecrantz a48d5bb835 d/vive: Also rotate acceleration 2020-01-24 21:43:32 +00:00
Jakob Bornecrantz 382813edd6 d/vive: Dump JSON config on debug instead of spew 2020-01-14 15:59:41 +00:00
Jakob Bornecrantz 8ded6bac8b d/vive: Extract lighthouse data 2020-01-14 15:59:41 +00:00
Ryan Pavlik ae466ce70e d/vive: Fix typos. 2020-01-09 16:32:18 -06:00
Jakob Bornecrantz b816afce63 d/vive: Extract Index canting parameter from the config 2020-01-09 15:22:14 +00:00
Ryan Pavlik 290bd7937b d/vive: Port to cJSON.
Replacing nxjson because of license issues: upstream of nxjson is LGPL3.
2020-01-09 15:21:04 +00:00
Jakob Bornecrantz d6ca37bc70 d/vive: Set last acc and gyro values 2020-01-09 15:21:04 +00:00
Jakob Bornecrantz 8306e00bd1 d/vive: Apply all axis flip after scale and bias 2020-01-09 15:21:04 +00:00
Jakob Bornecrantz 995ecfaac2 d/vive: Tidy IMU code 2020-01-09 15:21:04 +00:00
Jakob Bornecrantz 4895ab704c d/vive: Tidy and refactor config parsing 2020-01-09 15:21:04 +00:00
Jakob Bornecrantz ba104f59f3 d/vive: Tidy motherboard thread 2019-12-22 14:08:14 +00:00
Jakob Bornecrantz 85197f1584 d/vive: Tidy sensors thread 2019-12-22 14:08:14 +00:00
Jakob Bornecrantz 784b53ded2 d/vive: Spew instead of debug vive_device_update_inputs 2019-12-22 13:35:37 +00:00
Ryan Pavlik c92590930d d/vive: clang-tidy 2019-12-07 18:25:37 +00:00
Ryan Pavlik c9f1b2be4b d/vive: Port realloc to helper macro 2019-12-07 18:24:56 +00:00
Ryan Pavlik e11eb0203f d/vive: Initializer order fix 2019-12-07 18:24:56 +00:00
Ryan Pavlik 282f38ca62 d/vive: Type safety fix 2019-12-07 18:24:52 +00:00
Ryan Pavlik e44dd1a755 d/vive: Use define for standard gravity 2019-11-11 17:57:40 -06:00
Drew DeVault 4c7f830ea5 d/vive: reset orientation on headset button 2019-11-07 09:39:33 -05:00
Jakob Bornecrantz 1f02c54858 d/vive: Fix copy typo 2019-11-07 13:45:56 +00:00
Lubosz Sarnecki 2ffa77d923 d/vive: Handle error when config could not be read. 2019-11-07 14:16:09 +01:00
Lubosz Sarnecki db1e5b9f16 d/vive: Initialize useful defaults.
This initializes default values in the display, distortion and IMU
properties so the runtime is happy in case the JSON config could not be
read.

This patch also moves default value initialization for the Index
into one place with the others, for cases we do not have the data.
2019-11-07 14:16:09 +01:00
Ryan Pavlik 059234bbfc d/vive: Cleanup scopes, types, leak in vive_sensors_read_config 2019-11-01 22:41:22 +00:00
Drew DeVault 6bce0838e0 d/vive: Fix minor typo in vive driver 2019-11-01 14:35:41 +00:00
Jakob Bornecrantz aa52da072f xrt: Remove relation input type 2019-10-24 21:51:07 +01:00
Jakob Bornecrantz 35ae8f31ce d/vive: Add some variable tracking 2019-10-22 18:52:52 +01:00
Lubosz Sarnecki 5becb60714 d/vive: Use different device string for each variant. 2019-10-22 19:18:47 +02:00
Lubosz Sarnecki 02dc839ca8 d/vive: Add initial support for the Valve Index. 2019-10-22 19:18:47 +02:00
Lubosz Sarnecki 2ed3109c95 d/vive: Add initial support for Vive Pro. 2019-10-22 19:18:47 +02:00
Lubosz Sarnecki e063e8245e d/vive: Add native driver for the Vive.
This adds a driver for the Vive family of devices based on Philipp
Zabel's ouvrt.
The driver currently only handles the IMU and main board report streams,
but is able to acquire the JSON configuration and utilize it for IMU
calibration as well as distortion configuration.
2019-10-22 19:18:47 +02:00