summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2014-01-03 11:22:06 +0100
committerStanislaw Halik <sthalik@misaki.pl>2014-01-03 11:22:06 +0100
commita3df0c8a8d19655040c7d21812414d7a335def61 (patch)
tree6739401d8e59800731b2faf26e49b8df63664573 /ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
parent7307adbc3b8ec2213bc90a91deb1beb9198e7ff2 (diff)
parent519434cd1abb8991635487c6d84bc0d85367fc42 (diff)
Merge branch 'feature/settings-template'
Conflicts: README.md
Diffstat (limited to 'ftnoir_tracker_rift/ftnoir_tracker_rift.cpp')
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift.cpp83
1 files changed, 7 insertions, 76 deletions
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
index da44ea0c..b548db71 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
@@ -8,14 +8,6 @@ using namespace OVR;
Rift_Tracker::Rift_Tracker()
{
- bEnableRoll = true;
- bEnablePitch = true;
- bEnableYaw = true;
-#if 0
- bEnableX = true;
- bEnableY = true;
- bEnableZ = true;
-#endif
should_quit = false;
pManager = NULL;
pSensor = NULL;
@@ -34,14 +26,8 @@ Rift_Tracker::~Rift_Tracker()
System::Destroy();
}
-
-
void Rift_Tracker::StartTracker(QFrame*)
{
- loadSettings();
- //
- // Startup the Oculus SDK device handling, use the first Rift sensor we find.
- //
System::Init(Log::ConfigureDefaultLog(LogMask_All));
pManager = DeviceManager::Create();
if (pManager != NULL)
@@ -81,80 +67,25 @@ void Rift_Tracker::GetHeadPoseData(double *data)
newHeadPose[Pitch] = pitch;
newHeadPose[Roll] = roll;
newHeadPose[Yaw] = yaw;
- if (useYawSpring)
+ if (s.useYawSpring)
{
- newHeadPose[Yaw] = old_yaw*persistence + (yaw-old_yaw);
- if(newHeadPose[Yaw]>deadzone)newHeadPose[Yaw]-= constant_drift;
- if(newHeadPose[Yaw]<-deadzone)newHeadPose[Yaw]+= constant_drift;
+ newHeadPose[Yaw] = old_yaw*s.persistence + (yaw-old_yaw);
+ if(newHeadPose[Yaw]>s.deadzone)newHeadPose[Yaw]-= s.constant_drift;
+ if(newHeadPose[Yaw]<-s.deadzone)newHeadPose[Yaw]+= s.constant_drift;
old_yaw=yaw;
}
-#if 0
- newHeadPose[TX] = acd.controllers[0].pos[0]/50.0f;
- newHeadPose[TY] = acd.controllers[0].pos[1]/50.0f;
- newHeadPose[TZ] = acd.controllers[0].pos[2]/50.0f;
-
- if (bEnableX) {
- data[TX] = newHeadPose[TX];
- }
- if (bEnableY) {
- data[TY] = newHeadPose[TY];
- }
- if (bEnableY) {
- data[TZ] = newHeadPose[TZ];
- }
-#endif
- if (bEnableYaw) {
+ if (s.bEnableYaw) {
data[Yaw] = newHeadPose[Yaw] * 57.295781f;
}
- if (bEnablePitch) {
+ if (s.bEnablePitch) {
data[Pitch] = newHeadPose[Pitch] * 57.295781f;
}
- if (bEnableRoll) {
+ if (s.bEnableRoll) {
data[Roll] = newHeadPose[Roll] * 57.295781f;
}
}
}
-
-//
-// Load the current Settings from the currently 'active' INI-file.
-//
-void Rift_Tracker::loadSettings() {
-
- qDebug() << "FTNoIR_Tracker::loadSettings says: Starting ";
- QSettings settings("opentrack"); // Registry settings (in HK_USER)
-
- QString currentFile = settings.value ( "SettingsFile", QCoreApplication::applicationDirPath() + "/settings/default.ini" ).toString();
- QSettings iniFile( currentFile, QSettings::IniFormat ); // Application settings (in INI-file)
-
- qDebug() << "FTNoIR_Tracker::loadSettings says: iniFile = " << currentFile;
-
- iniFile.beginGroup ( "Rift" );
- bEnableRoll = iniFile.value ( "EnableRoll", 1 ).toBool();
- bEnablePitch = iniFile.value ( "EnablePitch", 1 ).toBool();
- bEnableYaw = iniFile.value ( "EnableYaw", 1 ).toBool();
-#if 0
- bEnableX = iniFile.value ( "EnableX", 1 ).toBool();
- bEnableY = iniFile.value ( "EnableY", 1 ).toBool();
- bEnableZ = iniFile.value ( "EnableZ", 1 ).toBool();
-#endif
- useYawSpring = iniFile.value("yaw-spring", false).toBool();
- constant_drift = iniFile.value("constant-drift", 0.000005).toDouble();
- persistence = iniFile.value("persistence", 0.99999).toDouble();
- deadzone = iniFile.value("deadzone", 0.02).toDouble();
- iniFile.endGroup ();
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// Factory function that creates instances if the Tracker object.
-
-// Export both decorated and undecorated names.
-// GetTracker - Undecorated name, which can be easily used with GetProcAddress
-// Win32 API function.
-// _GetTracker@0 - Common name decoration for __stdcall functions in C language.
-//#pragma comment(linker, "/export:GetTracker=_GetTracker@0")
-
extern "C" FTNOIR_TRACKER_BASE_EXPORT ITracker* CALLING_CONVENTION GetConstructor()
{
return new Rift_Tracker;