Quaternion representation of the rotation of a sphere into plane displacement
This is a mathematical problem I'm facing these days.. here you go.
I do have a sphere of known radius which does have a coordinate frame rigidly attached to it. Let's call the coordinate frame attached to the sphere XYZs. The sphere can be rotated and displaced arbitrarily with respect to a fixed coordinate frame (world) called $XYZ_w$. Let's be XYZw the coordinate frame of the world where X points the north, Z points the sky and Y is orthogonal to the other 2 axis.
I'm capable of knowing the orientation of the sphere with respect to the XYZw and I have such orientation represented using a quaternion which we'll call Qsw (that is the quaternion representing the orientation of XYZs with respect to XYZw). By knowing Qsw I can easily compute Qws (that is the quaternion representing the orientation of XYZw with respect to XYZs) by computing the quaternion conjugate of Qsw.
Now, let's suppose to place the sphere on a XYw plane, so that by rotating the sphere a displacement of XYZs with respect to XYw is produced. You can visualize this by thinking of placing a ball on a table and rotating it so that it moves on then table plane.
Now, the problem is, by being able to sample Qsw, getting to know the displacement of XYZs on XYw after an indefinite rotation.
This is a practical problem araised when using PALLA (as described in chapter 8 of my MoS thesis), a spherical device which contains an accelerometer, a gyroscope and magnetometer, from which doing a sensor fusion I'm able to compute it's orientation with respect to the world. Now, once placed it on a table with the user rotating it to displace it, I'd like to compute how much it is being displaced as described in math language above.
Of course, I'm not looking for the solution to the problem, I'm just looking for hints on possible paths to the solution.
If I understand the problem correctly (that is, for a given orientation of the sphere, you're asking 'what rolling displacement gave this orientation'), then I'm afraid the problem has no answer; in fact, it's possible to end up in any orientation of the sphere anywhere on the plane. The rough explanation for this is because of the non-commutativity of the spherical rotations (or equivalently, if more complicatedly, the non-vanishing of the Riemann curvature tensor); essentially, rolling the sphere in a small square (up-Y, right-X, down-Y, left-X) will leave it in a different orientation than it started, and by composing various of these 'identity rolls' you can get the sphere back to its starting point in any orientation.
From a more practical perspective, though, things shouldn't be too bad because you have relatively continuous sensor readings. At each step you can find the minimal rotation that carries the sphere from one orientation to the next recorded by essentially taking the product of the 'new' quaternion orientation with the inverse of the previous orientation; that will give you the axis of instantaneous rotation, and the cross product of that with the planar normal will give the (literal) translation of the motion down to the plane (suitably scaled). This won't be 100% accurate, though, and worse it'll get progressively less accurate over time, so you may need some sort of spatial (translational) tracking in addition, at least to be able to 'reset' the sphere's position every few thousand frames.
I'll let you know how this goes..