From a763a74f3cde98f08bbd790758ab3232b37e668c Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Mon, 6 Jan 2020 17:57:24 +0100 Subject: [PATCH 1/4] hello_xr: Add Valve Index bindings --- src/tests/hello_xr/openxr_program.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/tests/hello_xr/openxr_program.cpp b/src/tests/hello_xr/openxr_program.cpp index 18955bae9..011cd719d 100644 --- a/src/tests/hello_xr/openxr_program.cpp +++ b/src/tests/hello_xr/openxr_program.cpp @@ -413,6 +413,7 @@ struct OpenXrProgram : IOpenXrProgram { std::array posePath; std::array hapticPath; std::array menuClickPath; + std::array bClickPath; CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/select/click", &selectPath[Side::LEFT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/select/click", &selectPath[Side::RIGHT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/squeeze/value", &squeezeValuePath[Side::LEFT])); @@ -425,6 +426,8 @@ struct OpenXrProgram : IOpenXrProgram { CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/output/haptic", &hapticPath[Side::RIGHT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/menu/click", &menuClickPath[Side::LEFT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/menu/click", &menuClickPath[Side::RIGHT])); + CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/b/click", &bClickPath[Side::LEFT])); + CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/b/click", &bClickPath[Side::RIGHT])); // Suggest bindings for KHR Simple. { XrPath khrSimpleInteractionProfilePath; @@ -483,6 +486,26 @@ struct OpenXrProgram : IOpenXrProgram { CHECK_XRCMD(xrSuggestInteractionProfileBindings(m_instance, &suggestedBindings)); } + // Suggest bindings for the Valve Index Controller. + { + XrPath indexControllerInteractionProfilePath; + CHECK_XRCMD( + xrStringToPath(m_instance, "/interaction_profiles/valve/index_controller", &indexControllerInteractionProfilePath)); + std::vector bindings{{{m_input.grabAction, squeezeValuePath[Side::LEFT]}, + {m_input.grabAction, squeezeValuePath[Side::RIGHT]}, + {m_input.poseAction, posePath[Side::LEFT]}, + {m_input.poseAction, posePath[Side::RIGHT]}, + {m_input.quitAction, bClickPath[Side::LEFT]}, + {m_input.quitAction, bClickPath[Side::RIGHT]}, + {m_input.vibrateAction, hapticPath[Side::LEFT]}, + {m_input.vibrateAction, hapticPath[Side::RIGHT]}}}; + XrInteractionProfileSuggestedBinding suggestedBindings{XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING}; + suggestedBindings.interactionProfile = indexControllerInteractionProfilePath; + suggestedBindings.suggestedBindings = bindings.data(); + suggestedBindings.countSuggestedBindings = (uint32_t)bindings.size(); + CHECK_XRCMD(xrSuggestInteractionProfileBindings(m_instance, &suggestedBindings)); + } + // Suggest bindings for the Microsoft Mixed Reality Motion Controller. { XrPath microsoftMixedRealityInteractionProfilePath; From d3dc016ec1236ea1ddae3b2c383a7e31ac8fd9e8 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Tue, 3 Mar 2020 17:20:59 +0100 Subject: [PATCH 2/4] hello_xr: Use trigger/value for grabAction on vive_controller Squeeze is a physical button on this controller. If possible, grabAction should be a float. --- src/tests/hello_xr/openxr_program.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tests/hello_xr/openxr_program.cpp b/src/tests/hello_xr/openxr_program.cpp index 011cd719d..87c8822a2 100644 --- a/src/tests/hello_xr/openxr_program.cpp +++ b/src/tests/hello_xr/openxr_program.cpp @@ -414,6 +414,7 @@ struct OpenXrProgram : IOpenXrProgram { std::array hapticPath; std::array menuClickPath; std::array bClickPath; + std::array triggerValuePath; CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/select/click", &selectPath[Side::LEFT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/select/click", &selectPath[Side::RIGHT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/squeeze/value", &squeezeValuePath[Side::LEFT])); @@ -428,6 +429,8 @@ struct OpenXrProgram : IOpenXrProgram { CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/menu/click", &menuClickPath[Side::RIGHT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/b/click", &bClickPath[Side::LEFT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/b/click", &bClickPath[Side::RIGHT])); + CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/trigger/value", &triggerValuePath[Side::LEFT])); + CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/trigger/value", &triggerValuePath[Side::RIGHT])); // Suggest bindings for KHR Simple. { XrPath khrSimpleInteractionProfilePath; @@ -471,8 +474,8 @@ struct OpenXrProgram : IOpenXrProgram { XrPath viveControllerInteractionProfilePath; CHECK_XRCMD( xrStringToPath(m_instance, "/interaction_profiles/htc/vive_controller", &viveControllerInteractionProfilePath)); - std::vector bindings{{{m_input.grabAction, squeezeClickPath[Side::LEFT]}, - {m_input.grabAction, squeezeClickPath[Side::RIGHT]}, + std::vector bindings{{{m_input.grabAction, triggerValuePath[Side::LEFT]}, + {m_input.grabAction, triggerValuePath[Side::RIGHT]}, {m_input.poseAction, posePath[Side::LEFT]}, {m_input.poseAction, posePath[Side::RIGHT]}, {m_input.quitAction, menuClickPath[Side::LEFT]}, From e7fcdd9f2371642df7e63df49c40a778a6a81575 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Fri, 29 May 2020 16:27:18 +0200 Subject: [PATCH 3/4] add changelog fragment for Valve Index bindings --- changes/sdk/pr.163.gh.OpenXR-SDK-Source.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changes/sdk/pr.163.gh.OpenXR-SDK-Source.md diff --git a/changes/sdk/pr.163.gh.OpenXR-SDK-Source.md b/changes/sdk/pr.163.gh.OpenXR-SDK-Source.md new file mode 100644 index 000000000..71e2c195c --- /dev/null +++ b/changes/sdk/pr.163.gh.OpenXR-SDK-Source.md @@ -0,0 +1 @@ +hello_xr: Add Valve Index Controller bindings. Also use trigger value instead of squeeze click for grab action on Vive Wand controller. From 8dd68a2c68caeda243b39eb1b43d95ca04fc6882 Mon Sep 17 00:00:00 2001 From: Christoph Haag Date: Thu, 11 Jun 2020 18:44:08 +0200 Subject: [PATCH 4/4] hello_xr: Use squeeze/force for Valve Index controllers squeeze/value corresponds to how much of the handle is touched which feels undesirable. squeeze/force corresponds to how much the handle is actually squeezed. --- src/tests/hello_xr/openxr_program.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tests/hello_xr/openxr_program.cpp b/src/tests/hello_xr/openxr_program.cpp index 87c8822a2..d5b52a901 100644 --- a/src/tests/hello_xr/openxr_program.cpp +++ b/src/tests/hello_xr/openxr_program.cpp @@ -409,6 +409,7 @@ struct OpenXrProgram : IOpenXrProgram { std::array selectPath; std::array squeezeValuePath; + std::array squeezeForcePath; std::array squeezeClickPath; std::array posePath; std::array hapticPath; @@ -419,6 +420,8 @@ struct OpenXrProgram : IOpenXrProgram { CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/select/click", &selectPath[Side::RIGHT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/squeeze/value", &squeezeValuePath[Side::LEFT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/squeeze/value", &squeezeValuePath[Side::RIGHT])); + CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/squeeze/force", &squeezeForcePath[Side::LEFT])); + CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/squeeze/force", &squeezeForcePath[Side::RIGHT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/squeeze/click", &squeezeClickPath[Side::LEFT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/right/input/squeeze/click", &squeezeClickPath[Side::RIGHT])); CHECK_XRCMD(xrStringToPath(m_instance, "/user/hand/left/input/grip/pose", &posePath[Side::LEFT])); @@ -494,8 +497,8 @@ struct OpenXrProgram : IOpenXrProgram { XrPath indexControllerInteractionProfilePath; CHECK_XRCMD( xrStringToPath(m_instance, "/interaction_profiles/valve/index_controller", &indexControllerInteractionProfilePath)); - std::vector bindings{{{m_input.grabAction, squeezeValuePath[Side::LEFT]}, - {m_input.grabAction, squeezeValuePath[Side::RIGHT]}, + std::vector bindings{{{m_input.grabAction, squeezeForcePath[Side::LEFT]}, + {m_input.grabAction, squeezeForcePath[Side::RIGHT]}, {m_input.poseAction, posePath[Side::LEFT]}, {m_input.poseAction, posePath[Side::RIGHT]}, {m_input.quitAction, bClickPath[Side::LEFT]},