summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_rift
diff options
context:
space:
mode:
Diffstat (limited to 'ftnoir_tracker_rift')
-rw-r--r--ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui165
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift.cpp20
-rw-r--r--ftnoir_tracker_rift/ftnoir_tracker_rift.h5
3 files changed, 105 insertions, 85 deletions
diff --git a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui
index 789d2d25..eaf5b9d6 100644
--- a/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui
+++ b/ftnoir_tracker_rift/ftnoir_rift_clientcontrols.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>UIRiftControls</class>
- <widget class="QWidget" name="UIRiftControls">
+ <widget class="QWidget" name="UIHydraControls">
<property name="geometry">
<rect>
<x>0</x>
@@ -45,78 +45,97 @@
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <item row="0" column="0">
- <widget class="QLabel" name="label_6">
- <property name="text">
- <string>Roll:</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label_11">
- <property name="text">
- <string>Yaw:</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <widget class="QCheckBox" name="chkEnablePitch">
- <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="1" column="0">
- <widget class="QLabel" name="label_9">
- <property name="text">
- <string>Pitch:</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1">
- <widget class="QCheckBox" name="chkEnableRoll">
- <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="2" column="1">
- <widget class="QCheckBox" name="chkEnableYaw">
- <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="0" column="0">
+ <widget class="QLabel" name="label_6">
+ <property name="text">
+ <string>Pitch:</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="chkEnablePitch">
+ <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_9">
+ <property name="text">
+ <string>Yaw:</string>
+ </property>
+ </widget>
+ </item>
+
+
+ <item row="1" column="1">
+ <widget class="QCheckBox" name="chkEnableYaw">
+ <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_11">
+ <property name="text">
+ <string>Roll:</string>
+ </property>
+ </widget>
+ </item>
+
+ <item row="2" column="1">
+ <widget class="QCheckBox" name="chkEnableRoll">
+ <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>
</widget>
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
index 367ab389..4e9dd7a3 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp
@@ -66,7 +66,8 @@ void Rift_Tracker::StartTracker(QFrame* videoFrame)
}else{
QMessageBox::warning(0,"FaceTrackNoIR Error", "Unable to find Rift tracker",QMessageBox::Ok,QMessageBox::NoButton);
}
- //MagCal.BeginAutoCalibration(SFusion);
+ isCalibrated = false;
+ MagCal.BeginAutoCalibration(SFusion);
SFusion.SetMagReference(SFusion.GetOrientation());
}
}
@@ -79,32 +80,27 @@ bool Rift_Tracker::GiveHeadPoseData(double *data)
if (SFusion.IsMagReady() && !isCalibrated ){
SFusion.SetYawCorrectionEnabled(true);
QMessageBox::warning(0,"OpenTrack Info", "Calibrated magnetic sensor",QMessageBox::Ok,QMessageBox::NoButton);
+ isCalibrated = true;
}else{
if(isCalibrated){
isCalibrated = false;
QMessageBox::warning(0,"OpenTrack Info", "Lost magnetic calibration",QMessageBox::Ok,QMessageBox::NoButton);
}
}
-#endif
// Magnetometer calibration procedure
- //MagCal.UpdateAutoCalibration(SFusion);
+ MagCal.UpdateAutoCalibration(SFusion);
+#endif
Quatf hmdOrient = SFusion.GetOrientation();
float yaw = 0.0f;
float pitch = 0.0f;
float roll = 0.0f;
- //hmdOrient.GetEulerAngles< Axis_X, Axis_Y, Axis_Z>(&pitch, &yaw, &roll);
- //hmdOrient.GetEulerAngles< Axis_X, Axis_Z, Axis_Y>(&pitch, &roll, &yaw);
hmdOrient.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch , &roll);
- //hmdOrient.GetEulerAngles< Axis_Y, Axis_Z, Axis_X>(&yaw, &roll, &pitch);
- //hmdOrient.GetEulerAngles< Axis_Z, Axis_X, Axis_Y>(&roll, &pitch, &yaw);
- //hmdOrient.GetEulerAngles< Axis_Z, Axis_Y, Axis_X>(&roll, &yaw, &pitch);
- newHeadPose[Pitch] = pitch;
- newHeadPose[Roll] = roll;
- newHeadPose[Yaw] = yaw;
+ newHeadPose[Yaw] = yaw;
+ newHeadPose[Pitch] =pitch;
+ newHeadPose[Roll] = roll;
#if 0
- sixenseControllerData cd;
newHeadPose[TX] = acd.controllers[0].pos[0]/50.0f;
newHeadPose[TY] = acd.controllers[0].pos[1]/50.0f;
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h
index 0f3bc099..7bacb91c 100644
--- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h
+++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h
@@ -6,6 +6,7 @@
#include <math.h>
#include "facetracknoir/global-settings.h"
#include "OVR.h"
+#include "Util/Util_MagCalibration.h"
class Rift_Tracker : public ITracker
{
public:
@@ -26,6 +27,10 @@ private:
OVR::Ptr<OVR::HMDDevice> pHMD;
OVR::Ptr<OVR::SensorDevice> pSensor;
OVR::SensorFusion SFusion;
+ // Magnetometer calibration and yaw correction
+ OVR::Util::MagCalibration MagCal;
+ bool isCalibrated;
+
double newHeadPose[6]; // Structure with new headpose
bool bEnableRoll;
bool bEnablePitch;