OSVR / SteamVR-OSVR

An OSVR plugin for SteamVR, providing SteamVR support for OSVR HMDs.
Apache License 2.0
138 stars 57 forks source link

SteamVR-OSVR always tells OpenVR to apply a head model #105

Open 0x1100 opened 7 years ago

0x1100 commented 7 years ago

It should not

The driver always tells OpenVR to apply a head model when supplying the tracked position.

Proposed solution

A head model can easily be applied in the OSVR server configuration file. We should never ask OpenVR to add one and, instead, do it ourselves in OSVR if we're not using the camera. This way, people would get the same result whether they're using a Steam app or an OSVR one.

diff --git a/src/OSVRTrackedDevice.cpp b/src/OSVRTrackedDevice.cpp
index b450f24..cfee739 100644
--- a/src/OSVRTrackedDevice.cpp
+++ b/src/OSVRTrackedDevice.cpp
@@ -882,7 +882,7 @@ void OSVRTrackedDevice::HmdTrackerCallback(void* userdata, const OSVR_TimeValue*
     pose.result = vr::TrackingResult_Running_OK;
     pose.poseIsValid = true;
     pose.willDriftInYaw = true;
-    pose.shouldApplyHeadModel = true;
+    pose.shouldApplyHeadModel = false;
     pose.deviceIsConnected = true;

     self->pose_ = pose;

The following alias adds a head model close to the one supplied by OpenVR. A similar change will be done to the no-cam json files supplied by the AIO release.

"aliases": {
    "/headSpace": {
        "translate": [0.0, 0.10, -0.07],
        "child": "/com_osvr_Multiserver/OSVRHackerDevKit0/semantic/hmd"
    },
    "/me/head": "/headSpace"
}
godbyk commented 7 years ago

Since this entails modifying the configuration files in the OSVR-Core repository, I would suggest posting a PR there first. Once that's been merged in, I can disable the SteamVR head model.

0x1100 commented 7 years ago

No. It does not entails modifying the configuration files in the OSVR-Core repository since those that are complete all use the camera.

In any case, two wrongs don't make a right and both need to be fixed for the next release anyway so there is no good reason to make it drag on.

godbyk commented 7 years ago

@0x1100 In your original post, you said:

A head model can easily be applied in the OSVR server configuration file.

So to clarify, is a head model is already applied in the OSVR server configuration files?

In any case, two wrongs don't make a right and both need to be fixed for the next release anyway so there is no good reason to make it drag on.

I'm trying to ensure the head model doesn't get removed entirely. I don't care whether it's applied on the OSVR server side or on the SteamVR side, but it must be one or the other, not both or neither.

rpavlik commented 7 years ago

There's not a head model in the default configurations in OSVR-Core nor in any config with just an IMU, though as you noted it is easy to add one.

The presence of such a transform will result in position data being reported for the interface (since rotations will result in translation as well). Thus, I suggest detecting whether or not there is such a configuration by opening an object for /me/head, waiting until it has orientation state, then checking to see if it has position state. If it does have position state, then don't apply a SteamVR head model.

0x1100 commented 7 years ago

@rpavlik's solution is better but still sounds easy to implement. How fast can you do it?