diff options
author | mm0zct <the_cartographer@hotmail.com> | 2013-11-26 04:08:23 +0000 |
---|---|---|
committer | mm0zct <the_cartographer@hotmail.com> | 2013-11-26 04:08:23 +0000 |
commit | 3895beb6bbc6aaaaf167f1db99b7078506a83622 (patch) | |
tree | 3e8490c55eb7937611ef31fd364cec0e64471016 /ftnoir_tracker_rift | |
parent | 78b570ca271f7e494615538f2c4fac618e79b015 (diff) |
Added positional tracking?!
perhaps, perhaps not.. to be tested
-mm0zct
Diffstat (limited to 'ftnoir_tracker_rift')
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui | 127 | ||||
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 22 | ||||
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.h | 4 | ||||
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp | 4 |
4 files changed, 148 insertions, 9 deletions
diff --git a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui index e868a9c3..8250580d 100644 --- a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui +++ b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui @@ -150,9 +150,136 @@ </property> </widget> </item> + </layout> + </widget> + </item> + + + <item row="0" column="1"> + <widget class="QGroupBox" name="groupBox_tx3"> + <property name="title"> + <string>Enable Translation Axis</string> + </property> + <property name="flat"> + <bool>false</bool> + </property> + <layout class="QFormLayout" name="formLayout_tx2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_tx6"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>TX:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QCheckBox" name="chkEnableX"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="styleSheet"> + <string notr="true"/> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_tx9"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>TY:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="chkEnableY"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="label_tx11"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>TZ:</string> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QCheckBox" name="chkEnableZ"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>20</width> + <height>16777215</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> </layout> </widget> </item> + + + + + <item row="1" column="0"> <widget class="QGroupBox" name="groupBox"> <property name="title"> diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index dd78bf9f..45c02cfb 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -88,11 +88,23 @@ bool Rift_Tracker::GiveHeadPoseData(double *data) if(newHeadPose[Yaw]<-deadzone)newHeadPose[Yaw]+= 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 1 + + double dt = 0.015; + + OVR::Vector3f acc = pSFusion->GetAcceleration(); + old_x = old_x*persistence + vx*dt + 0.5*(acc.x*acc.x); + vx = vx*persistence + acc.x*dt; + newHeadPose[TX] = old_x; + + old_y = old_y*persistence + vy*dt + 0.5*(acc.y*acc.y); + vy = vy*persistence + acc.y*dt; + newHeadPose[TY] = old_y; + + old_z = old_z*persistence + vz*dt + 0.5*(acc.z*acc.z); + vz = vz*persistence + acc.z*dt; + newHeadPose[TZ] = old_z; + if (bEnableX) { data[TX] = newHeadPose[TX]; } diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index b76d8d09..787f16b9 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -29,13 +29,13 @@ private: bool bEnableRoll; bool bEnablePitch; bool bEnableYaw; -#if 0 +#if 1 bool bEnableX; bool bEnableY; bool bEnableZ; #endif bool useYawSpring; - double old_yaw, constant_drift, persistence, deadzone; + double old_yaw, constant_drift, persistence, deadzone, old_x, old_y, old_z, vx, vy, vz; }; // Widget that has controls for FTNoIR protocol client-settings. diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp index 2efefbb3..901a0192 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift_dialog.cpp @@ -112,7 +112,7 @@ void TrackerControls::loadSettings() { ui.chkEnableRoll->setChecked(iniFile.value ( "EnableRoll", 1 ).toBool()); ui.chkEnablePitch->setChecked(iniFile.value ( "EnablePitch", 1 ).toBool()); ui.chkEnableYaw->setChecked(iniFile.value ( "EnableYaw", 1 ).toBool()); -#if 0 +#if 1 ui.chkEnableX->setChecked(iniFile.value ( "EnableX", 1 ).toBool()); ui.chkEnableY->setChecked(iniFile.value ( "EnableY", 1 ).toBool()); ui.chkEnableZ->setChecked(iniFile.value ( "EnableZ", 1 ).toBool()); @@ -139,7 +139,7 @@ void TrackerControls::save() { iniFile.setValue ( "EnableRoll", ui.chkEnableRoll->isChecked() ); iniFile.setValue ( "EnablePitch", ui.chkEnablePitch->isChecked() ); iniFile.setValue ( "EnableYaw", ui.chkEnableYaw->isChecked() ); -#if 0 +#if 1 iniFile.setValue ( "EnableX", ui.chkEnableX->isChecked() ); iniFile.setValue ( "EnableY", ui.chkEnableY->isChecked() ); iniFile.setValue ( "EnableZ", ui.chkEnableZ->isChecked() ); |