Compare commits

...
3 Commits
2 changed files with 36 additions and 20 deletions

No files matched your search

+34 -14
View File
@@ -257,7 +257,7 @@ Sample CollectSample(const CalibrationContext &ctx)
reference.bPoseIsValid = false;
target.bPoseIsValid = false;
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseStanding, 0.0f, devicePoses, vr::k_unMaxTrackedDeviceCount);
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseRawAndUncalibrated, 0.0f, devicePoses, vr::k_unMaxTrackedDeviceCount);
reference = devicePoses[ctx.referenceID];
target = devicePoses[ctx.targetID];
@@ -279,7 +279,7 @@ bool PickDevices(CalibrationContext &ctx)
char buffer[vr::k_unMaxPropertyStringSize];
vr::TrackedDevicePose_t devicePoses[vr::k_unMaxTrackedDeviceCount];
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseStanding, 0.0f, devicePoses, vr::k_unMaxTrackedDeviceCount);
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseRawAndUncalibrated, 0.0f, devicePoses, vr::k_unMaxTrackedDeviceCount);
for (uint32_t id = 0; id < vr::k_unMaxTrackedDeviceCount; ++id)
{
@@ -403,30 +403,50 @@ void ScanAndApplyProfile(const CalibrationContext &ctx)
{
char buffer[vr::k_unMaxPropertyStringSize];
vr::TrackedDevicePose_t devicePoses[vr::k_unMaxTrackedDeviceCount];
vr::VRSystem()->GetDeviceToAbsoluteTrackingPose(vr::TrackingUniverseRawAndUncalibrated, 0.0f, devicePoses, vr::k_unMaxTrackedDeviceCount);
for (uint32_t id = 0; id < vr::k_unMaxTrackedDeviceCount; ++id)
{
auto deviceClass = vr::VRSystem()->GetTrackedDeviceClass(id);
if (deviceClass == vr::TrackedDeviceClass_Invalid)
continue;
/*if (deviceClass == vr::TrackedDeviceClass_HMD) // for debugging unexpected universe switches
{
vr::ETrackedPropertyError err = vr::TrackedProp_Success;
auto universeId = vr::VRSystem()->GetUint64TrackedDeviceProperty(id, vr::Prop_CurrentUniverseId_Uint64, &err);
printf("uid %d err %d\n", universeId, err);
continue;
}*/
vr::ETrackedPropertyError err = vr::TrackedProp_Success;
vr::VRSystem()->GetStringTrackedDeviceProperty(id, vr::Prop_TrackingSystemName_String, buffer, vr::k_unMaxPropertyStringSize, &err);
if (err == vr::TrackedProp_Success)
if (err != vr::TrackedProp_Success)
continue;
std::string trackingSystem(buffer);
if (trackingSystem != ctx.calibratedTrackingSystem)
continue;
if (deviceClass == vr::TrackedDeviceClass_TrackingReference)
{
std::string trackingSystem(buffer);
// TODO(pushrax): detect zero reference switches and adjust calibration automatically
//auto p = devicePoses[id].mDeviceToAbsoluteTracking.m;
//printf("%d: %f %f %f\n", id, p[0][3], p[1][3], p[2][3]);
}
else
{
//printf("setting calibration for %d (%s)\n", id, buffer);
auto vrRotQuat = VRRotationQuat(ctx.calibratedRotation);
InputEmulator.setWorldFromDriverRotationOffset(id, vrRotQuat);
if (trackingSystem == ctx.calibratedTrackingSystem)
{
//printf("setting calibration for %d (%s)\n", id, buffer);
auto vrRotQuat = VRRotationQuat(ctx.calibratedRotation);
InputEmulator.setWorldFromDriverRotationOffset(id, vrRotQuat);
auto vrTransVec = VRTranslationVec(ctx.calibratedTranslation);
InputEmulator.setWorldFromDriverTranslationOffset(id, vrTransVec);
auto vrTransVec = VRTranslationVec(ctx.calibratedTranslation);
InputEmulator.setWorldFromDriverTranslationOffset(id, vrTransVec);
InputEmulator.enableDeviceOffsets(id, true);
}
InputEmulator.enableDeviceOffsets(id, true);
}
}
}
+2 -6
View File
@@ -2,7 +2,7 @@
Use VR devices from one company with any other.
This is **beta software** and may not work for you. A quick video demo is available at https://www.youtube.com/watch?v=W3TnQd9JMl4
This is **beta software** and may not work for you. A quick video walkthrough of the calibration process is available at https://www.youtube.com/watch?v=W3TnQd9JMl4
## Usage
@@ -13,7 +13,6 @@ If you don't already run a setup with multiple device types, see [Setting up Ste
0. Install [OpenVR-InputEmulator](https://github.com/matzman666/OpenVR-InputEmulator).
1. Download and unzip the [latest release](https://github.com/pushrax/OpenVR-SpaceCalibrator/releases) of OpenVR-SpaceCalibrator.
2. Run SteamVR, and turn on your Touch controllers and only one Vive device to use for calibration.
* Make sure your SteamVR and Oculus room setups are correct. If a lighthouse or sensor has moved since your last room setup, the calibration won't be calculated properly.
3. Run OpenVR-SpaceCalibrator.
4. Hold the left Touch controller and your Vive device in your left hand securely, like they're glued together.
5. Click "Start Calibration"
@@ -28,7 +27,7 @@ Every hardware designer with their own tracking system needs to make a "driver"
so SteamVR can see their tracking data. SteamVR by default will load only one driver at a time,
but we can tell it to load all of them by editing the vrsettings config file.
Open `steam\steamapps\common\SteamVR\resources\settings\default.vrsettings` in a text editor,
Open `Steam\steamapps\common\SteamVR\resources\settings\default.vrsettings` in a text editor,
look for the line that has `"activateMultipleDrivers": false` and change the `false` to `true`.
In some guides online you may also see references to `requireHmd`, this does _not_ need to be changed
unless you truly want to be able to run without any kind of HMD.
@@ -36,9 +35,6 @@ unless you truly want to be able to run without any kind of HMD.
Sometimes when SteamVR updates this file seems to get wiped, if your setup stops working you might
have to edit the config again.
Make sure to run room setup in your HMD's software (e.g. Oculus) and also in SteamVR.
An inaccurate room setup will make the automatic calibration inaccurate too.
### Manually editing the calibration
If you'd like to make a manual change to the calibration, the values are in `openvr_space_calibration.txt` in the same folder as the exe.