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

'File' HMD driver for integration with homebrew setups #359

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

20kdc
Copy link

@20kdc 20kdc commented Dec 12, 2023

This driver aims to allow a user to very quickly homebrew a 3DOF or 6DOF driver for a 'pure HMD' arrangement.

In addition, even without a custom driver per-se, it can also serve as something of a "configurable dummy driver" without being marked as a dummy driver (important for use with Monado).

In particular, I have found a use for this with Moonlight/Sunshine to stream to a "Cardboard-ish" headset, and an Android application ( https://gitlab.com/20kdc/gridlock-utopia/-/tree/master/mobile?ref_type=heads ) to stream back data to be written ( https://gitlab.com/20kdc/gridlock-utopia/-/blob/master/station3.py?ref_type=heads ).

Implementing support for the network protocol used above was considered, but ultimately I decided it wasn't likely to be even vaguely upstreamable - unexpected WinSock initialization could cause trouble for the parent application, and the protocol I used streams Android-specific data over OSC (changing the sensors was useful while trying to find a working setup).

This approach works for Monado and Neverball. (However, Sunshine limitations require the monitor to be occupied as the VR view. Therefore, for Monado, it is in practice required to use an input that 'bypasses' mouse focus, such as a gamepad. For Neverball, however, everything works.)

The driver can be activated by pointing OPENHMD_FILEDEV_0 (...) OPENHMD_FILEDEV_31 at a valid file. This mechanism, while crude, is well-supported on all target operating systems and easy to work with. The file format is essentially a machine-dependent C struct, but there are no alignment issues, so it is easily written by various languages (ByteBuffer in Java, struct in Python, string.pack in Lua).

The driver stores rotations as Euler angles, in radians. This was also chosen to be easy to work with.

This is sort of similar in spirit to Monado having an 'arduino' driver (presumably for SlimeVR).

However, this driver aims to allow a user to very quickly homebrew a 3DOF driver for a 'pure HMD' arrangement.

In particular, I am aiming to use this driver with Moonlight/Sunshine to stream to a Google Cardboard system.

Configuration is via environment variable to avoid the problem the "external" driver has (it's always present, unmarked, and needs to be ignored by end-user applications in practice).
@20kdc
Copy link
Author

20kdc commented Dec 15, 2023

Going to make this slightly more scalable to future expansion, expect commit within 24 hours

This should still be simple enough to actually get something working, but now most edge cases are covered
@20kdc
Copy link
Author

20kdc commented Dec 15, 2023

Format's been changed to allow for tracked controllers with buttons and to generally expose more data and metadata.
Actual use of this mechanism on my end is probably not coming through owing to Bluetooth difficulties, but I can at least imagine it being used to link psmoveapi into all of this.

I should probably squash all of this into one commit, do tell me if I should do that.

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

Successfully merging this pull request may close these issues.

None yet

1 participant