Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a headless example #6

Open
cmbruns opened this issue Jun 20, 2022 · 2 comments
Open

Create a headless example #6

cmbruns opened this issue Jun 20, 2022 · 2 comments

Comments

@cmbruns
Copy link
Owner

cmbruns commented Jun 20, 2022

I recently noticed XR_MND_headless is an available extension on my Linux/SteamVR platform. So now I might be able to create an example for this without spinning my wheels trying to get Monado installed.

@SurprisinglySuspicious
Copy link

Hey, Thanks for making this.
I've recently been trying to make a very simple (accessibility) program in SteamVR that just runs in the background while playing a game and just print text (for now) when 4 buttons are touched on the L&R index or quest 2 controllers.
I've gotten the code to work, but since SteamVR can't run 2 things at once and doesn't support XR overlays yet, I can't run the code and another game at the same time... XR_MND_headless seems to be my last resort.

I'm no great programmer but I have tried so hard to break my head and get it to work by myself and I've looked far and wide but without examples online, I think I jumped into something bigger than I can handle.

Basically all of this to say:
My very very simple project might be screwed without this and I'm hoping I could understand and learn from it when it's done.
Thanks!

@hiinaspace
Copy link

I briefly tried this on win10/steamvr which also reports that XR_MND_headless is available. Changed the setup of track_hmd.py to

with xr.InstanceObject(application_name="track_hmd", enabled_extensions=["XR_MND_headless"]) as instance, \
        xr.SystemObject(instance) as system, \
        xr.SessionObject(system, graphics_binding=None) as session:

and it will print hmd poses while remaining in the steamvr polar grid. However, I tried removing the sessiong.wait_frame() begin/end frame calls and got

(venv) PS C:\Users\s\source\repos\pyopenxr\pyopenxr_examples> python .\xr_examples\track_hmd.py
Traceback (most recent call last):
  File "C:\Users\s\source\repos\pyopenxr\pyopenxr_examples\xr_examples\track_hmd.py", line 21, in <module>
    view_state, views = session.locate_views()
  File "C:\Users\s\source\repos\pyopenxr\venv\lib\site-packages\xr\classes.py", line 234, in locate_views
    return locate_views(self.handle, view_locate_info)
  File "C:\Users\s\source\repos\pyopenxr\venv\lib\site-packages\xr\functions.py", line 705, in locate_views
    raise result
xr.exception.TimeInvalidError: The provided basetype:XrTime was zero, negative, or out of range.

https://github.com/cmbruns/pyopenxr/blob/85bdaf3ae249192f77c047a6bd766c8be321867d/src/xr/classes.py#L225-L227 looks like it tries to take the predicted display time from the (presumably blank) frame_state; I'm not yet familiar enough with openxr to debug beyond this.

Unfortunately, with the frame calls in, launching track_hmd.py does make steamvr kill whatever else is running (I'm also looking for a solution to make an "overlay" application through openxr). I know https://github.com/LunarG/OpenXR-OverlayLayer is out there and I roughly understand it functions as a "API layer" that can in theory run on top of steamvr. I don't know if anybody's tried that yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants