I am using Bullet Physic library to program some function, where I have difference between orientation from gyroscope given in quaternion and orientation of my object, and time between each frame in milisecond. All I want is set the orientation from my gyroscope to orientation of my object in 3D space. But all I can do is set angular velocity to my object. I have orientation difference and time, that is why I need vector of angular velocity [Wx,Wy,Wz] from that.
I did something like:
btQuaternion diffQuater = gyroQuater - boxQuater; btQuaternion diffConjQuater; diffConjQuater.setX(-(diffQuater.x())); diffConjQuater.setY(-(diffQuater.y())); diffConjQuater.setZ(-(diffQuater.z())); //////////////// //W(t) = 2 * dq(t) /dt * conj(q(t)) btQuaternion velQuater; velQuater = ((diffQuater * 2) / d_time) * diffConjQuater;
But it is not working as I expect, I mean, there is written, vector part of the result quaternion should be vector of angular velocity, and scalar part should be 0, but my result is not like that.
angular velocity vector represented as quaternion with zero scalar part, i.e W (t ) = (0, W x (t ), W y (t ), W z (t ))