pushrax / OpenVR-SpaceCalibrator

Use tracked VR devices from one company with any other.
MIT License
669 stars 111 forks source link

Calibration not picked up at startup #7

Closed muchcharles closed 4 years ago

muchcharles commented 5 years ago

When starting things up my calibrations never seem to be picked up from previous runs. Is copy chaperone bounds to profile required for that functionality? When calibrating, I do see it say the calibration was saved to config.

Also, when I am using a WMR and calibrate Vive controllers, as soon as I turn them off (or they turn off due to idle) and back on again they are uncalibrated again, even though steamvr and the calibrator program never exited.

pushrax commented 5 years ago

There seem to be a couple cases that prevent profiles from being saved properly:

  1. Steam installed to a different drive than SteamVR
  2. SteamVR sometimes doesn't create the config folder

I plan to use a different approach to saving the configuration, until then it can be worked around by either putting SteamVR in the same drive as Steam if 1. is your issue, or creating the folder config/01spacecalibrator in the Steam folder if 2. is your issue.

muchcharles commented 5 years ago

Hey, I think I found the issue:


void LoadProfile(CalibrationContext &ctx)
{
    ctx.validProfile = false;

    std::ifstream file(ConfigFileName());
    if (!file.good())
    {
        std::cout << "Profile missing, trying fallback path" << std::endl;
        // Fallback to working directory, which was the default for a long time.
        file = std::ifstream("openvr_space_calibration.json");
    }

It tries to create the file, but it doesn't try to create the directory (\..\..\..\config\01spacecalibrator\calibration.json).

When I manually created the directory here it worked: C:\Program Files (x86)\Steam\config\01spacecalibrator

Also, C++ didn't have any native support for directories for a long time, but they very recently added it (if you are on c++17): https://en.cppreference.com/w/cpp/filesystem/create_directory

pushrax commented 4 years ago

As of v1.0 the config is stored in the registry.