Quaternion Problem ( NI-Mate )


I use an external program for the kinect, it gives me through OSC per limb the xyz position and wxyz rotation.

Little pseudo code:

// I got a OSC message and a Quaternion
oscMsg m;
ofQuaternion rot;

// Set the rotation of Quaternion to the data of the OSC message
// First 3 floats are xyz position, next is the degree(w), followed by 3 floats of xyz rotation
// Openframeworks declaration starts with xyz and ends with degree(w)
// NI-mate sends its degree(w) then its xyz
rot.set( m.getArgAsFloat(4), m.getArgAsFloat(5), m.getArgAsFloat(6), m.getArgAsFloat(3) );

ofVec3f axis;
float angle;

// Get angle and axis
rot.getRotate( angle, axis );

// Set angle and axis
ofRotate( angle, axis.x, axis.y, axis.z );

Does anyone have any clue whats going wrong? I’ve mixed up the sequence but with no luck, no correct rotation from limb to limb.

Thanks in advance!

Maybe the argument is in radians and needs to be converted to degrees?

rot.set( m.getArgAsFloat(4), m.getArgAsFloat(5), m.getArgAsFloat(6), m.getArgAsFloat(3)*RAD_TO_DEG );  

Nope, tried it, stopped rotating at all. Thanks though.

From the NI-Mate guys ( the application that gives me the OSC data ):

  • Axis might be different, they have Y-up and Z-forward. That is what OF uses aswell.
  • It might be a lefthanded system and we have a righthanded system

Quaternion(msg[4], -msg[6], msg[5], msg[3])

(xyz coordinates in the order msg[4], msg[6], msg[5] to switch z and y and “-msg[6]” to change from a left handed coordinate system to a right handed coordinate system)

…but no. I switched them around but it keeps Stevie Wondering on me