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

headless.py: i get xr.exception.TimeInvalidError #12

Open
throni3git opened this issue Jul 18, 2023 · 9 comments
Open

headless.py: i get xr.exception.TimeInvalidError #12

throni3git opened this issue Jul 18, 2023 · 9 comments

Comments

@throni3git
Copy link

i am interested in the very fresh headless.py script. but on my system (Win10 with a HTC Vive) i get xr.exception.TimeInvalidError: The provided basetype:XrTime was zero, negative, or out of range. when trying to run headless.py. what can i get out of this message?

thanks and greetings
Thomas

@cmbruns
Copy link
Owner

cmbruns commented Jul 18, 2023

Do you get that error message on the very first frame?
I saw a similar error message many times while debugging that script.
I recommend carefully examining the time values. Add frame_info = xr.wait_frame(...) and look at the frame_info.predicted_display_time. Do the numbers look similar?
I too was using Win10 and HTC Vive. I presume you are using the SteamVR runtime?

@throni3git
Copy link
Author

thanks for your quick answer, i will try when i am back on the machine. the error occured after some state flags were printed, then on the first frame, yes. when i checked the xr_time.value it was zero.

as i am new to openXR and beforehand i used OpenVR with SteamVR runtime, can you please point me to instructions to avoid the SteamVR runtime?

my use case will be a simple tracking with my own calibration that should run on Linux and on Windows without HMD. once this example runs, i will try to port it to Linux as well. do you also plan to port it?

@throni3git
Copy link
Author

i closed this by accident but i reopened it.

my output is:

OpenXR session state changed to xr.SessionState.IDLE
OpenXR session state changed to xr.SessionState.READY
OpenXR session state changed to xr.SessionState.SYNCHRONIZED
OpenXR session state changed to xr.SessionState.VISIBLE
OpenXR session state changed to xr.SessionState.FOCUSED
frame_info.predicted_display_time:
   75619184201800
xr_time_now.value:
   708503500
Traceback (most recent call last):
  File "c:\Users\TT\Desktop\Arbeit\pyopenxr_examples-main\xr_examples\headless.py", line 196, in <module>
    space_location = xr.locate_space(
  File "C:\Users\TT\Desktop\Arbeit\BLS-python\venv39\lib\site-packages\xr\functions.py", line 375, in locate_space
    raise result
xr.exception.TimeInvalidError: The provided basetype:XrTime was zero, negative, or out of range.

@cmbruns
Copy link
Owner

cmbruns commented Jul 19, 2023

please try the latest version of headless.py
i suspect that different versions of python return different things for time.perf_counter_ns(), so i cut out the middleman and reached straight for the official QueryPerformanceCounter() function using ctypes.

@throni3git
Copy link
Author

thanks! now this works. i am using Python 3.9, what is your version?

regarding your statement "I presume you are using the SteamVR runtime?": is it avoidable? i am using HTC Vive Pro. [1] says: "[3] HTC headsets with outside-in tracking (Lighthouse) only work through SteamVR. HTC headsets with inside-out tracking have native OpenXR support (enabled through the VIVE Console software)."

[1] https://mbucchia.github.io/OpenXR-Toolkit/opencomposite.html

@cmbruns
Copy link
Owner

cmbruns commented Jul 21, 2023

That's great you got it working. I've been developing using python 3.11 recently, and I've been testing successfully against python versions 3.6 through 3.11. The only other runtime that I know of that supports XR_MND_HEADLESS is Monado. I haven't even got Monado working on Linux yet. But if you somehow had Monado working on Windows I would definitely want to know about it. That's why I asked. Today I've been working on getting the headless example working on Linux too. It's going well, but it's part of an ambitious refactoring so it might be a while.

@throni3git
Copy link
Author

i did only a brief look into Monado the other day, but i had to shift back to my other task using SteamVR to get headless operation with the null driver. sadly the support on Linux is not that good and i would like to understand why it is less stable on Fedora KDE than on Kubuntu but this is another topic^^

how is your port for this headless.py to Linux going?

@cmbruns
Copy link
Owner

cmbruns commented Aug 2, 2023

I'm still in the middle of a major refactoring, where I'll be changing the way the highest level classes like xr.Context work. But you can find the headless example I got working on Linux buried in a dev branch at https://github.com/cmbruns/pyopenxr_examples/blob/d90f2bbeed86ee570b1a42230340413868f3d47f/xr_examples/headless2.py

@cmbruns
Copy link
Owner

cmbruns commented Aug 2, 2023

I'd appreciate any level of code review on the code you see. I'm mostly toiling alone at the moment so any outside opinions would be helpful.

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

2 participants