atk-reaper icon indicating copy to clipboard operation
atk-reaper copied to clipboard

RotateTiltTumble Transform with quarternions parameters

Open lossius opened this issue 8 years ago • 3 comments

Bo is requesting a sister plugin to the current RotateTiltTumble transform with quarternians for parameters, making it more straight-forward to use with head-trackers.

lossius avatar Oct 06 '16 13:10 lossius

If it's helpful, I have some SC code that does this. The main aspect is getting the quaternion to Euler: ` // From Varesano: See Sebastian O.H. Madwick report // "An efficient orientation filter for inertial and intertial/magnetic // sensor arrays" Chapter 2 Quaternion representation

asEuler {
    var q, euler = Array.newClear(3);
    q = this.coordinates;

    euler[0] = atan2( (2 * q[1] * q[2]) - (2 * q[0] * q[3]), (2 * q[0]*q[0]) + (2 * q[1] * q[1]) - 1); // psi
    euler[1] = asin( (2 * q[1] * q[3]) + (2 * q[0] * q[2])).neg; // theta
    euler[2] = atan2( (2 * q[2] * q[3]) - (2 * q[0] * q[1]), (2 * q[0] * q[0]) + (2 * q[3] * q[3]) - 1); // phi

    ^euler
}

`

Then when applying the actual transform with this yaw, pitch, roll euler result, it looked like this: ~transformer.rotate_(ypr[0]).tumble_(ypr[1].neg).tilt_(ypr[2])

It took a bit of futzing to get the directions to rotate the direction that would "correct" the head movement. Hopefully this is useful!

mtmccrea avatar Oct 06 '16 17:10 mtmccrea

Might it be useful to maybe add a setting to the RTT to allow it to accept Quaternions as controls?

Or as a separate plugin called RTTquat?

My first feeling would be just adding a switch. In a Reaper context, this would probably cause the least confusion for users.

joslloand avatar Oct 06 '16 19:10 joslloand

While it could be a switch, I see the advantage of a separate plugin is that it's explicit that the rotate, tilt, tumble are moving opposite the actual input values (the movement is counter to the head movement), and also allows a variation how it's visualized.

On further thought, if we're allowing input of sensor directions (either as euler or quaternion), it would be worth having an input mode for movement opposing the input (as in head tracking), as well as moving in concert with the input. This would allow musical IMU controllers to control rotations or other transforms directly.

mtmccrea avatar Oct 06 '16 20:10 mtmccrea