I have a computer device - a 3D pointer (Sensable Phantom Omni). It returns cartesian position (X,Y,Z) and orientation quaternion (x,y,z,w).
Now I have a 3D visualization software (PyMOL) and I need to draw a pointer that has the same position and orientation as my device.
I had no problem with position, that is ok.
But I have some trouble with converting device orientation (returned as quaternion) to PyMOL object orientation (which needs to be represented as axis-angle as described here: http://www.pymolwiki.org/index.php/Rotate).
I have a library for transformations (in Python) (http://www.lfd.uci.edu/~gohlke/code/transformations.py.html) and I've done some standard computation on converting quaternion to axis-angle form, but it doesn't work properly. It rotates continuously (with different speeds and directions), no matter if I rotate my device or not.
Maybe I shouldn't pass directly converted value (quaternion -> axis-angle) to Rotate function in PyMOL, but I should calculate a delta between current and previous orientation? Or maybe I'm totally wrong, do you have any suggestions?
I'm a little desperate with this problem ;)