Hi,
I have a problem with embeding sixense SDK DLL in my project.
I need only to receive the Euler Angles (psi, phi, theta).
I tried to use two different sexsense DLL - first from - last sixsense SDK and second from http://dl.dropbox.com/u/418561/Tutorial1-files.zip
It use two different sixenseControllerData structures:
first (last SDK)
typedef struct _sixenseControllerData {
float pos[3];
float rot_mat[3][3];
unsigned char joystick_x;
unsigned char joystick_y;
unsigned char trigger;
unsigned int buttons;
unsigned char sequence_number;
float rot_quat[4];
unsigned short firmware_revision;
unsigned short hardware_revision;
unsigned short packet_type;
unsigned short magnetic_frequency;
int enabled;
int controller_index;
unsigned char is_docked;
unsigned char which_hand;
} sixenseControllerData;
second (http://dl.dropbox.com/u/418561/Tutorial1-files.zip ):
struct sixenseControllerData {
var float pos[3];
var float rot_mat[9];
var float joystick_x;
var float joystick_y;
var float trigger;
var int buttons;
var byte sequence_number;
var float rot_quat[4];
var byte firmware_revision[2];
var byte hardware_revision[2];
var byte packet_type[2];
var byte magnetic_frequency[2];
var int enabled;
var int controller_index;
var byte is_docked;
var byte which_hand;
var byte hemi_tracking_enabled;
};
I tried to receive output as rot_quat[] and convert it to Euler angles - I have uncorrect values
Seems I have a shifted data in the rot_quat[] members
I tried to receive output as as rot_mat[] , and convert it to Euler angles like the code below:
/** this conversion uses conventions as described on page:
* http://www.euclideanspace.com/maths/...uler/index.htm
* Coordinate System: right hand
* Positive angle: right hand
* Order of euler angles: heading first, then attitude, then bank
* matrix row column ordering:
* [m00 m01 m02]
* [m10 m11 m12]
* [m20 m21 m22]*/
public final void rotate(matrix m) { // Assuming the angles are in radians.
if (m.m10 > 0.998) { // singularity at north pole
heading = Math.atan2(m.m02,m.m22); attitude = Math.PI/2;
bank = 0;
return;
} if (m.m10 < -0.998) { // singularity at south pole
heading = Math.atan2(m.m02,m.m22); attitude = -Math.PI/2;
bank = 0;
return;
} heading = Math.atan2(-m.m20,m.m00);
bank = Math.atan2(-m.m12,m.m11);
attitude = Math.asin(m.m10);
}
But I have "stray" tilt value for any way of panning
--------
Only pos[] members X,Y,Z position has correct value
Questions:
1. What exact size in the bytes of a members of the sixenseControllerData struct ?
2. Any small example - for receive Euler Angles (phi,psi,theta) ?
any help is appreciated



Reply With Quote

