diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2013-10-05 12:54:16 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2013-10-05 12:54:16 +0200 |
commit | f1db0cbf2bfac382742ee8ce2737b0bc27f941a4 (patch) | |
tree | 3810e8758f247fa736e32e3b8304733a6cfa0b48 | |
parent | 011c62ee59d9675095d40dee5079c91348959e91 (diff) | |
parent | 819823b8d35db9101e89fa31dae58d689bb597cd (diff) |
Merge branch 'master' of github.com:opentrack/opentrack
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.cpp | 13 | ||||
-rw-r--r-- | ftnoir_tracker_rift/ftnoir_tracker_rift.h | 2 |
2 files changed, 13 insertions, 2 deletions
diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp index 0c3984ac..1af99803 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.cpp @@ -6,6 +6,9 @@ using namespace OVR; +//used to turn on the re-centre spring effect +//#define OPENTRACK_RIFT_RECENTRE_SPRING + Rift_Tracker::Rift_Tracker() { pSensor.Clear(); @@ -14,6 +17,7 @@ Rift_Tracker::Rift_Tracker() bEnableRoll = true; bEnablePitch = true; bEnableYaw = true; + old_yaw = 0.0; #if 0 bEnableX = true; bEnableY = true; @@ -100,7 +104,14 @@ bool Rift_Tracker::GiveHeadPoseData(double *data) float pitch = 0.0f; float roll = 0.0f; hmdOrient.GetEulerAngles<Axis_Y, Axis_X, Axis_Z>(&yaw, &pitch , &roll); - newHeadPose[Yaw] = yaw; +#ifdef OPENTRACK_RIFT_RECENTRE_SPRING + newHeadPose[Yaw] = newHeadPose[Yaw]*0.99999 + (yaw-old_yaw); + if(newHeadPose[Yaw]>0.02)newHeadPose[Yaw]-= 0.000005; + if(newHeadPose[Yaw]<-0.02)newHeadPose[Yaw]+= 0.000005; + old_yaw=yaw; +#else + newHeadPose[Yaw] = yaw; +#endif newHeadPose[Pitch] =pitch; newHeadPose[Roll] = roll; diff --git a/ftnoir_tracker_rift/ftnoir_tracker_rift.h b/ftnoir_tracker_rift/ftnoir_tracker_rift.h index 7bacb91c..579d7d34 100644 --- a/ftnoir_tracker_rift/ftnoir_tracker_rift.h +++ b/ftnoir_tracker_rift/ftnoir_tracker_rift.h @@ -30,7 +30,7 @@ private: // Magnetometer calibration and yaw correction OVR::Util::MagCalibration MagCal; bool isCalibrated; - + double old_yaw; double newHeadPose[6]; // Structure with new headpose bool bEnableRoll; bool bEnablePitch; |