Rotation Matrix


I am having a problem I was hoping to get help with.

I am currently using OpenGL with two unique spaces, Global Space and Hand Space. I have a tracking system that uses cameras to track unique objects and the tracking system reports the current 6DOF (position in X, Y, Z, and orientation in Pitch, Yaw, Roll, where Pitch is the rotation about the X axis, Yaw is the rotation about the Y axis, and Roll is the rotation about the Z axis). I have placed a trackable object on my hand so that I can track my hand’s position. I am using a rotation matrix to transform certain data I collect from Global Space into Hand Space so that when my hand moves, the collected data will move with the hand. What I am noticing is that when my angles for pitch and yaw are large, the rotation of the collected data in hand space is off. If the angles are small, the rotations are fine. I have read a lot of info on this problem and have tried many things to fix it.

First, the problem is that as the angles of the first rotations get larger, their rotational effects on the last rotation get more prevalent. So I am seeing rotations being from one or two axes being introduced into the last axis. I have played around with the rotation ordering and was able to get rid of most of the problems but never cleared up all issues. I need to get rid of all the issues since this project is for research and the data must be accurate.

From what I have read on this problem I should be using either the “Actor Frame” of reference using an Up, Forward, and Left Vectors or Quaternions instead. So what I did is my function that creates the rotation matrix, I converted the 6DOF into both the Actor Frame and Quaternions, then lastly, created the rotation matrix. Neither method solves the problem. It appears the problem is using a rotation matrix itself. If I switch the order in which I populate the rotation matrix (while using the Actor Frame and Quaternions) I get the exact same results as using the 6DOF directly to create the rotation matrix. Maybe I am not using the Actor Frame and Quaternions the way I should be to fix the issues I am seeing, but my problem appears to be in using a rotation matrix in general. I don’t know how to get around this problem while using OpenGL because OpenGL’s API uses matrices and does not use the Actor Frame or Quaternions directly.

Any help would be appreciated on how to fix this problem.