Jump to content

[Tutorial] OpenXR PC VR : How to use VIVE Tracker


Vivi Wu

Recommended Posts

 I've also been struggling with getting the Vive Trackers (2.0 and 3.0) haptic POGO output pins working with Unity.

We're using 5 and sometimes 6 trackers to capture motion and render body parts for VR physical therapy games built in Unity, and we need at least four of the trackers to appropriately output the vibration signal on the POGO pins for our games to work. We can only get the signal on up to two trackers, when they're set to Held In Hand > [Right/Left] Hand. I've gotten everything else with the games working with two different combinations of XR frameworks in Unity (with 2022.3.21f1+ and also with 2019, 2020, 2021 over the last couple years):

  1. Unity 2019.4 -> 2022.3.5f1: OpenXR + OpenVR Loader + SteamVR Asset and Camera Rig in Unity, with old Unity Input system (or "Both" in PlayerSettings) 
    Vibrating successfully thru SteamVR on controllers and outputting a voltage on up to two trackers' POGO pins (only when set to L/R Hand) with:
    SteamVR_Actions.default_Haptic[SteamVR_Input_Sources.RightHand].Execute(secondsFromNow, duration, freq, amp);

     

  2. Unity 2022.3: OpenXR + New Unity Input System, with a modified HTC Tracker Profile (no SteamVR Asset in Unity project, no OpenVR)
    With action bindings setup with OpenXR controller/tracker profiles (with official controller profiles, with previously mentioned unofficial HTCTrackerProfile.cs, and with my modified profile HTCTrackerHapticProfile.cs (attached))
    With devicePosition and deviceRotation action settings (could not get working work with devicePose for pos/rot) just as shown in: https://www.youtube.com/watch?v=Tw5LbNLW9Q4 
    Vibrating successfully only on controllers (Vive, Valve Index, etc.) not on trackers with:
    OpenXRInput.SendHapticImpulse(RightHandHapticAction, amplitude, duration)

    Where RightHandHapticAction is a haptic action setup for the specific controller/tracker in the use case.

But in neither case have we been able to get more than two tracker vibration/haptic pins working. We've been able to get the pogo pins to output a voltage on only up to two trackers, only when using the #1 framework combo with OpenVR, and only when those two trackers are set to Held in Hand > [Right/Left] Hand. We've primarily tested the POGO haptic out on the ViveTracker 3.0s using a multimeter or oscilloscope, but the device position and rotations do work the same with both #1 and #2 framework combos on v2.0 and v3.0s.

Following the newer OpenXR way #2, I've also tried to add a haptic path to the trackers by modifying the HTCTrackerProfile.cs previously shared in this thread, modeling the official vive controller profile (HTCViveControllerProfile.cs) (edited script here: https://github.com/mbennett12/ViveTrackerHapticOpenXR/blob/main/HTCViveTrackerHapticProfile.cs).

This *seems like it should work* or does at least allow me to create a HapticAction for each vive tracker and thus should (?) be sending a haptic action to the tracker. I even tried to trick OpenXR/SteamVR into thinking it's a full controller by changing the type of the tracker from TrackedDevice to XRControllerWithRumble and all of the `InputDeviceCharacteristics` to `.Controller` instead of `.TrackedDevice`, but still didn't see a haptic option in the SteamVR bindings nor get on the POGO pin so reverted to TrackedController. In my Input Analysis tab I see the haptic field showing the same value as my vibrating valve controller, and I am triggering the tracker's haptic action (in this case the LeftFoot) in the same manner as with the RightHand (with the function shown in #2 above).

spacer.png

spacer.png

This method at least gets to the point where in my SteamVR Controller Bindings Settings I see "Suggested: haptic" but yet still no actual haptic values or options to set one. Pose is there, though.

spacer.png

no_haptic_option_available.PNGdevicepose_works.jpg

unity2022OpenXRVersions.PNG

Is there a way for me to edit the SteamVR binding directly to add in the haptic out path that Unity/OpenXR is sending?

It seems like either you can only use up to two trackers for haptic out when set as the hands through SteamVR/OpenVR/Old Unity Input System, and maybe none thru OpenXR and the new Unity Input System? I'd love to be totally wrong and there to be an official working solution, but if you can only use haptics in up to two trackers I hope that could be made clear!

I've made a repo with my script edit and these references images: https://github.com/mbennett12/ViveTrackerHapticOpenXR. Note that this haptic profile script `HTCViveTrackerHapticProfile.cs` exports the same OpenXR extensionName "HTC Vive Tracker Profile" as the other vive tracker profile script, so if you already have `HTCViveTrackerProfile.cs` in your project I recommend removing this before adding the haptic profile edit. Thank you to anyone who can help!

Link to comment
Share on other sites

Hi @VIVE_chengnay, I have cross-posted this post in the following places:

Feel free to reach out to me via email to discuss more or clarify any details, thank you.

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...

My issues have been *solved* with the newest SteamVR beta update: 2.5.4 and with frameworks combo #1 (OpenXR + OpenVR Loader + SteamVR Asset and Camera Rig in Unity, with old Unity Input system), as reported in the SteamVR Forums here: https://steamcommunity.com/app/250820/discussions/0/4357871582651459139/. Looks like the issue was SteamVR controller bindings not doing anything with the haptic information being sent from Unity to Vive Trackers not set to RHand/LHand.

The question still remains whether this is also fixed with OpenXR and the New Unity Input System (combo #2 referenced above), or whether Vive/SteamVR just does not support the more recent OpenXR/UnityInputSystem standards? Would really love any feedback there about what frameworks should/shouldn't be used with SteamVR, given that there are so many options today.

Regardless, thanks for the bug fix with this SteamVR beta update!!

  • Like 1
Link to comment
Share on other sites

17 minutes ago, mbennett said:

The question still remains whether this is also fixed with OpenXR and the New Unity Input System (combo #2 referenced above)

Hi @mbennett,

Could you provide the specific version for the plugins you installed for your project?

I will like to try it out later, thanks!

Link to comment
Share on other sites

15 hours ago, VIVE_chengnay said:

Hi @mbennett,

Could you provide the specific version for the plugins you installed for your project?

I will like to try it out later, thanks!

Hi @VIVE_chengnay,

I included all the specific versions of the plugins, Unity version, my modified tracker haptic profile for OpenXR, etc. in my long post a few posts back (see screenshot for specific versions). All those screenshots are for debugging combo #2 (with OpenXR, new Unity Input System, and NOT SteamVR or OpenVR in the unity project), which I have not been able to successfully test yet, only have confirmed haptic output through framework combination #1, as referenced above. Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...