xrt|ipc|st/oxr: Adds support for XR_EXT_hand_interaction profile.

This commit is contained in:
Korcan Hussein 2023-06-05 15:41:16 +01:00
parent eaa7017217
commit b6b5610c05
14 changed files with 165 additions and 20 deletions

View file

@ -54,6 +54,7 @@ EXTENSIONS = (
['XR_EXT_debug_utils', 'XRT_FEATURE_OPENXR_DEBUG_UTILS'],
['XR_EXT_dpad_binding'],
['XR_EXT_eye_gaze_interaction'],
['XR_EXT_hand_interaction'],
['XR_EXT_hand_tracking'],
['XR_EXT_hp_mixed_reality_controller'],
['XR_EXT_palm_pose', 'ALWAYS_DISABLED'],

View file

@ -22,12 +22,98 @@
}
},
"/virtual_profiles/ext/hand_interaction_poses": {
"title": "Ext Hand Interaction Poses",
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_HAND_INTERACTION",
"extension": "XR_EXT_hand_interaction",
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
],
"subpaths": {
"/input/pinch_ext": {
"type": "pose",
"localized_name": "Pinch",
"components": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_HAND_PINCH_POSE"
}
},
"/input/poke_ext": {
"type": "pose",
"localized_name": "Poke",
"components": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_HAND_POKE_POSE"
}
}
}
},
"/interaction_profiles/ext/hand_interaction_ext": {
"title": "Ext Hand Interaction",
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_HAND_INTERACTION",
"extension": "XR_EXT_hand_interaction",
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
],
"subpaths": {
"/input/grip": {
"type": "pose",
"localized_name": "Grip",
"components": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_HAND_GRIP_POSE"
}
},
"/input/aim": {
"type": "pose",
"localized_name": "Aim",
"components": ["pose"],
"monado_bindings": {
"pose": "XRT_INPUT_HAND_AIM_POSE"
}
},
"/input/pinch_ext": {
"type": "trigger",
"localized_name": "Pinch",
"components": ["value", "ready_ext"],
"monado_bindings": {
"value": "XRT_INPUT_HAND_PINCH_VALUE",
"ready_ext": "XRT_INPUT_HAND_PINCH_READY"
}
},
"/input/aim_activate_ext": {
"type": "trigger",
"localized_name": "Aim Activate",
"components": ["value", "ready_ext"],
"monado_bindings": {
"value": "XRT_INPUT_HAND_AIM_ACTIVATE_VALUE",
"ready_ext": "XRT_INPUT_HAND_AIM_ACTIVATE_READY"
}
},
"/input/grasp_ext": {
"type": "trigger",
"localized_name": "Grasp",
"components": ["value", "ready_ext"],
"monado_bindings": {
"value": "XRT_INPUT_HAND_GRASP_VALUE",
"ready_ext": "XRT_INPUT_HAND_GRASP_READY"
}
}
}
},
"/interaction_profiles/khr/simple_controller": {
"title": "Khronos Simple Controller",
"type": "tracked_controller",
"steamvr_controllertype": "khr_simple_controller",
"monado_device": "XRT_DEVICE_SIMPLE_CONTROLLER",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -80,7 +166,7 @@
"title": "Google Daydream Controller",
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_DAYDREAM",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -133,7 +219,7 @@
"type": "tracked_controller",
"steamvr_controllertype": "vive_controller",
"monado_device": "XRT_DEVICE_VIVE_WAND",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -220,7 +306,7 @@
"type": "tracked_hmd",
"steamvr_controllertype": "vive_pro",
"monado_device": "XRT_DEVICE_VIVE_PRO",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/head"
],
@ -265,7 +351,7 @@
"type": "tracked_controller",
"steamvr_controllertype": "holographic_controller",
"monado_device": "XRT_DEVICE_WMR_CONTROLLER",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -355,7 +441,7 @@
"type": "untracked_controller",
"steamvr_controllertype": "gamepad",
"monado_device": "XRT_DEVICE_XBOX_CONTROLLER",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/gamepad"
],
@ -537,7 +623,7 @@
"title": "Oculus Go Controller",
"type": "untracked_controller",
"monado_device": "XRT_DEVICE_GO_CONTROLLER",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -606,7 +692,7 @@
"type": "tracked_controller",
"steamvr_controllertype": "oculus_touch",
"monado_device": "XRT_DEVICE_TOUCH_CONTROLLER",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -741,7 +827,7 @@
"type": "tracked_controller",
"steamvr_controllertype": "knuckles",
"monado_device": "XRT_DEVICE_INDEX_CONTROLLER",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -855,7 +941,7 @@
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_HP_REVERB_G2_CONTROLLER",
"extension": "XR_EXT_hp_mixed_reality_controller",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -966,7 +1052,7 @@
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_SAMSUNG_ODYSSEY_CONTROLLER",
"extension": "XR_EXT_samsung_odyssey_controller",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -1056,7 +1142,7 @@
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_ML2_CONTROLLER",
"extension": "XR_ML_ml2_controller_interaction",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -1143,7 +1229,7 @@
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_HAND_INTERACTION",
"extension": "XR_MSFT_hand_interaction",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -1189,7 +1275,7 @@
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_PSMV",
"extension": "XR_MNDX_ball_on_a_stick_controller",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -1315,7 +1401,7 @@
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_HYDRA",
"extension": "XR_MNDX_hydra",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"
@ -1398,7 +1484,7 @@
"type": "eye_tracker",
"monado_device": "XRT_DEVICE_EYE_GAZE_INTERACTION",
"extension": "XR_EXT_eye_gaze_interaction",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/eyes_ext"
],
@ -1418,7 +1504,7 @@
"type": "tracked_controller",
"monado_device": "XRT_DEVICE_VIVE_TRACKER",
"extension": "XR_HTCX_vive_tracker_interaction",
"extended_by": ["ext/palm_pose"],
"extended_by": ["ext/palm_pose", "ext/hand_interaction_poses"],
"subaction_paths": [
"/user/hand/left",
"/user/hand/right"

View file

@ -33,7 +33,8 @@
"value",
"haptic",
"force",
"pose"
"pose",
"ready_ext"
]
},
"subActionPathName": {
@ -94,6 +95,9 @@
},
"pose": {
"$ref": "#/definitions/monadoBindingDefine"
},
"ready_ext": {
"$ref": "#/definitions/monadoBindingDefine"
}
}
},
@ -197,7 +201,7 @@
"type": "object",
"title": "Paths provided by this profile",
"propertyNames": {
"pattern": "^(/input/(select|menu|grip|aim|trackpad|system|squeeze|trigger|volume_up|volume_down|mute_mic|thumbrest|home|start|gaze_ext|([a-z]+)_mndx|[1-4]|thumbstick(_left|_right)?|view|a|b|x|y|dpad_(up|down|left|right)|shoulder(_left|_right)?))|(/output/haptic(_left|_right|_left_trigger|_right_trigger)?)$"
"pattern": "^(/input/(select|menu|grip|aim|pinch|poke|trackpad|system|squeeze|trigger|volume_up|volume_down|mute_mic|thumbrest|home|start|gaze_ext|ready_ext|([a-z]+)_mndx|[1-4]|thumbstick(_left|_right)?|view|a|b|x|y|dpad_(up|down|left|right)|shoulder(_left|_right)?))|(/output/haptic(_left|_right|_left_trigger|_right_trigger)?)$"
},
"additionalProperties": {
"$ref": "#/definitions/subpathData"

View file

@ -276,6 +276,14 @@ u_pp_xrt_input_name(struct u_pp_delegate dg, enum xrt_input_name name)
case XRT_INPUT_ML2_CONTROLLER_GRIP_POSE: DG("XRT_INPUT_ML2_CONTROLLER_GRIP_POSE"); return;
case XRT_INPUT_ML2_CONTROLLER_AIM_POSE: DG("XRT_INPUT_ML2_CONTROLLER_AIM_POSE"); return;
case XRT_INPUT_ML2_CONTROLLER_SHOULDER_CLICK: DG("XRT_INPUT_ML2_CONTROLLER_SHOULDER_CLICK"); return;
case XRT_INPUT_HAND_PINCH_POSE: DG("XRT_INPUT_HAND_PINCH_POSE"); return;
case XRT_INPUT_HAND_POKE_POSE: DG("XRT_INPUT_HAND_POKE_POSE"); return;
case XRT_INPUT_HAND_PINCH_VALUE: DG("XRT_INPUT_HAND_PINCH_VALUE"); return;
case XRT_INPUT_HAND_AIM_ACTIVATE_VALUE: DG("XRT_INPUT_HAND_AIM_ACTIVATE_VALUE"); return;
case XRT_INPUT_HAND_GRASP_VALUE: DG("XRT_INPUT_HAND_GRASP_VALUE"); return;
case XRT_INPUT_HAND_PINCH_READY: DG("XRT_INPUT_HAND_PINCH_READY"); return;
case XRT_INPUT_HAND_AIM_ACTIVATE_READY: DG("XRT_INPUT_HAND_AIM_ACTIVATE_READY"); return;
case XRT_INPUT_HAND_GRASP_READY: DG("XRT_INPUT_HAND_GRASP_READY"); return;
default: break;
}

View file

@ -373,6 +373,7 @@ update_session_state_locked(struct multi_system_compositor *msc)
.view_type = XRT_VIEW_TYPE_STEREO,
.ext_hand_tracking_enabled = false,
.ext_eye_gaze_interaction_enabled = false,
.ext_hand_interaction_enabled = false,
};
switch (msc->sessions.state) {

View file

@ -1,4 +1,4 @@
// Copyright 2019-2022, Collabora, Ltd.
// Copyright 2019-2023, Collabora, Ltd.
// SPDX-License-Identifier: BSL-1.0
/*!
* @file
@ -7,6 +7,7 @@
* @author Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
* @author Ryan Pavlik <ryan.pavlik@collabora.com>
* @author Christoph Haag <christoph.haag@collabora.com>
* @author Korcan Hussein <korcan.hussein@collabora.com>
* @ingroup xrt_iface
*/
@ -862,6 +863,7 @@ struct xrt_begin_session_info
enum xrt_view_type view_type;
bool ext_hand_tracking_enabled;
bool ext_eye_gaze_interaction_enabled;
bool ext_hand_interaction_enabled;
};
/*!

View file

@ -970,6 +970,16 @@ enum xrt_input_name
XRT_INPUT_PSSENSE_THUMBSTICK_TOUCH = XRT_INPUT_NAME(0x0314, BOOLEAN),
XRT_INPUT_PSSENSE_GRIP_POSE = XRT_INPUT_NAME(0x0315, POSE),
XRT_INPUT_PSSENSE_AIM_POSE = XRT_INPUT_NAME(0x0316, POSE),
// XR_EXT_hand_interaction
XRT_INPUT_HAND_PINCH_POSE = XRT_INPUT_NAME(0x0401, POSE),
XRT_INPUT_HAND_POKE_POSE = XRT_INPUT_NAME(0x0402, POSE),
XRT_INPUT_HAND_PINCH_VALUE = XRT_INPUT_NAME(0x0403, VEC1_ZERO_TO_ONE),
XRT_INPUT_HAND_AIM_ACTIVATE_VALUE = XRT_INPUT_NAME(0x0404, VEC1_ZERO_TO_ONE),
XRT_INPUT_HAND_GRASP_VALUE = XRT_INPUT_NAME(0x0405, VEC1_ZERO_TO_ONE),
XRT_INPUT_HAND_PINCH_READY = XRT_INPUT_NAME(0x0406, BOOLEAN),
XRT_INPUT_HAND_AIM_ACTIVATE_READY = XRT_INPUT_NAME(0x0407, BOOLEAN),
XRT_INPUT_HAND_GRASP_READY = XRT_INPUT_NAME(0x0408, BOOLEAN),
// clang-format on
};

View file

@ -41,6 +41,7 @@ struct xrt_instance_info
char application_name[XRT_MAX_APPLICATION_NAME_SIZE];
bool ext_hand_tracking_enabled;
bool ext_eye_gaze_interaction_enabled;
bool ext_hand_interaction_enabled;
};
/*!

View file

@ -5,6 +5,7 @@
* @brief Handling functions called from generated dispatch function.
* @author Pete Black <pblack@collabora.com>
* @author Jakob Bornecrantz <jakob@collabora.com>
* @author Korcan Hussein <korcan.hussein@collabora.com>
* @ingroup ipc_server
*/
@ -215,6 +216,7 @@ ipc_handle_session_begin(volatile struct ipc_client_state *ics)
.view_type = XRT_VIEW_TYPE_STEREO,
.ext_hand_tracking_enabled = ics->client_state.info.ext_hand_tracking_enabled,
.ext_eye_gaze_interaction_enabled = ics->client_state.info.ext_eye_gaze_interaction_enabled,
.ext_hand_interaction_enabled = ics->client_state.info.ext_hand_interaction_enabled,
};
return xrt_comp_begin_session(ics->xc, &begin_session_info);

View file

@ -305,6 +305,16 @@ oxr_xrSuggestInteractionProfileBindings(XrInstance instance,
subpath_fn = oxr_verify_ext_eye_gaze_interaction_subpath;
dpad_path_fn = oxr_verify_ext_eye_gaze_interaction_dpad_path;
dpad_emulator_fn = oxr_verify_ext_eye_gaze_interaction_dpad_emulator;
} else if (ip == inst->path_cache.ext_hand_interaction) {
if (!inst->extensions.EXT_hand_interaction) {
return oxr_error(&log, XR_ERROR_PATH_UNSUPPORTED,
"(suggestedBindings->interactionProfile == \"%s\") used but "
"XR_EXT_hand_interaction not enabled",
ip_str);
}
subpath_fn = oxr_verify_ext_hand_interaction_ext_subpath;
dpad_path_fn = oxr_verify_ext_hand_interaction_ext_dpad_path;
dpad_emulator_fn = oxr_verify_ext_hand_interaction_ext_dpad_emulator;
} else {
return oxr_error(&log, XR_ERROR_PATH_UNSUPPORTED,
"(suggestedBindings->interactionProfile == \"%s\") is not "
@ -318,6 +328,9 @@ oxr_xrSuggestInteractionProfileBindings(XrInstance instance,
const struct oxr_verify_extension_status verify_ext_status = {
#ifdef OXR_HAVE_EXT_palm_pose
.EXT_palm_pose = inst->extensions.EXT_palm_pose,
#endif
#ifdef OXR_HAVE_EXT_hand_interaction
.EXT_hand_interaction = inst->extensions.EXT_hand_interaction,
#endif
.EXT_hp_mixed_reality_controller = inst->extensions.EXT_hp_mixed_reality_controller,
.EXT_samsung_odyssey_controller = inst->extensions.EXT_samsung_odyssey_controller,

View file

@ -257,6 +257,17 @@
#endif
/*
* XR_EXT_hand_interaction
*/
#if defined(XR_EXT_hand_interaction)
#define OXR_HAVE_EXT_hand_interaction
#define OXR_EXTENSION_SUPPORT_EXT_hand_interaction(_) _(EXT_hand_interaction, EXT_HAND_INTERACTION)
#else
#define OXR_EXTENSION_SUPPORT_EXT_hand_interaction(_)
#endif
/*
* XR_EXT_hand_tracking
*/
@ -472,6 +483,7 @@
OXR_EXTENSION_SUPPORT_EXT_debug_utils(_) \
OXR_EXTENSION_SUPPORT_EXT_dpad_binding(_) \
OXR_EXTENSION_SUPPORT_EXT_eye_gaze_interaction(_) \
OXR_EXTENSION_SUPPORT_EXT_hand_interaction(_) \
OXR_EXTENSION_SUPPORT_EXT_hand_tracking(_) \
OXR_EXTENSION_SUPPORT_EXT_hp_mixed_reality_controller(_) \
OXR_EXTENSION_SUPPORT_EXT_palm_pose(_) \

View file

@ -240,6 +240,7 @@ oxr_instance_create(struct oxr_logger *log,
cache_path(log, inst, "/interaction_profiles/mndx/ball_on_a_stick_controller", &inst->path_cache.mndx_ball_on_a_stick_controller);
cache_path(log, inst, "/interaction_profiles/microsoft/hand_interaction", &inst->path_cache.msft_hand_interaction);
cache_path(log, inst, "/interaction_profiles/ext/eye_gaze_interaction", &inst->path_cache.ext_eye_gaze_interaction);
cache_path(log, inst, "/interaction_profiles/ext/hand_interaction_ext", &inst->path_cache.ext_hand_interaction);
// clang-format on
@ -249,6 +250,7 @@ oxr_instance_create(struct oxr_logger *log,
struct xrt_instance_info i_info = {
.ext_hand_tracking_enabled = extensions->EXT_hand_tracking,
.ext_eye_gaze_interaction_enabled = extensions->EXT_eye_gaze_interaction,
.ext_hand_interaction_enabled = extensions->EXT_hand_interaction,
};
snprintf(i_info.application_name, sizeof(inst->xinst->instance_info.application_name), "%s",
createInfo->applicationInfo.applicationName);

View file

@ -4,6 +4,7 @@
* @file
* @brief The objects representing OpenXR handles, and prototypes for internal functions used in the state tracker.
* @author Jakob Bornecrantz <jakob@collabora.com>
* @author Korcan Hussein <korcan.hussein@collabora.com>
* @ingroup oxr_main
*/
@ -1366,6 +1367,7 @@ struct oxr_instance
XrPath mndx_ball_on_a_stick_controller;
XrPath msft_hand_interaction;
XrPath ext_eye_gaze_interaction;
XrPath ext_hand_interaction;
} path_cache;
struct

View file

@ -146,6 +146,7 @@ oxr_session_begin(struct oxr_logger *log, struct oxr_session *sess, const XrSess
.view_type = (enum xrt_view_type)beginInfo->primaryViewConfigurationType,
.ext_hand_tracking_enabled = extensions->EXT_hand_tracking,
.ext_eye_gaze_interaction_enabled = extensions->EXT_eye_gaze_interaction,
.ext_hand_interaction_enabled = extensions->EXT_hand_interaction,
};
xrt_result_t xret = xrt_comp_begin_session(xc, &begin_session_info);