ValveSoftware / openvr

OpenVR SDK
http://steamvr.com
BSD 3-Clause "New" or "Revised" License
6.1k stars 1.28k forks source link

FEATURE REQUEST: A way for an HMD driver to request a SeatedZeroPoseReset #470

Closed TheDeveloperGuy closed 3 years ago

TheDeveloperGuy commented 7 years ago

There are numerous scenarios in the case of self-tracked HMDs where it would be useful for the driver to do the equivalent of recentering the seated position. As per https://github.com/ValveSoftware/openvr/issues/403 it is not possible right now. It is possible to do transformations on the pose to achieve this within the driver (or HMD), but a better solution would be triggering the equivalent of resetting the seated view in the SteamVR dashboard.

HelenXR commented 7 years ago

I very much agree with this approach, the function of steamVR direct support is the best In addition, according to my test, not all the applications' forward are in the yaw direction of 0 degrees, which will cause trouble for the reset function.

TheDeveloperGuy commented 7 years ago

I have managed to get this working in my driver for most scenarios. Biggest issue for HMDs that are not using fixed spatial positioning, either with external sensors (eg. Lighthouse or constellation), or with a magnetic compass, is that the HMD driver has no concept of 'forward', meaning that the user has to manually recenter.

TheDeveloperGuy commented 7 years ago

Have this working completely now where user can reset center via dashboard, room setup or headset. It does require the Chaperone yaw offset to be known in the driver, and for the driver to be made aware when it changes. I'm doing this by spying on the Chaperone's JSON config. It's not the "right" way, but it works.

HelenXR commented 7 years ago

That's what I think about this:

TheDeveloperGuy commented 7 years ago

@HelenXR Your solution in the other post will work if you edit the Chaperone config file and set the yaw offset to 0 (for testing, as you cannot prevent the user from changing this). Your HMD driver will need to report yaw as zero when it is centered. Once you have this working, you can figure out how to apply the Chaperone offset, and what to do when it changes. Whatever will happen with this feature request will (maybe) be some time in the future. It is possible to have this working with the current SteamVR API today.

Whatever solution you implement has to work for all 3 use cases: you cannot change existing apps, you cannot disable the SteamVR room setup or recenter functions, and for some use cases (as discussed) the driver needs to do this itself.

Seems to me, some fairly big changes to the SteamVR architecture would be needed for this feature as originally requested:

It seems the easiest way to do this would be to add a method to the tracked device class that receives Chaperone info. With the Chaperone info, it's possible for the driver to do all of the offset calculations for recentering.

LoSealL commented 7 years ago

@TheDeveloperGuy I'm guided here by you in #403 , now I'm using VRServerDriverHost()->PollNextEvent on VREvent_ChaperoneDataHasChanged, and once it has changed, I trigger my driver to record the current YAW data and recenter the HMD by this.

TheDeveloperGuy commented 7 years ago

@LoSealL That works? I'm doing file system spying on the Chaperone config file, which works, but is a bit "not really how you should be doing this".

LoSealL commented 7 years ago

@TheDeveloperGuy Oh, sorry. seems not every room-setup triggers VREvent_ChaperoneDataHasChanged. In fact there are 5 related events, but seems none of them can be polled when user runs room-setup.

Sometimes I can poll VREvent_ChaperoneDataHasChanged event and the chaperone data DOES changed, but most times I can't.

TheDeveloperGuy commented 7 years ago

The lack of detailed useful information on developing HMD drivers is very frustrating. You'd think that Valve would realise that every new HMD working properly on SteamVR would be bringing them additional customers and that they would at least dedicate 1 developer to dealing with device developers. As it stands everything to do with driver development is top secret with occasional clues given by Valve developers, which then obviously leads to sub-standard HMD implementations which then affect the overall quality perception of their product... Sheesh :/

Balderick commented 7 years ago

The documentation appearing to be scant is probably the most neutral way to describe the current openvr capabilities though

TheDeveloperGuy commented 7 years ago

Saying "the documentation appearing to be scant" is an understatement on the level of "the universe is biggish"... :D

HelenXR commented 7 years ago

Steam currently has two ways to reset the application:

  1. running steamVR "Run Room Setup", this is too much trouble
  2. steamVR--->Display Mirror, at this interface, keyboard input'z'.

How do I map the second styles of keys to other keys or trigger them without starting Display Mirror? @TheDeveloperGuy

TheDeveloperGuy commented 7 years ago

@HelenXR I have no idea, as discussed earlier in this thread, there is no way (that I know of) for a driver to trigger the "normal" re-center action. I track the Chaperone yaw offset in my driver and offset accordingly when it changes.

HelenXR commented 7 years ago

I see , thank you!

TheDeveloperGuy commented 7 years ago

The "correct" (Valve) way to do this seems to be to spawn a monitor app (dashboard app with no UI) from your driver, which you communicate with with VendorSpecificEvent() and (if necessary) DebugRequest(). Your driver tells the monitor to do a re-center and the monitor resets the seated position.

However this method means that you have to bundle an extra app with your driver, as well as openvr_api.dll for both 32 & 64 bit.

Would be awesome if Valve devs took a bit more time to address issues here rather than us having to waste large amounts of time discovering things that could be revealed with a single sentence from a dev that knows what's going on behind the scenes... ☹️

TheDeveloperGuy commented 3 years ago

"Monitor" app seems to be the way to work around most OpenVR design issues, including this one.