Compare commits

...
19 Commits
Author SHA1 Message Date
Justin Li 15a16eb14c Export symbols to enable high performance rendering, fixes #55 2021-11-08 00:39:06 -05:00
Justin Li 4dba5fd7fe Rebuild minhook for v141, update versions 2021-11-08 00:36:33 -05:00
Justin Li 984b93ffff Merge pull request #65 from brian-armstrong/scale_config
Driver Scale Parameter
2021-11-07 23:38:51 -05:00
Justin Li 55242e7d56 Update build system to v141 2021-11-07 23:37:33 -05:00
Brian Armstrong c6eb49d580 scale vecPosition
This looks like the right thing to scale
2021-11-02 00:48:27 -07:00
Brian Armstrong e599ac136d make the steps smaller
The correct value is probably between 0.99 and 1.01. Let's use really
small steps here.
2021-11-02 00:46:33 -07:00
Brian Armstrong bd50a8c207 Driver Scale Parameter
Also stash to serialized config and allow editing from editor
2021-10-31 16:17:16 -07:00
Justin Li f3b4f9475e readme: add wiki link 2021-07-31 01:34:18 -04:00
Justin Li d060b98581 Merge pull request #39 from monstermac77/monstermac77-reddit-community
Added Reddit community link
2020-11-23 14:14:50 -05:00
monstermac77 da869868a1 Added Reddit community link
Added a link for the newly created Reddit community, with the goal of having a place for users of Open VR Space Calibrator to work together and troubleshoot in a more public (indexed by search engines) and less linear forum than Discord. Hopefully this will increase the discoverability of mixed VR, help existing users of mixed VR troubleshoot issues by being able to Google them, as well as reduce some of the repetitive questions on the Discord.
2020-11-23 01:27:22 -05:00
Justin Li 8e6796a9b5 Log device info when starting calibration 2020-10-25 15:05:02 -04:00
Justin Li 6389d745ae Update issue templates 2020-10-12 17:15:03 -04:00
Justin Li 326b54ba74 Update issue templates 2020-10-12 17:13:51 -04:00
Justin Li 98b23ad5bb Update README.md 2020-09-10 22:20:41 -04:00
Justin Li 7788c2af38 Update README.md 2020-09-08 20:15:28 -04:00
Justin Li 5334084508 Update README.md 2020-09-08 20:12:20 -04:00
Justin Li 9752a3be05 Update README for v1.1 2020-09-08 20:04:09 -04:00
Justin Li 8323d64b2d Support IVRServerDriverHost_006 2020-09-02 11:54:55 -04:00
Justin Li b04615dcb6 Store config in the registry 2020-04-08 00:25:01 -04:00
28 changed files with 214 additions and 107 deletions

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
---
name: Bug report
about: Something is broken
title: ''
labels: bug
assignees: ''
---
<!--
If you are having trouble setting this up with SteamVR and would like help, the fastest way is to ask in the Discord group. https://discord.com/invite/m7g2Wyj
If you are having issues after updating SteamVR, please check for a new release at https://github.com/pushrax/OpenVR-SpaceCalibrator/releases before posting an issue.
-->
+10
View File
@@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
+14 -5
View File
@@ -269,7 +269,7 @@ void ResetAndDisableOffsets(uint32_t id)
zeroQ.x = 0; zeroQ.y = 0; zeroQ.z = 0; zeroQ.w = 1;
protocol::Request req(protocol::RequestSetDeviceTransform);
req.setDeviceTransform = { id, false, zeroV, zeroQ };
req.setDeviceTransform = { id, false, zeroV, zeroQ, 1.0 };
Driver.SendBlocking(req);
}
@@ -338,7 +338,8 @@ void ScanAndApplyProfile(CalibrationContext &ctx)
id,
true,
VRTranslationVec(ctx.calibratedTranslation),
VRRotationQuat(ctx.calibratedRotation)
VRRotationQuat(ctx.calibratedRotation),
ctx.calibratedScale
};
Driver.SendBlocking(req);
}
@@ -404,6 +405,16 @@ void CalibrationTick(double time)
{
bool ok = true;
char referenceSerial[256], targetSerial[256];
vr::VRSystem()->GetStringTrackedDeviceProperty(ctx.referenceID, vr::Prop_SerialNumber_String, referenceSerial, 256);
vr::VRSystem()->GetStringTrackedDeviceProperty(ctx.targetID, vr::Prop_SerialNumber_String, targetSerial, 256);
char buf[256];
snprintf(buf, sizeof buf, "Reference device ID: %d, serial: %s\n", ctx.referenceID, referenceSerial);
CalCtx.Log(buf);
snprintf(buf, sizeof buf, "Target device ID: %d, serial %s\n", ctx.targetID, targetSerial);
CalCtx.Log(buf);
if (ctx.referenceID == -1)
{
CalCtx.Log("Missing reference device\n"); ok = false;
@@ -433,9 +444,7 @@ void CalibrationTick(double time)
ctx.state = CalibrationState::Rotation;
ctx.wantedUpdateInterval = 0.0;
char buf[256];
snprintf(buf, sizeof buf, "Starting calibration, referenceID=%d targetID=%d\n", ctx.referenceID, ctx.targetID);
CalCtx.Log(buf);
CalCtx.Log("Starting calibration...\n");
return;
}
+2
View File
@@ -20,6 +20,7 @@ struct CalibrationContext
Eigen::Vector3d calibratedRotation;
Eigen::Vector3d calibratedTranslation;
double calibratedScale;
std::string referenceTrackingSystem;
std::string targetTrackingSystem;
@@ -57,6 +58,7 @@ struct CalibrationContext
calibratedRotation = Eigen::Vector3d();
calibratedTranslation = Eigen::Vector3d();
calibratedScale = 1.0;
referenceTrackingSystem = "";
targetTrackingSystem = "";
enabled = false;
+87 -71
View File
@@ -9,19 +9,7 @@
#include <iomanip>
#include <limits>
static void UpgradeProfileV1(CalibrationContext &ctx);
static void ParseProfileV2(CalibrationContext &ctx, std::istream &stream);
static std::string ConfigFileName()
{
char cruntimePath[MAX_PATH] = { 0 };
unsigned int pathLen;
vr::VR_GetRuntimePath(cruntimePath, MAX_PATH, &pathLen);
std::string vrRuntimeConfigName(cruntimePath);
return vrRuntimeConfigName + "\\..\\..\\..\\config\\01spacecalibrator\\calibration.json";
}
picojson::array FloatArray(const float *buf, int numFloats)
static picojson::array FloatArray(const float *buf, int numFloats)
{
picojson::array arr;
@@ -31,7 +19,7 @@ picojson::array FloatArray(const float *buf, int numFloats)
return arr;
}
void LoadFloatArray(const picojson::value &obj, float *buf, int numFloats)
static void LoadFloatArray(const picojson::value &obj, float *buf, int numFloats)
{
if (!obj.is<picojson::array>())
throw std::runtime_error("expected array, got " + obj.to_str());
@@ -44,38 +32,7 @@ void LoadFloatArray(const picojson::value &obj, float *buf, int numFloats)
buf[i] = (float) arr[i].get<double>();
}
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");
}
if (!file.good())
{
std::cout << "Fallback profile missing, trying V1 path" << std::endl;
UpgradeProfileV1(ctx);
return;
}
try
{
ParseProfileV2(ctx, file);
std::cout << "Loaded profile" << std::endl;
}
catch (const std::runtime_error &e)
{
std::cerr << "Error loading profile: " << e.what() << std::endl;
}
}
static void ParseProfileV2(CalibrationContext &ctx, std::istream &stream)
static void ParseProfile(CalibrationContext &ctx, std::istream &stream)
{
picojson::value v;
std::string err = picojson::parse(v, stream);
@@ -97,6 +54,11 @@ static void ParseProfileV2(CalibrationContext &ctx, std::istream &stream)
ctx.calibratedTranslation(1) = obj["y"].get<double>();
ctx.calibratedTranslation(2) = obj["z"].get<double>();
if (obj["scale"].is<double>())
ctx.calibratedScale = obj["scale"].get<double>();
else
ctx.calibratedScale = 1.0;
if (obj["calibration_speed"].is<double>())
ctx.calibrationSpeed = (CalibrationContext::Speed)(int) obj["calibration_speed"].get<double>();
@@ -130,17 +92,10 @@ static void ParseProfileV2(CalibrationContext &ctx, std::istream &stream)
ctx.validProfile = true;
}
void SaveProfile(CalibrationContext &ctx)
static void WriteProfile(CalibrationContext &ctx, std::ostream &out)
{
std::cout << "Saving profile to " << ConfigFileName() << std::endl;
std::ofstream file(ConfigFileName());
if (!ctx.validProfile)
{
file << "[]";
return;
}
picojson::object profile;
profile["reference_tracking_system"].set<std::string>(ctx.referenceTrackingSystem);
@@ -151,6 +106,7 @@ void SaveProfile(CalibrationContext &ctx)
profile["x"].set<double>(ctx.calibratedTranslation(0));
profile["y"].set<double>(ctx.calibratedTranslation(1));
profile["z"].set<double>(ctx.calibratedTranslation(2));
profile["scale"].set<double>(ctx.calibratedScale);
double speed = (int) ctx.calibrationSpeed;
profile["calibration_speed"].set<double>(speed);
@@ -183,30 +139,90 @@ void SaveProfile(CalibrationContext &ctx)
picojson::value profilesV;
profilesV.set<picojson::array>(profiles);
file << profilesV.serialize(true);
out << profilesV.serialize(true);
}
static void UpgradeProfileV1(CalibrationContext &ctx)
static void LogRegistryResult(LSTATUS result)
{
char *message;
FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, 0, result, LANG_USER_DEFAULT, (LPSTR)&message, 0, NULL);
std::cerr << "Opening registry key: " << message << std::endl;
}
static const char *RegistryKey = "Software\\OpenVR-SpaceCalibrator";
static std::string ReadRegistryKey()
{
DWORD size = 0;
auto result = RegGetValueA(HKEY_CURRENT_USER_LOCAL_SETTINGS, RegistryKey, "Config", RRF_RT_REG_SZ, 0, 0, &size);
if (result != ERROR_SUCCESS)
{
LogRegistryResult(result);
return "";
}
std::string str;
str.resize(size);
result = RegGetValueA(HKEY_CURRENT_USER_LOCAL_SETTINGS, RegistryKey, "Config", RRF_RT_REG_SZ, 0, &str[0], &size);
if (result != ERROR_SUCCESS)
{
LogRegistryResult(result);
return "";
}
str.resize(size - 1);
return str;
}
static void WriteRegistryKey(std::string str)
{
HKEY hkey;
auto result = RegCreateKeyExA(HKEY_CURRENT_USER_LOCAL_SETTINGS, RegistryKey, 0, REG_NONE, 0, KEY_ALL_ACCESS, 0, &hkey, 0);
if (result != ERROR_SUCCESS)
{
LogRegistryResult(result);
return;
}
DWORD size = str.size() + 1;
result = RegSetValueExA(hkey, "Config", 0, REG_SZ, reinterpret_cast<const BYTE*>(str.c_str()), size);
if (result != ERROR_SUCCESS)
LogRegistryResult(result);
RegCloseKey(hkey);
}
void LoadProfile(CalibrationContext &ctx)
{
std::ifstream file("openvr_space_calibration.txt");
ctx.validProfile = false;
if (!file.good())
auto str = ReadRegistryKey();
if (str == "")
{
std::cout << "Profile is empty" << std::endl;
ctx.Clear();
return;
}
file
>> ctx.targetTrackingSystem
>> ctx.calibratedRotation(1) // yaw
>> ctx.calibratedRotation(2) // pitch
>> ctx.calibratedRotation(0) // roll
>> ctx.calibratedTranslation(0) // x
>> ctx.calibratedTranslation(1) // y
>> ctx.calibratedTranslation(2); // z
try
{
std::stringstream io(str);
ParseProfile(ctx, io);
std::cout << "Loaded profile" << std::endl;
}
catch (const std::runtime_error &e)
{
std::cerr << "Error loading profile: " << e.what() << std::endl;
}
}
ctx.validProfile = true;
void SaveProfile(CalibrationContext &ctx)
{
std::cout << "Saving profile to registry" << std::endl;
SaveProfile(ctx);
file.close();
std::remove("openvr_space_calibration.txt");
std::stringstream io;
WriteProfile(ctx, io);
WriteRegistryKey(io.str());
}
+1 -1
View File
@@ -31,7 +31,7 @@ void IPCClient::Connect()
if (pipe == INVALID_HANDLE_VALUE)
{
throw std::runtime_error("Space Calibrator driver unavailable, is SteamVR running and not in safe mode? Error: " + LastErrorString(GetLastError()));
throw std::runtime_error("Space Calibrator driver unavailable. Make sure SteamVR is running, and the Space Calibrator addon is enabled in SteamVR settings.");
}
DWORD mode = PIPE_READMODE_MESSAGE;
@@ -18,6 +18,9 @@ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#define OPENVR_APPLICATION_KEY "pushrax.SpaceCalibrator"
extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
void CreateConsole()
{
static bool created = false;
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
@@ -14,19 +14,19 @@
<ProjectGuid>{63BAE169-D595-4464-8E7E-50D6FD379348}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>OpenVRSpaceCalibrator</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@@ -85,6 +85,7 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Version.h" />
<ClInclude Include="Calibration.h" />
<ClInclude Include="Configuration.h" />
<ClInclude Include="EmbeddedFiles.h" />
@@ -42,6 +42,9 @@
<ClInclude Include="IPCClient.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Version.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
+6 -3
View File
@@ -2,6 +2,7 @@
#include "UserInterface.h"
#include "Calibration.h"
#include "Configuration.h"
#include "../Version.h"
#include <thread>
#include <string>
@@ -9,8 +10,6 @@
#include <algorithm>
#include <imgui/imgui.h>
#define VERSION_STRING "0.9.2"
struct VRDevice
{
int id = -1;
@@ -173,7 +172,7 @@ void BuildMenu(bool runningInOverlay)
ImGui::SetNextWindowPos(ImVec2(10.0f, ImGui::GetWindowHeight() - ImGui::GetItemsLineHeightWithSpacing()));
ImGui::BeginChild("bottom line", ImVec2(ImGui::GetWindowWidth() - 20.0f, ImGui::GetItemsLineHeightWithSpacing() * 2), false);
ImGui::Text("OpenVR Space Calibrator v" VERSION_STRING " - by tach/pushrax");
ImGui::Text("OpenVR Space Calibrator v" SPACECAL_VERSION_STRING " - by tach/pushrax");
if (runningInOverlay)
{
ImGui::SameLine();
@@ -489,6 +488,10 @@ void BuildProfileEditor()
ImGui::InputDouble("##Y", &CalCtx.calibratedTranslation(1), 1.0, 10.0, "%.8f");
ImGui::SameLine();
ImGui::InputDouble("##Z", &CalCtx.calibratedTranslation(2), 1.0, 10.0, "%.8f");
TextWithWidth("ScaleLabel", "Scale", width);
ImGui::InputDouble("##Scale", &CalCtx.calibratedScale, 0.0001, 0.01, "%.8f");
ImGui::PopItemWidth();
}
@@ -9,15 +9,28 @@ static Hook<void*(*)(vr::IVRDriverContext *, const char *, vr::EVRInitError *)>
GetGenericInterfaceHook("IVRDriverContext::GetGenericInterface");
static Hook<void(*)(vr::IVRServerDriverHost *, uint32_t, const vr::DriverPose_t &, uint32_t)>
TrackedDevicePoseUpdatedHook("IVRServerDriverHost005::TrackedDevicePoseUpdated");
TrackedDevicePoseUpdatedHook005("IVRServerDriverHost005::TrackedDevicePoseUpdated");
static void DetourTrackedDevicePoseUpdated(vr::IVRServerDriverHost *_this, uint32_t unWhichDevice, const vr::DriverPose_t &newPose, uint32_t unPoseStructSize)
static Hook<void(*)(vr::IVRServerDriverHost *, uint32_t, const vr::DriverPose_t &, uint32_t)>
TrackedDevicePoseUpdatedHook006("IVRServerDriverHost006::TrackedDevicePoseUpdated");
static void DetourTrackedDevicePoseUpdated005(vr::IVRServerDriverHost *_this, uint32_t unWhichDevice, const vr::DriverPose_t &newPose, uint32_t unPoseStructSize)
{
//TRACE("ServerTrackedDeviceProvider::DetourTrackedDevicePoseUpdated(%d)", unWhichDevice);
auto pose = newPose;
if (Driver->HandleDevicePoseUpdated(unWhichDevice, pose))
{
TrackedDevicePoseUpdatedHook.originalFunc(_this, unWhichDevice, pose, unPoseStructSize);
TrackedDevicePoseUpdatedHook005.originalFunc(_this, unWhichDevice, pose, unPoseStructSize);
}
}
static void DetourTrackedDevicePoseUpdated006(vr::IVRServerDriverHost *_this, uint32_t unWhichDevice, const vr::DriverPose_t &newPose, uint32_t unPoseStructSize)
{
//TRACE("ServerTrackedDeviceProvider::DetourTrackedDevicePoseUpdated(%d)", unWhichDevice);
auto pose = newPose;
if (Driver->HandleDevicePoseUpdated(unWhichDevice, pose))
{
TrackedDevicePoseUpdatedHook006.originalFunc(_this, unWhichDevice, pose, unPoseStructSize);
}
}
@@ -29,10 +42,18 @@ static void *DetourGetGenericInterface(vr::IVRDriverContext *_this, const char *
std::string iface(pchInterfaceVersion);
if (iface == "IVRServerDriverHost_005")
{
if (!IHook::Exists(TrackedDevicePoseUpdatedHook.name))
if (!IHook::Exists(TrackedDevicePoseUpdatedHook005.name))
{
TrackedDevicePoseUpdatedHook.CreateHookInObjectVTable(originalInterface, 1, &DetourTrackedDevicePoseUpdated);
IHook::Register(&TrackedDevicePoseUpdatedHook);
TrackedDevicePoseUpdatedHook005.CreateHookInObjectVTable(originalInterface, 1, &DetourTrackedDevicePoseUpdated005);
IHook::Register(&TrackedDevicePoseUpdatedHook005);
}
}
else if (iface == "IVRServerDriverHost_006")
{
if (!IHook::Exists(TrackedDevicePoseUpdatedHook006.name))
{
TrackedDevicePoseUpdatedHook006.CreateHookInObjectVTable(originalInterface, 1, &DetourTrackedDevicePoseUpdated006);
IHook::Register(&TrackedDevicePoseUpdatedHook006);
}
}
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
@@ -14,19 +14,19 @@
<ProjectGuid>{A61324AD-CE32-46D1-A95E-7E28A6D8CCA7}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>OpenVRSpaceCalibratorDriver</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.18362.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
@@ -85,7 +85,7 @@
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\lib\MinHook\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>libMinHook-x64-v140-md.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>libMinHook-x64-v141-md.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@@ -49,6 +49,9 @@ void ServerTrackedDeviceProvider::SetDeviceTransform(const protocol::SetDeviceTr
if (newTransform.updateRotation)
tf.rotation = newTransform.rotation;
if (newTransform.updateScale)
tf.scale = newTransform.scale;
}
bool ServerTrackedDeviceProvider::HandleDevicePoseUpdated(uint32_t openVRID, vr::DriverPose_t &pose)
@@ -58,6 +61,10 @@ bool ServerTrackedDeviceProvider::HandleDevicePoseUpdated(uint32_t openVRID, vr:
{
pose.qWorldFromDriverRotation = tf.rotation * pose.qWorldFromDriverRotation;
pose.vecPosition[0] *= tf.scale;
pose.vecPosition[1] *= tf.scale;
pose.vecPosition[2] *= tf.scale;
vr::HmdVector3d_t rotatedTranslation = quaternionRotateVector(tf.rotation, pose.vecWorldFromDriverTranslation);
pose.vecWorldFromDriverTranslation[0] = rotatedTranslation.v[0] + tf.translation.v[0];
pose.vecWorldFromDriverTranslation[1] = rotatedTranslation.v[1] + tf.translation.v[1];
@@ -46,6 +46,7 @@ private:
bool enabled = false;
vr::HmdVector3d_t translation;
vr::HmdQuaternion_t rotation;
double scale;
};
DeviceTransform transforms[vr::k_unMaxTrackedDeviceCount];
+2 -1
View File
@@ -1,4 +1,5 @@
#include "Logging.h"
#include "../Version.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
@@ -10,7 +11,7 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
{
case DLL_PROCESS_ATTACH:
OpenLogFile();
LOG("OpenVR-SpaceCalibratorDriver loaded");
LOG("OpenVR-SpaceCalibratorDriver " SPACECAL_VERSION_STRING " loaded");
break;
case DLL_PROCESS_DETACH:
LOG("OpenVR-SpaceCalibratorDriver unloaded");
+13 -5
View File
@@ -10,7 +10,7 @@
namespace protocol
{
const uint32_t Version = 1;
const uint32_t Version = 2;
enum RequestType
{
@@ -37,20 +37,28 @@ namespace protocol
bool enabled;
bool updateTranslation;
bool updateRotation;
bool updateScale;
vr::HmdVector3d_t translation;
vr::HmdQuaternion_t rotation;
double scale;
SetDeviceTransform(uint32_t id, bool enabled) :
openVRID(id), enabled(enabled), updateTranslation(false), updateRotation(false) { }
openVRID(id), enabled(enabled), updateTranslation(false), updateRotation(false), updateScale(false) { }
SetDeviceTransform(uint32_t id, bool enabled, vr::HmdVector3d_t translation) :
openVRID(id), enabled(enabled), updateTranslation(true), updateRotation(false), translation(translation) { }
openVRID(id), enabled(enabled), updateTranslation(true), updateRotation(false), updateScale(false), translation(translation) { }
SetDeviceTransform(uint32_t id, bool enabled, vr::HmdQuaternion_t rotation) :
openVRID(id), enabled(enabled), updateTranslation(false), updateRotation(true), rotation(rotation) { }
openVRID(id), enabled(enabled), updateTranslation(false), updateRotation(true), updateScale(false), rotation(rotation) { }
SetDeviceTransform(uint32_t id, bool enabled, double scale) :
openVRID(id), enabled(enabled), updateTranslation(false), updateRotation(false), updateScale(true), scale(scale) { }
SetDeviceTransform(uint32_t id, bool enabled, vr::HmdVector3d_t translation, vr::HmdQuaternion_t rotation) :
openVRID(id), enabled(enabled), updateTranslation(true), updateRotation(true), translation(translation), rotation(rotation) { }
openVRID(id), enabled(enabled), updateTranslation(true), updateRotation(true), updateScale(false), translation(translation), rotation(rotation) { }
SetDeviceTransform(uint32_t id, bool enabled, vr::HmdVector3d_t translation, vr::HmdQuaternion_t rotation, double scale) :
openVRID(id), enabled(enabled), updateTranslation(true), updateRotation(true), updateScale(true), translation(translation), rotation(rotation), scale(scale) { }
};
struct Request
+10 -5
View File
@@ -1,14 +1,19 @@
# OpenVR Space Calibrator
Use tracked VR devices from one company with any other.
This helps you use tracked VR devices from one company with any other. It aligns multiple tracking systems with a quick calibration step. It may not work for your setup, but there are many cases that work to a degree, and some work very well.
This is **experimental software** and may not work for your setup. It's well-tested for the Rift with Vive trackers though, with a community of a few hundred users ([Discord][]). It also seems to work for various HMDs (Windows MR, Rift) with Vive controllers and Knuckles prototypes. A quick video of how this works using an old version (~v0.3) is available at https://www.youtube.com/watch?v=W3TnQd9JMl4.
- Rift CV1 x Vive devices: works very well with the v2 (blue logo) trackers, v1 trackers (grey logo, not in production) have major interference issues in the IR spectrum, controller wands (both gen) and Index controllers work very well.
- Rift S, Quest, Windows MR, other SLAM inside-out tracked HMDs x Vive devices: works very well when you aren't moving around the room far (e.g. Beat Saber) but a lot of walking around causes a nontrivial amount of drift between systems. Your results may vary depending on your space. It's possible some of this can be fixed in software with a better calibration algorithm.
- Quest wireless streaming is particularly bad right now and requires frequent recalibration, but it does work for a short time until one of many factors causes it to drift. With wireless devices, moving slowly when calibrating and using the Slow or Very Slow calibration modes is effective at reducing the initial error.
- Any non-Rift HMD x Touch controllers: does not work, the Oculus driver requires the HMD is a Rift. It's theoretically possible to work around this in software but as far as I know it hasn't been done as it would require a fair amount of reverse engineering effort.
[Discord]: https://discord.gg/m7g2Wyj
There is a community of a few thousand on [**Discord**](https://discord.gg/m7g2Wyj) and a newer community on [**Reddit**](https://www.reddit.com/r/MixedVR/). You may find the answer to your question in [the **wiki**](https://github.com/pushrax/OpenVR-SpaceCalibrator/wiki).
A quick video of how this works using an old version (~v0.3) is available at https://www.youtube.com/watch?v=W3TnQd9JMl4. The user interface has been upgraded since then; the calibration is now done via a SteamVR dashboard menu, and there's much more configurability.
### Install
Before following the directions below, download and run the installer for the [latest release](https://github.com/pushrax/OpenVR-SpaceCalibrator/releases). This will automatically set up SteamVR for use with multiple tracking systems (`activateMultipleDrivers: true`).
Before following the directions below, download and run the installer for the [latest release](https://github.com/pushrax/OpenVR-SpaceCalibrator/releases). This will automatically set up SteamVR for use with multiple tracking systems (`activateMultipleDrivers: true`). There are many guides that say you need to edit the SteamVR config manually. You do not.
### Usage
@@ -39,7 +44,7 @@ You can calibrate without using the dashboard overlay by unminimizing Space Cali
### Compiling your own build
Open `OpenVR-SpaceCalibrator.sln` in Visual Studio 2015 and build. There are no external dependencies.
Open `OpenVR-SpaceCalibrator.sln` in Visual Studio 2017 and build. There are no external dependencies.
### The math
+3
View File
@@ -0,0 +1,3 @@
#pragma once
#define SPACECAL_VERSION_STRING "1.3"
+1 -1
View File
@@ -98,7 +98,7 @@ Section "Install" SecInstall
File "..\LICENSE"
File "..\x64\Release\OpenVR-SpaceCalibrator.exe"
File "..\x64\Release\openvr_api.dll"
File "..\lib\openvr\lib\win64\openvr_api.dll"
File "..\OpenVR-SpaceCalibrator\manifest.vrmanifest"
File "..\OpenVR-SpaceCalibrator\icon.png"
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.