ValveSoftware / openvr

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

Chaperone calibration being ignored with `"requireHmd" : false` and no HMD's attached #402

Open kungfuelmosan opened 7 years ago

kungfuelmosan commented 7 years ago

Hey guys,

I'm seeing an issue where Chaperone calibration settings are being ignored when running with "requireHmd" : false from a VRApplication_Other application, when no HMD's are attached.

Specifically, we're trying to use a pair of HTC Vive controllers in wireless mode - via 2 Watchman dongles we have from some old dev kits. I've upgraded the dongle firmware, paired the 2 controllers with them and they seem to be working in general. Running SteamVR, I can see the controllers appear alongside the lighthouse bases with solid green status in the Monitor. I'm also seeing valid poses returned via GetDeviceToAbsoluteTrackingPose.

However, the poses seem to be being returned in raw un-calibrated space, even though I'm passing in TrackingUniverseStanding. After a bit of testing I've found that the problem seems to stem from Chaperone calibration having an issue with "requireHmd" : false and no HMD attached / no HMD being tracked, returning ChaperoneCalibrationState_Error from IVRChaperone::GetCalibrationState().

I've put together a repeatable test case to show the issue:

#include <iostream>

// openvr-1.0.6
#include <openvr.h>

int main(int argc, char **argv)
{
    // Init OpenVR
    vr::HmdError HmdError;
    vr::IVRSystem* VRSystem = vr::VR_Init(&HmdError, vr::VRApplication_Other);
    if (HmdError != vr::VRInitError_None)
    {
        VRSystem = nullptr;
        std::cout << "Error during OpenVR runtime init: " << vr::VR_GetVRInitErrorAsEnglishDescription(HmdError) << std::endl;
        return -1;
    }

    // Get chaperone calibration state
    std::cout << "Chaperone Calibration State: " << (int)vr::VRChaperone()->GetCalibrationState() << std::endl;

    // Shutdown OpenVR
    vr::VR_Shutdown();
}

Running this without an HMD attached, for me atleast, is printing Chaperone Calibration State: 200. With a Vive HMD attached and no other config changes etc I'm seeing Chaperone Calibration State: 1. Interestingly I'm also getting 200 (ChaperoneCalibrationState_Error) when the HMD is attached but not tracking.

Is this expected behaviour?

Lighthouse, vrsettings & caperon config files + logs: ConfigAndLogs.zip

Note: I've not included GetDeviceToAbsoluteTrackingPose in the above example for simplicity, under the assumption the chaperone calibration error is the root of the issue.

kungfuelmosan commented 7 years ago

Should also note I'm seeing the same result with wired controllers & no HMD attached, not just with the Watchman dongle setup.

larryPlayabl commented 7 years ago

I am working on an HMD-less project using a tracker and base stations only. I'm seeing this same behavior. Is there any recommended workaround?

larryPlayabl commented 7 years ago

This page on the wiki says that the chaperone tracking universe won't be detected until the HMD is being tracked. Is this the root of the problem?

https://github.com/ValveSoftware/openvr/wiki/IVRChaperone_Overview

larryPlayabl commented 7 years ago

In my vrserver log I do see a Universe being selected, so that wiki page may just be out of date. e.g. I see this in my log with no HMD connected:

Selected existing universe 1493852996 (4D611C32 is secondary)

larryPlayabl commented 7 years ago

I have now managed to get this loading calibration data by using the null driver. Any drawback to this approach? Here are the steps:

Null driver settings in C:\Program Files (x86)\Steam\steamapps\common\SteamVR\drivers\null\resources\settings switch“enable” to true

Default settings in C:\Program Files (x86)\Steam\steamapps\common\SteamVR\resources\settings requireHmd - set false (though may not matter if using null) forcedDriver: set to “null” activateMultipleDrivers: set to true

TKaluza commented 4 years ago

@larryPlayabl Any update on that? I'm also working with just a two lighthouses and a tracker. Is there any possibility to to the Chaperone calibration just with a tracker?

larryPlayabl commented 4 years ago

@TKaluza Sorry to say I never found a way around using the null driver. It also never caused me any issues :)

I never found a way to do chaperone with tracker only either. I always used a controller for that step, and then I'd lock the calibration files by making them read only since I was doing this for a permanent installation.