OSC Rotation- Gimbal Lock

Hi all,

I am working on a project for tracking the rotation on a phone “glued”/attached to a piece of cardboard. For this, I am using OSC outputs to try to mimic the rotation of the phone+cardboard inside TouchDesigner.

I’m using ZIG SIM on a Samsung phone and importing the X, Y, Z, W quaternions into TD using the OSC In CHOP. From there, I’m feeding the XYZW channels into the Angle CHOP with input set to Quaternion and output set to degrees.

But I get the Quaternion Gimbal Lock and I do not know how to solve it.
I saw a lot of projects using this technique, but I do not know how can I implement it in the project.
Any help is much appreciated!

What do you mean by getting quaternion gimbal lock? Quats can’t be gimbal locked to my knowledge, is the resulting Euler angles doing something weird that you can explain or show?

the phone sits down on its back… screen facing up :slight_smile:

Is it correct in other orientations like screen facing you, top edge of the phone pointing up? Or is it incorrectly calibrated across all orientations?

I get this wired positioning
My Quaternions are QX, QY, QZ, QW > MERGE > Angle (Quaternions to angle RX, RY, RZ) > Box

It is incorrect calibrated on all axes :frowning: wired

orientation problem.1.toe (6.2 KB)

I have uploaded my file here, maybe you have more luck, or someone can fix it!

I have two approaches both with the same wired result = an incorrect calibration

Variant A
Quaternions >MERGE > Angle > Select (RX, RY, RZ) > BOX

Quaternions > Trensform > Atribute > Select (RX, RX, RZ) > BOX

Any help is much appreciated