From f2e1fdb26c1ac6fde59f6cc4018b226ea379c238 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Thu, 29 Feb 2024 02:35:03 +0100 Subject: [PATCH] a/bindings,xrt: Add pico neo3, 4, g3 controllers Part-of: --- CMakeLists.txt | 3 + scripts/generate_oxr_ext_support.py | 1 + src/xrt/auxiliary/bindings/bindings.json | 335 ++++++++++++++++++ .../include/xrt/xrt_config_build.h.cmake_in | 1 + src/xrt/include/xrt/xrt_defines.h | 61 +++- .../oxr/oxr_extension_support.h | 12 + 6 files changed, 412 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 28c42ff05..a7ec624f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -404,6 +404,9 @@ endif() if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_WINMR) set(XRT_FEATURE_OPENXR_INTERACTION_WINMR ON) endif() +if(NOT DEFINED XRT_FEATURE_OPENXR_INTERACTION_BYTEDANCE) + set(XRT_FEATURE_OPENXR_INTERACTION_BYTEDANCE 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 705e98603..a97c1e12f 100755 --- a/scripts/generate_oxr_ext_support.py +++ b/scripts/generate_oxr_ext_support.py @@ -66,6 +66,7 @@ EXTENSIONS = ( ['XR_EXT_palm_pose', 'XRT_FEATURE_OPENXR_INTERACTION_EXT_PALM_POSE'], ['XR_EXT_performance_settings', 'XRT_FEATURE_OPENXR_PERFORMANCE_SETTINGS'], ['XR_EXT_samsung_odyssey_controller', 'XRT_FEATURE_OPENXR_INTERACTION_WINMR'], + ['XR_BD_controller_interaction', 'XRT_FEATURE_OPENXR_INTERACTION_BYTEDANCE'], ['XR_FB_body_tracking', 'XRT_FEATURE_OPENXR_BODY_TRACKING_FB'], ['XR_FB_composition_layer_alpha_blend', 'XRT_FEATURE_OPENXR_LAYER_FB_ALPHA_BLEND'], ['XR_FB_composition_layer_image_layout', 'XRT_FEATURE_OPENXR_LAYER_FB_IMAGE_LAYOUT'], diff --git a/src/xrt/auxiliary/bindings/bindings.json b/src/xrt/auxiliary/bindings/bindings.json index be1ae6b8e..b4c467e4b 100644 --- a/src/xrt/auxiliary/bindings/bindings.json +++ b/src/xrt/auxiliary/bindings/bindings.json @@ -1824,6 +1824,341 @@ } } } + }, + + "/interaction_profiles/bytedance/pico_neo3_controller": { + "title": "Bytedance PICO Neo 3 controller", + "type": "tracked_controller", + "extension": "BD_controller_interaction", + "extended_by": ["ext/palm_pose", "grip_surface", "ext/hand_interaction_poses"], + "openxr_version": { + "promoted": { + "major": "1", + "minor": "1" + } + }, + "monado_device": "XRT_DEVICE_PICO_NEO3_CONTROLLER", + "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_PICO_NEO3_X_CLICK", + "touch": "XRT_INPUT_PICO_NEO3_X_TOUCH" + } + }, + "/input/y": { + "type": "button", + "localized_name": "Y", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_PICO_NEO3_Y_CLICK", + "touch": "XRT_INPUT_PICO_NEO3_Y_TOUCH" + } + }, + "/input/a": { + "type": "button", + "localized_name": "A", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_PICO_NEO3_A_CLICK", + "touch": "XRT_INPUT_PICO_NEO3_A_TOUCH" + } + }, + "/input/b": { + "type": "button", + "localized_name": "B", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_PICO_NEO3_B_CLICK", + "touch": "XRT_INPUT_PICO_NEO3_B_TOUCH" + } + }, + "/input/menu": { + "type": "button", + "localized_name": "Menu", + "components": ["click"], + "monado_bindings": { + "click": "XRT_INPUT_PICO_NEO3_MENU_CLICK" + } + }, + "/input/system": { + "type": "button", + "localized_name": "System", + "components": ["click"], + "monado_bindings": { + "click": "XRT_INPUT_PICO_NEO3_SYSTEM_CLICK" + } + }, + "/input/trigger": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["click", "value", "touch"], + "monado_bindings": { + "click": "XRT_INPUT_PICO_NEO3_TRIGGER_CLICK", + "value": "XRT_INPUT_PICO_NEO3_TRIGGER_VALUE", + "touch": "XRT_INPUT_PICO_NEO3_TRIGGER_TOUCH" + } + }, + "/input/thumbstick": { + "type": "joystick", + "localized_name": "Thumbstick", + "components": ["click", "touch", "position"], + "dpad_emulation": { + "position": "position", + "center": false + }, + "monado_bindings": { + "click": "XRT_INPUT_PICO_NEO3_THUMBSTICK_CLICK", + "touch": "XRT_INPUT_PICO_NEO3_THUMBSTICK_TOUCH", + "position": "XRT_INPUT_PICO_NEO3_THUMBSTICK" + } + }, + "/input/squeeze": { + "type": "trigger", + "localized_name": "Squeeze", + "components": ["click", "value"], + "monado_bindings": { + "click": "XRT_INPUT_PICO_NEO3_SQUEEZE_CLICK", + "value": "XRT_INPUT_PICO_NEO3_SQUEEZE_VALUE" + } + }, + "/input/grip": { + "type": "pose", + "localized_name": "Grip", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_PICO_NEO3_GRIP_POSE" + } + }, + "/input/aim": { + "type": "pose", + "localized_name": "Aim", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_PICO_NEO3_AIM_POSE" + } + }, + "/output/haptic": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_PICO_NEO3_HAPTIC" + } + } + } + }, + + "/interaction_profiles/bytedance/pico4_controller": { + "title": "Bytedance PICO 4 controller", + "type": "tracked_controller", + "extension": "BD_controller_interaction", + "extended_by": ["ext/palm_pose", "grip_surface", "ext/hand_interaction_poses"], + "openxr_version": { + "promoted": { + "major": "1", + "minor": "1" + } + }, + "monado_device": "XRT_DEVICE_PICO4_CONTROLLER", + "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_PICO4_X_CLICK", + "touch": "XRT_INPUT_PICO4_X_TOUCH" + } + }, + "/input/y": { + "type": "button", + "localized_name": "Y", + "components": ["click", "touch"], + "side": "left", + "monado_bindings": { + "click": "XRT_INPUT_PICO4_Y_CLICK", + "touch": "XRT_INPUT_PICO4_Y_TOUCH" + } + }, + "/input/a": { + "type": "button", + "localized_name": "A", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_PICO4_A_CLICK", + "touch": "XRT_INPUT_PICO4_A_TOUCH" + } + }, + "/input/b": { + "type": "button", + "localized_name": "B", + "components": ["click", "touch"], + "side": "right", + "monado_bindings": { + "click": "XRT_INPUT_PICO4_B_CLICK", + "touch": "XRT_INPUT_PICO4_B_TOUCH" + } + }, + "/input/menu": { + "type": "button", + "localized_name": "Menu", + "components": ["click"], + "monado_bindings": { + "click": "XRT_INPUT_PICO4_MENU_CLICK" + } + }, + "/input/system": { + "type": "button", + "localized_name": "System", + "components": ["click"], + "monado_bindings": { + "click": "XRT_INPUT_PICO4_SYSTEM_CLICK" + } + }, + "/input/trigger": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["click", "value", "touch"], + "monado_bindings": { + "click": "XRT_INPUT_PICO4_TRIGGER_CLICK", + "value": "XRT_INPUT_PICO4_TRIGGER_VALUE", + "touch": "XRT_INPUT_PICO4_TRIGGER_TOUCH" + } + }, + "/input/thumbstick": { + "type": "joystick", + "localized_name": "Thumbstick", + "components": ["click", "touch", "position"], + "dpad_emulation": { + "position": "position", + "center": false + }, + "monado_bindings": { + "click": "XRT_INPUT_PICO4_THUMBSTICK_CLICK", + "touch": "XRT_INPUT_PICO4_THUMBSTICK_TOUCH", + "position": "XRT_INPUT_PICO4_THUMBSTICK" + } + }, + "/input/squeeze": { + "type": "trigger", + "localized_name": "Squeeze", + "components": ["click", "value"], + "monado_bindings": { + "click": "XRT_INPUT_PICO4_SQUEEZE_CLICK", + "value": "XRT_INPUT_PICO4_SQUEEZE_VALUE" + } + }, + "/input/grip": { + "type": "pose", + "localized_name": "Grip", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_PICO4_GRIP_POSE" + } + }, + "/input/aim": { + "type": "pose", + "localized_name": "Aim", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_PICO4_AIM_POSE" + } + }, + "/output/haptic": { + "type": "vibration", + "localized_name": "Haptic", + "components": ["haptic"], + "monado_bindings": { + "haptic": "XRT_OUTPUT_NAME_PICO4_HAPTIC" + } + } + } + }, + + "/interaction_profiles/bytedance/pico_g3_controller": { + "title": "Bytedance PICO G3 controller", + "type": "tracked_controller", + "extension": "BD_controller_interaction", + "extended_by": ["ext/palm_pose", "grip_surface", "ext/hand_interaction_poses"], + "openxr_version": { + "promoted": { + "major": "1", + "minor": "1" + } + }, + "monado_device": "XRT_DEVICE_PICO_G3_CONTROLLER", + "subaction_paths": [ + "/user/hand/left", + "/user/hand/right" + ], + "subpaths": { + "/input/menu": { + "type": "button", + "localized_name": "Menu", + "components": ["click"], + "monado_bindings": { + "click": "XRT_INPUT_PICO_G3_MENU_CLICK" + } + }, + "/input/trigger": { + "type": "trigger", + "localized_name": "Trigger", + "components": ["click", "value"], + "monado_bindings": { + "click": "XRT_INPUT_PICO_G3_TRIGGER_CLICK", + "value": "XRT_INPUT_PICO_G3_TRIGGER_VALUE" + } + }, + "/input/thumbstick": { + "type": "joystick", + "localized_name": "Thumbstick", + "components": ["click", "position"], + "dpad_emulation": { + "position": "position", + "center": false + }, + "monado_bindings": { + "click": "XRT_INPUT_PICO_G3_THUMBSTICK_CLICK", + "position": "XRT_INPUT_PICO_G3_THUMBSTICK" + } + }, + "/input/grip": { + "type": "pose", + "localized_name": "Grip", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_PICO_G3_GRIP_POSE" + } + }, + "/input/aim": { + "type": "pose", + "localized_name": "Aim", + "components": ["pose"], + "monado_bindings": { + "pose": "XRT_INPUT_PICO_G3_AIM_POSE" + } + } + } } + + + } } 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 3125796e0..e487df251 100644 --- a/src/xrt/include/xrt/xrt_config_build.h.cmake_in +++ b/src/xrt/include/xrt/xrt_config_build.h.cmake_in @@ -43,6 +43,7 @@ #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_MSFT_HAND #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_OPPO #cmakedefine XRT_FEATURE_OPENXR_INTERACTION_WINMR +#cmakedefine XRT_FEATURE_OPENXR_INTERACTION_BYTEDANCE #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 ea8969199..0e80cc85a 100644 --- a/src/xrt/include/xrt/xrt_defines.h +++ b/src/xrt/include/xrt/xrt_defines.h @@ -758,6 +758,11 @@ enum xrt_device_name //! XR_FB_body_tracking XRT_DEVICE_FB_BODY_TRACKING, + + // added in OpenXR 1.1 + XRT_DEVICE_PICO_NEO3_CONTROLLER, + XRT_DEVICE_PICO4_CONTROLLER, + XRT_DEVICE_PICO_G3_CONTROLLER, }; /*! @@ -1127,7 +1132,58 @@ enum xrt_input_type _(XRT_INPUT_HTC_LIP_FACE_TRACKING , XRT_INPUT_NAME(0x0602, FACE_TRACKING)) \ \ _(XRT_INPUT_GENERIC_BODY_TRACKING , XRT_INPUT_NAME(0x0700, BODY_TRACKING)) \ - _(XRT_INPUT_FB_BODY_TRACKING , XRT_INPUT_NAME(0x0701, BODY_TRACKING)) + _(XRT_INPUT_FB_BODY_TRACKING , XRT_INPUT_NAME(0x0701, BODY_TRACKING)) \ +\ + _(XRT_INPUT_PICO_NEO3_X_CLICK , XRT_INPUT_NAME(0x0800, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_X_TOUCH , XRT_INPUT_NAME(0x0801, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_Y_CLICK , XRT_INPUT_NAME(0x0802, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_Y_TOUCH , XRT_INPUT_NAME(0x0803, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_MENU_CLICK , XRT_INPUT_NAME(0x0804, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_SYSTEM_CLICK , XRT_INPUT_NAME(0x0805, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_TRIGGER_CLICK , XRT_INPUT_NAME(0x0806, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_TRIGGER_VALUE , XRT_INPUT_NAME(0x0807, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_PICO_NEO3_TRIGGER_TOUCH , XRT_INPUT_NAME(0x0808, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_THUMBSTICK_CLICK , XRT_INPUT_NAME(0x0809, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_THUMBSTICK_TOUCH , XRT_INPUT_NAME(0x080A, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_THUMBSTICK , XRT_INPUT_NAME(0x080B, VEC2_MINUS_ONE_TO_ONE)) \ + _(XRT_INPUT_PICO_NEO3_SQUEEZE_CLICK , XRT_INPUT_NAME(0x080C, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_SQUEEZE_VALUE , XRT_INPUT_NAME(0x080D, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_PICO_NEO3_GRIP_POSE , XRT_INPUT_NAME(0x080E, POSE)) \ + _(XRT_INPUT_PICO_NEO3_AIM_POSE , XRT_INPUT_NAME(0x080F, POSE)) \ + _(XRT_INPUT_PICO_NEO3_A_CLICK , XRT_INPUT_NAME(0x0810, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_A_TOUCH , XRT_INPUT_NAME(0x0811, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_B_CLICK , XRT_INPUT_NAME(0x0812, BOOLEAN)) \ + _(XRT_INPUT_PICO_NEO3_B_TOUCH , XRT_INPUT_NAME(0x0813, BOOLEAN)) \ +\ + _(XRT_INPUT_PICO4_X_CLICK , XRT_INPUT_NAME(0x0900, BOOLEAN)) \ + _(XRT_INPUT_PICO4_X_TOUCH , XRT_INPUT_NAME(0x0901, BOOLEAN)) \ + _(XRT_INPUT_PICO4_Y_CLICK , XRT_INPUT_NAME(0x0902, BOOLEAN)) \ + _(XRT_INPUT_PICO4_Y_TOUCH , XRT_INPUT_NAME(0x0903, BOOLEAN)) \ + _(XRT_INPUT_PICO4_SYSTEM_CLICK , XRT_INPUT_NAME(0x0905, BOOLEAN)) \ + _(XRT_INPUT_PICO4_TRIGGER_CLICK , XRT_INPUT_NAME(0x0906, BOOLEAN)) \ + _(XRT_INPUT_PICO4_TRIGGER_VALUE , XRT_INPUT_NAME(0x0907, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_PICO4_TRIGGER_TOUCH , XRT_INPUT_NAME(0x0908, BOOLEAN)) \ + _(XRT_INPUT_PICO4_THUMBSTICK_CLICK , XRT_INPUT_NAME(0x0909, BOOLEAN)) \ + _(XRT_INPUT_PICO4_THUMBSTICK_TOUCH , XRT_INPUT_NAME(0x090A, BOOLEAN)) \ + _(XRT_INPUT_PICO4_THUMBSTICK , XRT_INPUT_NAME(0x090B, VEC2_MINUS_ONE_TO_ONE)) \ + _(XRT_INPUT_PICO4_SQUEEZE_CLICK , XRT_INPUT_NAME(0x090C, BOOLEAN)) \ + _(XRT_INPUT_PICO4_SQUEEZE_VALUE , XRT_INPUT_NAME(0x090D, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_PICO4_GRIP_POSE , XRT_INPUT_NAME(0x090E, POSE)) \ + _(XRT_INPUT_PICO4_AIM_POSE , XRT_INPUT_NAME(0x090F, POSE)) \ + _(XRT_INPUT_PICO4_A_CLICK , XRT_INPUT_NAME(0x0910, BOOLEAN)) \ + _(XRT_INPUT_PICO4_A_TOUCH , XRT_INPUT_NAME(0x0911, BOOLEAN)) \ + _(XRT_INPUT_PICO4_B_CLICK , XRT_INPUT_NAME(0x0912, BOOLEAN)) \ + _(XRT_INPUT_PICO4_B_TOUCH , XRT_INPUT_NAME(0x0913, BOOLEAN)) \ + _(XRT_INPUT_PICO4_MENU_CLICK , XRT_INPUT_NAME(0x0914, BOOLEAN)) \ +\ + _(XRT_INPUT_PICO_G3_MENU_CLICK , XRT_INPUT_NAME(0x0A01, BOOLEAN)) \ + _(XRT_INPUT_PICO_G3_TRIGGER_CLICK , XRT_INPUT_NAME(0x0A02, BOOLEAN)) \ + _(XRT_INPUT_PICO_G3_TRIGGER_VALUE , XRT_INPUT_NAME(0x0A03, VEC1_ZERO_TO_ONE)) \ + _(XRT_INPUT_PICO_G3_THUMBSTICK_CLICK , XRT_INPUT_NAME(0x0A04, BOOLEAN)) \ + _(XRT_INPUT_PICO_G3_THUMBSTICK_TOUCH , XRT_INPUT_NAME(0x0A05, BOOLEAN)) \ + _(XRT_INPUT_PICO_G3_THUMBSTICK , XRT_INPUT_NAME(0x0A06, VEC2_MINUS_ONE_TO_ONE)) \ + _(XRT_INPUT_PICO_G3_GRIP_POSE , XRT_INPUT_NAME(0x0A07, POSE)) \ + _(XRT_INPUT_PICO_G3_AIM_POSE , XRT_INPUT_NAME(0x0A08, POSE)) // clang-format on @@ -1563,6 +1619,9 @@ enum xrt_output_name XRT_OUTPUT_NAME_VIVE_TRACKER_HAPTIC = XRT_OUTPUT_NAME(0x00D0, VIBRATION), XRT_OUTPUT_NAME_OPPO_MR_HAPTIC = XRT_OUTPUT_NAME(0x00E0, VIBRATION), + + XRT_OUTPUT_NAME_PICO_NEO3_HAPTIC = XRT_OUTPUT_NAME(0x00F0, VIBRATION), + XRT_OUTPUT_NAME_PICO4_HAPTIC = XRT_OUTPUT_NAME(0x0100, 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 a93172ca7..c7c5841b3 100644 --- a/src/xrt/state_trackers/oxr/oxr_extension_support.h +++ b/src/xrt/state_trackers/oxr/oxr_extension_support.h @@ -394,6 +394,17 @@ #endif +/* + * XR_BD_controller_interaction + */ +#if defined(XR_BD_controller_interaction) && defined(XRT_FEATURE_OPENXR_INTERACTION_BYTEDANCE) +#define OXR_HAVE_BD_controller_interaction +#define OXR_EXTENSION_SUPPORT_BD_controller_interaction(_) _(BD_controller_interaction, BD_CONTROLLER_INTERACTION) +#else +#define OXR_EXTENSION_SUPPORT_BD_controller_interaction(_) +#endif + + /* * XR_FB_body_tracking */ @@ -701,6 +712,7 @@ OXR_EXTENSION_SUPPORT_EXT_palm_pose(_) \ OXR_EXTENSION_SUPPORT_EXT_performance_settings(_) \ OXR_EXTENSION_SUPPORT_EXT_samsung_odyssey_controller(_) \ + OXR_EXTENSION_SUPPORT_BD_controller_interaction(_) \ OXR_EXTENSION_SUPPORT_FB_body_tracking(_) \ OXR_EXTENSION_SUPPORT_FB_composition_layer_alpha_blend(_) \ OXR_EXTENSION_SUPPORT_FB_composition_layer_image_layout(_) \