microsoft / OpenXR-MixedReality

OpenXR samples and preview headers for HoloLens and Windows Mixed Reality developers familiar with Visual Studio
https://aka.ms/openxr
MIT License
340 stars 96 forks source link

XrResult failure [XR_ERROR_PATH_UNSUPPORTED] #93

Closed Harry79 closed 3 years ago

Harry79 commented 3 years ago

When running the BasicXrApp on the HP Reverb G2 an exception is raised:

  ERROR (OpenXR) : [xrSuggestInteractionProfileBindings] Suggested binding '/user/hand/right/input/trigger/value' is not supported by interaction profile '/interaction_profiles/hp/mixed_reality_controller'.
  Ausnahme ausgelöst bei 0x00007FFFD9624ED9 in BasicXrApp_win32.exe: Microsoft C++-Ausnahme: msxr::XrResultException bei Speicherort 0x000000D5D54FE268.
  Ausnahme ausgelöst bei 0x00007FFFD9624ED9 in BasicXrApp_win32.exe: Microsoft C++-Ausnahme: std::logic_error bei Speicherort 0x000000D5D54FE940.

I commented out the following block, then the application works:

            if (m_optionalExtensions.HPMRControllerSupported)
            {
                std::vector<XrActionSuggestedBinding> bindings;
                bindings.push_back({m_placeAction.Get(), GetXrPath("/user/hand/right/input/trigger/value")});
                bindings.push_back({m_placeAction.Get(), GetXrPath("/user/hand/left/input/trigger/value")});
                bindings.push_back({m_poseAction.Get(), GetXrPath("/user/hand/right/input/grip/pose")});
                bindings.push_back({m_poseAction.Get(), GetXrPath("/user/hand/left/input/grip/pose")});
                bindings.push_back({m_vibrateAction.Get(), GetXrPath("/user/hand/right/output/haptic")});
                bindings.push_back({m_vibrateAction.Get(), GetXrPath("/user/hand/left/output/haptic")});
                bindings.push_back({m_exitAction.Get(), GetXrPath("/user/hand/right/input/squeeze/value")});
                bindings.push_back({m_exitAction.Get(), GetXrPath("/user/hand/left/input/squeeze/value")});

                XrInteractionProfileSuggestedBinding suggestedBindings{XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING};
                suggestedBindings.interactionProfile = GetXrPath("/interaction_profiles/hp/mixed_reality_controller");
                suggestedBindings.suggestedBindings = bindings.data();
                suggestedBindings.countSuggestedBindings = (uint32_t)bindings.size();
                CHECK_XRCMD(xrSuggestInteractionProfileBindings(m_instance.Get(), &suggestedBindings));
            }

            // Set up suggested bindings for the microsoft/hand_interaction profile.
            if (m_optionalExtensions.MsftHandInteractionSupported)
            {
                std::vector<XrActionSuggestedBinding> bindings;
                bindings.push_back({m_placeAction.Get(), GetXrPath("/user/hand/right/input/select/value")});
                bindings.push_back({m_placeAction.Get(), GetXrPath("/user/hand/left/input/select/value")});
                bindings.push_back({m_poseAction.Get(), GetXrPath("/user/hand/right/input/grip/pose")});
                bindings.push_back({m_poseAction.Get(), GetXrPath("/user/hand/left/input/grip/pose")});
                bindings.push_back({m_exitAction.Get(), GetXrPath("/user/hand/right/input/squeeze/value")});
                bindings.push_back({m_exitAction.Get(), GetXrPath("/user/hand/left/input/squeeze/value")});

                XrInteractionProfileSuggestedBinding suggestedBindings{XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING};
                suggestedBindings.interactionProfile = GetXrPath("/interaction_profiles/microsoft/hand_interaction");
                suggestedBindings.suggestedBindings = bindings.data();
                suggestedBindings.countSuggestedBindings = (uint32_t)bindings.size();
                CHECK_XRCMD(xrSuggestInteractionProfileBindings(m_instance.Get(), &suggestedBindings));
            }

Are these controls supposed to be supported by the HP Reverb G2? In case not, the code should check for the device and probably not call the functions.

yl-msft commented 3 years ago

There's a fix recently addressed this problem in our 108 runtime release. Could you please try the 108 preview runtime to see if this works here? image

The sample code here were correct. It was our API runtime didn't behave correctly when the user doesn't have any G2 controller turned on when launching the app. The mentioned fix above is to address this issue.

Harry79 commented 3 years ago

I confirm, the fix works for me. Thanks!