Binding Haptic action gives "XR_ERROR_PATH_UNSUPPORTED"

Hello there,

I'm developing a native openxr application that should have a haptic feedback on the controller. I'm using "XR_ML_ml2_controller_interaction" extension for the controller interaction. According to the documentation, I see that Magic Leap 2 Controller interaction profile should support this path: "…/output/haptic" to trigger the haptic feedback.

But when I created the haptic action and added it to the action set that I should have and then tried to call xrSuggestInteractionProfileBindings I got "XR_ERROR_PATH_UNSUPPORTED" which leaded to issues regrading the controller tracking where I couldn't see the controller and couldn't interact with it anymore.

Once I commented out the haptic path from the suggested bindings paths, the controller worked normally again but without the haptic action that I need to support.

could you please guide me to fix this issue ?
is that path not supported by the current runtime yet ? if yes, could it be fixed in the upcoming OS updates ?

ML2 OS version: v1.5.0
MLSDK version: 1.5.0

Thank you

Do you mind providing more information about your implementation? I can verify that Magic Leap 2 haptics does work via OpenXR. Would you be able to post your full code on how you are binding the haptics action?

In the following code snippet, I'm trying to suggest the magic leap 2 controller interaction profile with the haptic output path only for both hands:

XrPath ml2InteractionProfile = XR_NULL_PATH;
OXR(xrStringToPath(Instance, "/interaction_profiles/ml/ml2_controller", &ml2InteractionProfile));

std::unordered_map<XrPath, std::vector<XrActionSuggestedBinding>> requiredBindings{};
requiredBindings[ml2InteractionProfile].emplace_back(ActionSuggestedBinding(HapticAction, "/user/hand/left/input/output/haptic"));
requiredBindings[ml2InteractionProfile].emplace_back(ActionSuggestedBinding(HapticAction, "/user/hand/right/input/output/haptic"));

XrInteractionProfileSuggestedBinding suggestedBindings = {};
suggestedBindings.type = XR_TYPE_INTERACTION_PROFILE_SUGGESTED_BINDING;
suggestedBindings.next = NULL;
suggestedBindings.interactionProfile = ml2InteractionProfile;
suggestedBindings.suggestedBindings = (const XrActionSuggestedBinding*)requiredBindings[ml2InteractionProfile].data();
suggestedBindings.countSuggestedBindings = (uint32_t)requiredBindings[ml2InteractionProfile].size();

XrResult result;
OXR(result = xrSuggestInteractionProfileBindings(Instance, &suggestedBindings));

I've already disabled the other interaction profiles and all the other paths of the magic leap 2 controller profile except the haptic out paths. Finally, the result of the "xrSuggestInteractionProfileBindings" function call is as the following log:

OpenXR error: result = xrSuggestInteractionProfileBindings(Instance, &suggestedBindings): XR_ERROR_PATH_UNSUPPORTED

A possible reason for the error is that the haptic output path is not correctly specified. According to the Magic Leap Controller Interaction Spec, the haptic output path for the Magic Leap 2 Controller should be /user/hand/left/output/haptic or /user/hand/right/output/haptic , not /user/hand/left/input/output/haptic or /user/hand/right/input/output/haptic .

1 Like

I fixed the typo in the path and that solved the issue. Thank you for your note :sweat_smile:.

After Fixing the path typo, I managed to apply haptics feedback on the controller and I get the vibration successfully. But for some reason I hear a sound comming out of the controller with vibration.

could you please guide me how to disable this sound ?

In the following, you can see how I apply the haptic using XrHapticVibration

 XrHapticVibration v{XR_TYPE_HAPTIC_VIBRATION, nullptr};
 v.amplitude = 1; 
 v.frequency = XR_FREQUENCY_UNSPECIFIED;
 v.duration = ToXrTime(1); // 1 second
 XrHapticActionInfo hai = {XR_TYPE_HAPTIC_ACTION_INFO, nullptr};
 hai.action = HapticAction;
 hai.subactionPath = LeftHandPath;
 XrResult result;
 OXR(result = xrApplyHapticFeedback(Session, &hai, (const XrHapticBaseHeader*)&v));

is there anything that should be changed to disable the sound ?

Thank you

The sound is a result of the haptic motor that is used in the controller and it cannot be disabled. When using the Android Haptic Feedback API you can finetune the haptic pattern. However, this feature is not available when using OpenXR directly.

1 Like

Hi @kbabilinski,

I've tried both OpenXR and Android Haptic Feedback API to apply the same haptic signal but I'm getting an actual sound like the laser shooting sounds when I apply the haptic using openxr and a normal vibration sound when I use Andoid API as the following code snippets:

Using Android Haptic Feedback API:
// This example gets applied when I press the right trigger button.

long[] timings = new long[] {1000}; // 1000 ms = 1 second
int[] amplitudes = new int[] {255}; //  Maximum Amplitude value
int repeatIndex = -1; // Do not repeat.

vibrator.vibrate(VibrationEffect.createWaveform(timings, amplitudes, repeatIndex));

Using OpenXR as mentioned before:
// This example gets applied when I press the left trigger button.

 XrHapticVibration v{XR_TYPE_HAPTIC_VIBRATION, nullptr};
 v.amplitude = 1;  // Maximum Amplitude value
 v.frequency = XR_FREQUENCY_UNSPECIFIED;
 v.duration = ToXrTime(1); // 1 second
 XrHapticActionInfo hai = {XR_TYPE_HAPTIC_ACTION_INFO, nullptr};
 hai.action = HapticAction;
 hai.subactionPath = LeftHandPath; // gets applied to the left hand
 XrResult result;
 OXR(result = xrApplyHapticFeedback(Session, &hai, (const XrHapticBaseHeader*)&v));

I've recorded a video, so you can hear the audio from both hands and notice the difference. you can find it in the attacted zip file.

haptic-video.zip (2.3 MB)

Thank you

Thank you for the video. I reported your feedback to our voice of customer team. Currently, our OpenXR haptic implementation is limited and causes the motor to produce sounds.

For higher quality Haptics, I recommend using the MLSDK Haptics API and using the predefined Buzzes. These are the haptics that are used across our system and do not cause the motor to produce a sound.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.