Search Unity

Question OpenXR and OpenVR together?

Discussion in 'XR Interaction Toolkit and Input' started by myaydin, May 21, 2021.

  1. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    871
    Hey, how did you make the loading of profile conditional? Inside the profile itself?
     
  2. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    871
    @VRDave_Unity How (or where) can we use this to conditionally load a Profile? Right now I am having the issue that other profiles don't work anymore if in current runtime the tracker are unsupported.
     
  3. peroht

    peroht

    Joined:
    Jan 24, 2023
    Posts:
    1
    Thanks for this controller profile. I have made no changes to the script. Here is my question:

    When starting my game (editor or built), I am able to power up normal vive controllers, wait a bit let them connect and they will be tracked in Unity.

    However, this is not the case for vive trackers. I am unable to get the vive tracker to show up unless I've powered it up / activated it with steam before i start the game.

    Is this a know issue? Any work-arounds?

    Also, are there any modern ways to get the signals from the pogo-pins? Or, is it the old SteamVR plugin that will be the champion there?

    Testing with Unity 2021.3.16.
    OpenXR Plugin 1.5.3
    XR Interaction Toolkit 2.0.4
    XR Plugin Management 4.2.1
     
    Last edited: Feb 2, 2023
    RobbertK and CBHM like this.
  4. Warped-Imagination

    Warped-Imagination

    Joined:
    May 18, 2014
    Posts:
    51
    Did anyone manage to get the trigger press working on a tracker?
    @pmem I noticed you had all action configs except devicePose commented out in the code you posted
     
  5. CBHM

    CBHM

    Joined:
    Feb 12, 2019
    Posts:
    32
    Hi, based on the active runtime, I was able to enable or disable the tracker profile.
     
  6. Hypertectonic

    Hypertectonic

    Joined:
    Dec 16, 2016
    Posts:
    75
    I was trying to get this working using the tracker profile in this post https://forum.unity.com/threads/openxr-and-openvr-together.1113136/#post-7803057 and was getting errors in Unity 2021.3.20
    Turns out there is a deprecated class being used that was not being caught by the compiler.
    Code (CSharp):
    1. // Replace this in line 15
    2. using PoseControl = UnityEngine.XR.OpenXR.Input.PoseControl;
    3.  
    4. // With this
    5. using PoseControl = UnityEngine.InputSystem.XR.PoseControl;
     
  7. CBHM

    CBHM

    Joined:
    Feb 12, 2019
    Posts:
    32
    Hi, @peroht were you able to figure out a workaround for the issue where the Vive tracker doesn't show up if they are connected after the launch of the application?
     
  8. RobbertK

    RobbertK

    Joined:
    Mar 23, 2018
    Posts:
    1
    Anyone figured out how to get the inputs (trigger, grip,..) from the Vive tracker? My attempts to extend the tracker profile failed until now.
     
  9. benengel94

    benengel94

    Joined:
    Aug 11, 2017
    Posts:
    1
    If anyone is having issues with the code above make sure that you do it on Awake not in Start. You can't turn the features on and off once things have all loaded in.
     
  10. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Same error here with a project I had that worked fine in Unity 2020 but in Unity 2022.2.19 I get this error when using SteamVR runtime:
    Failed to create Action 'htcvivetracker/devicepose' with result 'XR_ERROR_PATH_UNSUPPORTED'.

    Quick update, I found the fix but since I published an asset on the store using a reference to the tracker script, I need to find a way to check via code in some ifdef what OpenXR package is installed since in OpenXR 1.6.0 Unity package and above, this fix is needed due to an outdated reference: https://forum.unity.com/threads/openxr-and-openvr-together.1113136/page-3#post-8862396

    And then I also had to navigate to Project Settings > OpenXR and use the new default runtime field to by default select SteamVR instead of System Default (despite system default being set to SteamVR on my windows machine in the registry)

     
    Last edited: Jun 2, 2023
  11. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    @thep3000 I'm at a total loss as to where this change from UnityEngine.XR.OpenXR.Input.PoseControl to UnityEngine.InputSystem.XR.Posecontrol happened and how I can #ifdef it for users in the script you provided. Can you provide any insight for this? I was initially supporting Unity 2020.x to 2022.x but now I was notified that in 2022.2.19f1 the issue of XR_ERROR_PATH_UNSUPPORTED arises and I'm struggling to backtrack it between Unity 2020/2021/2022

    I also posted about this in the Input subforum here
    https://forum.unity.com/threads/whe...ityengine-inputsystem-xr-posecontrol.1444180/
     
    Last edited: Jun 3, 2023
  12. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I noticed this only happens if in Player Settings under Project Settings > Scripting define symbopls has 'USE_INPUT_SYSTEM_POSE_CONTROL'

    I have wrapped it like this for both cases:
    Code (CSharp):
    1. #if USE_INPUT_SYSTEM_POSE_CONTROL
    2. using PoseControl = UnityEngine.InputSystem.XR.PoseControl;
    3. #else
    4. using PoseControl = UnityEngine.XR.OpenXR.Input.PoseControl;
    5. #endif
    6.  
     
  13. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    How can you tie that script up to enabling/disabling the Vive Tracker profile at runtime?

    I would like to add this check on start of play mode to check for SteamVR first and enable/disable the Vive tracker profile.

    Maybe for now I can add this script and make it debug.log error if the user hasn't selected SteamVR OpenXR runtime
     
  14. NSM_Nick

    NSM_Nick

    Joined:
    Nov 21, 2017
    Posts:
    2
    I have a unique issue here with the tracker (2.0).

    I have an app running in 2021.3.16f1. I am using the null driver. I have followed the advice from this thread to grab the HTCViveTrackerProfile and set it up, and I have the app working reliably on my desktop.

    As soon as I run the exact same app on my laptop, in editor or in a build, the behavior becomes such that I can get the tracker to start working in-app only if I power the tracker off, and then turn it back on again while the app is already running. But consistently after about 3 seconds the tracker stops working again. Steam VR still sees it as connected and all appears normal with the hardware, but the pose tracking just completely halts until I restart the tracker again and get another 3 seconds out of it. After a few tracker restarts, the tracker often completely stops recovering and the app needs to be restarted.

    Normally when a tracker is not being tracked, the tracked object in Unity will snap to a neutral zero rotation. But in this case it just keeps the tracked object at the same rotation it previously got, without detecting any further movement. The app itself is not frozen during the time while this issue is happening.

    It's an older laptop, maybe 5 or 6 years, and likely doesn't meet the minimum requirements for VR. I wouldn't expect that to really matter for using just the tracker and the null driver. The tracker does work, but only for mere seconds at a time.

    I'm on Steam VR 1.25.8 and I have also tried upgrading the app to 2022.3.1f1 (with the proper syntax fix in the TrackerProfile) and it resulted in the same exact behavior where it works on my desktop and only works in 3 second bursts on the laptop.

    The editor does not throw any errors or warnings when the issue happens.

    Has anyone ever seen anything like this? I'm at a loss.
     
    Last edited: Jun 7, 2023
  15. NSM_Nick

    NSM_Nick

    Joined:
    Nov 21, 2017
    Posts:
    2
    I have solved my problem. To anyone else having issues with the null driver, you must enable Advanced Settings within Steam VR and then, in the "Video" category, set "Pause VR when headset is idle" to "Off".
     
    ROBYER1 likes this.
  16. ThisIsJeff

    ThisIsJeff

    Joined:
    Oct 30, 2019
    Posts:
    6
    Did you manage to solve the issue where trackers don't show any data for position and rotation? I have everything working except for that every tracker has its values set to 0.
     
  17. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Not actually had that issue myself sorry
     
  18. CBHM

    CBHM

    Joined:
    Feb 12, 2019
    Posts:
    32
    Did you connect the trackers before or after starting the application? also, is the openXR runtime set correctly? what trackers are you using?
     
  19. BerKennS

    BerKennS

    Joined:
    Mar 30, 2023
    Posts:
    1
    Hi everyone,
    I am developing a VR application using additional positioning sensors (HTC Vive Tracker). For development, I use the OpenXR plugin and the XR Interaction Toolkit.
    I read in the messages above how you can connect the tracker using the OpenXR Input System and track its position. I did it, but I need to use
    additional interaction buttons for this tracker by connecting them via Pogo pins and I can't figure out how I can get tracking of pressing these buttons.
    At first I used HTCViveTrackerProfile.cs from message #21, but it does not describe events for interacting with buttons connected via Pogo pins.
    Maybe someone has encountered this problem, please help.
     
  20. HypothicEntropy

    HypothicEntropy

    Joined:
    Mar 24, 2014
    Posts:
    26
    So I spent several hours trying to get Pogo Pins input working but I wasn't able to make any progress, for some reason, adding Actions seems to break the device pose tracking. Adding actions before device pose will break it, but adding it after the device pose will not break it.. but regardless, it is not possible to get the Actions working (for instance, adding a Trigger or Grip Pressed action) in any format and trying to add it before the Pose input will break it.

    I've been trying to debug the code but I am unable to find any issues. My thinking at this point is that the Khronos group did not fully implement the Vive Trackers to work correctly even though their documentation say it is fully implemented.

    The OpenXR™ Specification (khronos.org)

    If anyone else knows how the new Input system works with Actions, maybe you can give it a try and figure out what the issue is. I followed along with "HTCViveControllerProfile" and "ValveIndexControllerProfile" and seems I implemented it correctly, but wasn't able to get it working.
     
  21. HypothicEntropy

    HypothicEntropy

    Joined:
    Mar 24, 2014
    Posts:
    26
  22. footballdaniel

    footballdaniel

    Joined:
    Sep 7, 2018
    Posts:
    1

    If steamvr does not start automatically: Setting the Play Mode OpenXR Runtime: SteamVR helps in the short run, but this setting is not serialized (not added to version control).

    The better solution to force steam to start is to set it in SteamVR.

    On this page there is a button `Set SteamVR as the default OpenXR layer` in the latest versions (>=2.1.8).
    I already clicked it, so the button is no longer visible.

    After that, steam starts again as the default openxr runtime

    upload_2023-11-30_17-11-40.png