From 73686b340b99ef2bce4fa85c0b97aff69a7ba9e7 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Wed, 13 Mar 2024 18:52:26 +0100 Subject: [PATCH] a/bindings,xrt: Add touch pro controller Part-of: --- CMakeLists.txt | 3 + scripts/generate_oxr_ext_support.py | 1 + src/xrt/auxiliary/bindings/bindings.json | 366 ++++++++++++++++++ .../include/xrt/xrt_config_build.h.cmake_in | 1 + src/xrt/include/xrt/xrt_defines.h | 34 +- .../oxr/oxr_extension_support.h | 12 + 6 files changed, 416 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd3a81256..68e3aa88c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -416,6 +416,9 @@ endif() if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_FB_PROXIMITY) set(XRT_FEATURE_OPENXR_INTERACTION_FB_PROXIMITY ON) endif() +if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PRO) + set(XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PRO ON) +endif() # Defaults for OpenXR layer support if(NOT DEFINED XRT_FEATURE_OPENXR_LAYER_DEPTH) diff --git a/scripts/generate_oxr_ext_support.py b/scripts/generate_oxr_ext_support.py index 711a76b88..893f30d66 100755 --- a/scripts/generate_oxr_ext_support.py +++ b/scripts/generate_oxr_ext_support.py @@ -74,6 +74,7 @@ EXTENSIONS = ( ['XR_FB_composition_layer_depth_test', 'XRT_FEATURE_OPENXR_LAYER_FB_DEPTH_TEST'], ['XR_FB_display_refresh_rate', 'XRT_FEATURE_OPENXR_DISPLAY_REFRESH_RATE'], ['XR_FB_passthrough', 'XRT_FEATURE_OPENXR_LAYER_PASSTHROUGH'], + ['XR_FB_touch_controller_pro', 'XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PRO'], ['XR_FB_touch_controller_proximity', 'XRT_FEATURE_OPENXR_INTERACTION_FB_PROXIMITY'], ['XR_HTC_facial_tracking', 'XRT_FEATURE_OPENXR_FACIAL_TRACKING_HTC'], ['XR_ML_ml2_controller_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_ML2'], diff --git a/src/xrt/auxiliary/bindings/bindings.json b/src/xrt/auxiliary/bindings/bindings.json index 8d8c5e080..14737e614 100644 --- a/src/xrt/auxiliary/bindings/bindings.json +++ b/src/xrt/auxiliary/bindings/bindings.json @@ -2499,6 +2499,372 @@ } } } + }, + + "/interaction_profiles/facebook/touch_controller_pro": { + "title": "Meta Quest Touch Pro Controller", + "type": "tracked_controller", + "extension": "XR_FB_touch_controller_pro", + "steamvr_controllertype": "oculus_touch", + "monado_device": "XRT_DEVICE_TOUCH_PRO_CONTROLLER", + "extended_by": ["ext/palm_pose", "grip_surface", "ext/hand_interaction_poses"], + "subaction_paths": [ + "/user/hand/left", + "/user/hand/right" + ], + "subpaths": { + "/input/x": { + "type": "button", + "localized_name": "X", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_X_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_X_TOUCH" + } + }, + "/input/y": { + "type": "button", + "localized_name": "Y", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_Y_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_Y_TOUCH" + } + }, + "/input/menu": { + "type": "button", + "localized_name": "Menu", + "components": ["click"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_MENU_CLICK" + } + }, + "/input/a": { + "type": "button", + "localized_name": "A", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_A_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_A_TOUCH" + } + }, + "/input/b": { + "type": "button", + "localized_name": "B", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_B_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_B_TOUCH" + } + }, + "/input/system": { + "type": "button", + "localized_name": "System", + "components": ["click"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_SYSTEM_CLICK" + } + }, + "/input/squeeze": { + "type": "trigger", + "localized_name": "Squeeze", + "components": ["value"], + "monado_bindings": { + "value": "XRT_INPUT_TOUCH_PRO_SQUEEZE_VALUE" + } + }, + "/input/trigger": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["touch", "value", "curl_fb", "slide_fb", "proximity_fb"], + "monado_bindings": { + "touch": "XRT_INPUT_TOUCH_PRO_TRIGGER_TOUCH", + "value": "XRT_INPUT_TOUCH_PRO_TRIGGER_VALUE", + "curl": "XRT_INPUT_TOUCH_PRO_TRIGGER_CURL", + "slide": "XRT_INPUT_TOUCH_PRO_TRIGGER_SLIDE", + "proximity": "XRT_INPUT_TOUCH_PRO_TRIGGER_PROXIMITY" + } + }, + "/input/thumbstick": { + "type": "joystick", + "localized_name": "Thumbstick", + "components": ["click", "touch", "position"], + "dpad_emulation": { + "position": "position", + "center": false + }, + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_THUMBSTICK_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_THUMBSTICK_TOUCH", + "position": "XRT_INPUT_TOUCH_PRO_THUMBSTICK" + } + }, + "/input/thumbrest": { + "type": "button", + "localized_name": "Thumb Rest", + "components": ["touch", "force"], + "monado_bindings": { + "touch": "XRT_INPUT_TOUCH_PRO_THUMBREST_TOUCH", + "force": "XRT_INPUT_TOUCH_PRO_THUMBREST_FORCE" + } + }, + "/input/stylus_fb": { + "type": "button", + "localized_name": "Stylus", + "components": ["force"], + "monado_bindings": { + "force": "XRT_INPUT_TOUCH_PRO_STYLUS_FORCE" + } + }, + "/input/thumb_fb": { + "type": "button", + "localized_name": "Thumb", + "components": ["proximity_fb"], + "monado_bindings": { + "force": "XRT_INPUT_TOUCH_PRO_THUMB_PROXIMITY" + } + }, + "/input/grip": { + "type": "pose", + "localized_name": "Grip", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_TOUCH_PRO_GRIP_POSE" + } + }, + "/input/aim": { + "type": "pose", + "localized_name": "Aim", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_TOUCH_PRO_AIM_POSE" + } + }, + "/output/haptic": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC" + } + }, + "/output/haptic_trigger_fb": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER" + } + }, + "/output/haptic_thumb_fb": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB" + } + } + } + }, + + "/interaction_profiles/meta/touch_pro_controller": { + "title": "Meta Touch Pro Controller", + "type": "tracked_controller", + "openxr_version": { + "promoted": { + "major": "1", + "minor": "1" + } + }, + "steamvr_controllertype": "oculus_touch", + "monado_device": "XRT_DEVICE_TOUCH_PRO_CONTROLLER", + "extended_by": ["ext/palm_pose", "grip_surface", "ext/hand_interaction_poses"], + "subaction_paths": [ + "/user/hand/left", + "/user/hand/right" + ], + "subpaths": { + "/input/x": { + "type": "button", + "localized_name": "X", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_X_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_X_TOUCH" + } + }, + "/input/y": { + "type": "button", + "localized_name": "Y", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_Y_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_Y_TOUCH" + } + }, + "/input/menu": { + "type": "button", + "localized_name": "Menu", + "components": ["click"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_MENU_CLICK" + } + }, + "/input/a": { + "type": "button", + "localized_name": "A", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_A_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_A_TOUCH" + } + }, + "/input/b": { + "type": "button", + "localized_name": "B", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_B_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_B_TOUCH" + } + }, + "/input/system": { + "type": "button", + "localized_name": "System", + "components": ["click"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_SYSTEM_CLICK" + } + }, + "/input/squeeze": { + "type": "trigger", + "localized_name": "Squeeze", + "components": ["value"], + "monado_bindings": { + "value": "XRT_INPUT_TOUCH_PRO_SQUEEZE_VALUE" + } + }, + "/input/trigger": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["touch", "value", "proximity"], + "monado_bindings": { + "touch": "XRT_INPUT_TOUCH_PRO_TRIGGER_TOUCH", + "value": "XRT_INPUT_TOUCH_PRO_TRIGGER_VALUE", + "curl": "XRT_INPUT_TOUCH_PRO_TRIGGER_CURL", + "slide": "XRT_INPUT_TOUCH_PRO_TRIGGER_SLIDE", + "proximity": "XRT_INPUT_TOUCH_PRO_TRIGGER_PROXIMITY" + } + }, + "/input/trigger_curl": { + "type": "trigger", + "localized_name": "Trigger Curl", + "components": ["value"], + "monado_bindings": { + "value": "XRT_INPUT_TOUCH_PRO_TRIGGER_CURL" + } + }, + "/input/trigger_slide": { + "type": "trigger", + "localized_name": "Trigger Slide", + "components": ["value"], + "monado_bindings": { + "value": "XRT_INPUT_TOUCH_PRO_TRIGGER_SLIDE" + } + }, + + "/input/thumbstick": { + "type": "joystick", + "localized_name": "Thumbstick", + "components": ["click", "touch", "position"], + "dpad_emulation": { + "position": "position", + "center": false + }, + "monado_bindings": { + "click": "XRT_INPUT_TOUCH_PRO_THUMBSTICK_CLICK", + "touch": "XRT_INPUT_TOUCH_PRO_THUMBSTICK_TOUCH", + "position": "XRT_INPUT_TOUCH_PRO_THUMBSTICK" + } + }, + "/input/thumbrest": { + "type": "button", + "localized_name": "Thumb Rest", + "components": ["touch", "force"], + "monado_bindings": { + "touch": "XRT_INPUT_TOUCH_PRO_THUMBREST_TOUCH", + "force": "XRT_INPUT_TOUCH_PRO_THUMBREST_FORCE" + } + }, + "/input/stylus": { + "type": "button", + "localized_name": "Stylus", + "components": ["force"], + "monado_bindings": { + "force": "XRT_INPUT_TOUCH_PRO_STYLUS_FORCE" + } + }, + "/input/thumb_resting_surfaces": { + "type": "button", + "localized_name": "Thumb", + "components": ["proximity"], + "monado_bindings": { + "force": "XRT_INPUT_TOUCH_PRO_THUMB_PROXIMITY" + } + }, + "/input/grip": { + "type": "pose", + "localized_name": "Grip", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_TOUCH_PRO_GRIP_POSE" + } + }, + "/input/aim": { + "type": "pose", + "localized_name": "Aim", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_TOUCH_PRO_AIM_POSE" + } + }, + "/output/haptic": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC" + } + }, + "/output/haptic_trigger": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER" + } + }, + "/output/haptic_thumb": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB" + } + } + } } diff --git a/src/xrt/include/xrt/xrt_config_build.h.cmake_in b/src/xrt/include/xrt/xrt_config_build.h.cmake_in index 180db451f..fd608ae9e 100644 --- a/src/xrt/include/xrt/xrt_config_build.h.cmake_in +++ b/src/xrt/include/xrt/xrt_config_build.h.cmake_in @@ -47,6 +47,7 @@ #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_VIVE_COSMOS #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_VIVE_FOCUS3 #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_FB_PROXIMITY +#cmakedefine XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PRO #cmakedefine XRT_FEATURE_OPENXR_LAYER_COLOR_SCALE_BIAS #cmakedefine XRT_FEATURE_OPENXR_LAYER_CUBE #cmakedefine XRT_FEATURE_OPENXR_LAYER_CYLINDER diff --git a/src/xrt/include/xrt/xrt_defines.h b/src/xrt/include/xrt/xrt_defines.h index c17e767be..6e086268c 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -766,6 +766,8 @@ enum xrt_device_name XRT_DEVICE_VIVE_COSMOS_CONTROLLER, XRT_DEVICE_VIVE_FOCUS3_CONTROLLER, + + XRT_DEVICE_TOUCH_PRO_CONTROLLER, }; /*! @@ -1223,7 +1225,33 @@ enum xrt_input_type _(XRT_INPUT_VIVE_FOCUS3_THUMBSTICK , XRT_INPUT_NAME(0x0C0E, VEC2_MINUS_ONE_TO_ONE)) \ _(XRT_INPUT_VIVE_FOCUS3_THUMBREST_TOUCH , XRT_INPUT_NAME(0x0C0F, BOOLEAN)) \ _(XRT_INPUT_VIVE_FOCUS3_GRIP_POSE , XRT_INPUT_NAME(0x0C10, POSE)) \ - _(XRT_INPUT_VIVE_FOCUS3_AIM_POSE , XRT_INPUT_NAME(0x0C11, POSE)) + _(XRT_INPUT_VIVE_FOCUS3_AIM_POSE , XRT_INPUT_NAME(0x0C11, POSE)) \ +\ + _(XRT_INPUT_TOUCH_PRO_X_CLICK , XRT_INPUT_NAME(0x0D00, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_X_TOUCH , XRT_INPUT_NAME(0x0D01, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_Y_CLICK , XRT_INPUT_NAME(0x0D02, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_Y_TOUCH , XRT_INPUT_NAME(0x0D03, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_MENU_CLICK , XRT_INPUT_NAME(0x0D04, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_A_CLICK , XRT_INPUT_NAME(0x0D05, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_A_TOUCH , XRT_INPUT_NAME(0x0D06, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_B_CLICK , XRT_INPUT_NAME(0x0D07, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_B_TOUCH , XRT_INPUT_NAME(0x0D08, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_SYSTEM_CLICK , XRT_INPUT_NAME(0x0D09, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_SQUEEZE_VALUE , XRT_INPUT_NAME(0x0D0A, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PRO_TRIGGER_TOUCH , XRT_INPUT_NAME(0x0D0B, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_TRIGGER_VALUE , XRT_INPUT_NAME(0x0D0C, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PRO_THUMBSTICK_CLICK , XRT_INPUT_NAME(0x0D0D, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_THUMBSTICK_TOUCH , XRT_INPUT_NAME(0x0D0E, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_THUMBSTICK , XRT_INPUT_NAME(0x0D0F, VEC2_MINUS_ONE_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PRO_THUMBREST_TOUCH , XRT_INPUT_NAME(0x0D10, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_THUMBREST_FORCE , XRT_INPUT_NAME(0x0D11, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PRO_GRIP_POSE , XRT_INPUT_NAME(0x0D12, POSE)) \ + _(XRT_INPUT_TOUCH_PRO_AIM_POSE , XRT_INPUT_NAME(0x0D13, POSE)) \ + _(XRT_INPUT_TOUCH_PRO_TRIGGER_PROXIMITY , XRT_INPUT_NAME(0x0D14, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_THUMB_PROXIMITY , XRT_INPUT_NAME(0x0D15, BOOLEAN)) \ + _(XRT_INPUT_TOUCH_PRO_TRIGGER_CURL , XRT_INPUT_NAME(0x0D16, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PRO_TRIGGER_SLIDE , XRT_INPUT_NAME(0x0D17, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_TOUCH_PRO_STYLUS_FORCE , XRT_INPUT_NAME(0x0D18, VEC1_ZERO_TO_ONE)) // clang-format on @@ -1665,6 +1693,10 @@ enum xrt_output_name XRT_OUTPUT_NAME_VIVE_COSMOS_HAPTIC = XRT_OUTPUT_NAME(0x0200, VIBRATION), XRT_OUTPUT_NAME_VIVE_FOCUS3_HAPTIC = XRT_OUTPUT_NAME(0x0300, VIBRATION), + + XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC = XRT_OUTPUT_NAME(0x0400, VIBRATION), + XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_TRIGGER = XRT_OUTPUT_NAME(0x0500, VIBRATION), + XRT_OUTPUT_NAME_TOUCH_PRO_HAPTIC_THUMB = XRT_OUTPUT_NAME(0x0600, VIBRATION), // clang-format on }; diff --git a/src/xrt/state_trackers/oxr/oxr_extension_support.h b/src/xrt/state_trackers/oxr/oxr_extension_support.h index 6139141b6..c186b4b11 100644 --- a/src/xrt/state_trackers/oxr/oxr_extension_support.h +++ b/src/xrt/state_trackers/oxr/oxr_extension_support.h @@ -486,6 +486,17 @@ #endif +/* + * XR_FB_touch_controller_pro + */ +#if defined(XR_FB_touch_controller_pro) && defined(XRT_FEATURE_OPENXR_INTERACTION_TOUCH_PRO) +#define OXR_HAVE_FB_touch_controller_pro +#define OXR_EXTENSION_SUPPORT_FB_touch_controller_pro(_) _(FB_touch_controller_pro, FB_TOUCH_CONTROLLER_PRO) +#else +#define OXR_EXTENSION_SUPPORT_FB_touch_controller_pro(_) +#endif + + /* * XR_FB_touch_controller_proximity */ @@ -756,6 +767,7 @@ OXR_EXTENSION_SUPPORT_FB_composition_layer_depth_test(_) \ OXR_EXTENSION_SUPPORT_FB_display_refresh_rate(_) \ OXR_EXTENSION_SUPPORT_FB_passthrough(_) \ + OXR_EXTENSION_SUPPORT_FB_touch_controller_pro(_) \ OXR_EXTENSION_SUPPORT_FB_touch_controller_proximity(_) \ OXR_EXTENSION_SUPPORT_HTC_facial_tracking(_) \ OXR_EXTENSION_SUPPORT_ML_ml2_controller_interaction(_) \