summaryrefslogtreecommitdiffhomepage
path: root/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
diff options
context:
space:
mode:
authormm0zct <the_cartographer@hotmail.com>2013-06-29 19:26:59 +0100
committermm0zct <the_cartographer@hotmail.com>2013-06-29 19:26:59 +0100
commit5368b98cd09f61a1e3344efed9ad90ac9989726e (patch)
tree9dcf4c45582087a5bbac2d0c00cb61f0f90afde8 /ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
parent8ab86902935f402c4ab529741a0afa5baf972ca1 (diff)
Merged in fixes to hydra and rift code, along with a bug in the pitch inversion of FTNoIR itself.
Also added an include directory the Rift needs which was absent before.
Diffstat (limited to 'ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp')
-rw-r--r--ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp35
1 files changed, 18 insertions, 17 deletions
diff --git a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
index 24ffedcd..3789c7bf 100644
--- a/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
+++ b/ftnoir_tracker_hydra/ftnoir_tracker_hydra.cpp
@@ -74,41 +74,42 @@ bool Hydra_Tracker::GiveHeadPoseData(double *data)
//sixenseUtils::getTheControllerManager()->update( &acd );
//sixenseControllerData cd;
- Rotation quat = Rotation(acd.controllers[0].rot_quat[0],acd.controllers[0].rot_quat[1],acd.controllers[0].rot_quat[2],acd.controllers[0].rot_quat[3]);
+ //Rotation quat = Rotation(acd.controllers[0].rot_quat[1],acd.controllers[0].rot_quat[2],acd.controllers[0].rot_quat[3],acd.controllers[0].rot_quat[0]);
+ sixenseMath::Matrix4 mat = sixenseMath::Matrix4(acd.controllers[0].rot_mat);// sixenseMath::Quat(acd.controllers[0].rot_quat[1],acd.controllers[0].rot_quat[2],acd.controllers[0].rot_quat[3],acd.controllers[0].rot_quat[0]);
+
double yaw = 0.0f;
double pitch = 0.0f;
double roll = 0.0f;
-
- quat.toEuler(yaw, pitch, roll);
-
- newHeadPose[RY] = pitch;
- newHeadPose[RZ] = roll;
- newHeadPose[RX] = yaw;
-
+ float ypr[3];
+
+ mat.getEulerAngles().fill(ypr);
+ newHeadPose[Yaw] = ypr[0];
+ newHeadPose[Pitch] = ypr[1];
+ newHeadPose[Roll] = ypr[2];
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) {
+ if (bEnableX) {
data[TX] = newHeadPose[TX];
- //}
- //if (bEnableY) {
+ }
+ if (bEnableY) {
data[TY] = newHeadPose[TY];
- //}
- //if (bEnableY) {
+ }
+ if (bEnableY) {
data[TZ] = newHeadPose[TZ];
- //}
+ }
if (bEnableYaw) {
- data[RX] = newHeadPose[RX] * 57.295781f;
+ data[Yaw] = newHeadPose[Yaw] * 57.295781f;
}
if (bEnablePitch) {
- data[RY] = newHeadPose[RY] * 57.295781f;
+ data[Pitch] = newHeadPose[Pitch] * 57.295781f;
}
if (bEnableRoll) {
- data[RZ] = newHeadPose[RZ] * 57.295781f;
+ data[Roll] = newHeadPose[Roll] * 57.295781f;
}
return true;