🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Qdot from 2 quaternions

Started by
3 comments, last by Dirk Gregorius 6 years, 5 months ago

Hi guys

I have a bit of a challenge here. I am attempting to determine body rotation rates from 2 Tait-Bryan angles.

I have each set of angles converted to a quaternion, and the time step dt. I know that the formula for obtaining body rotation rates is 2*(qd/dt)*inverse of q. My question is, how do I determine qd/dt from 2 orientation quaternions, and which quaternion I would invert.

 

Thanks

JB

Advertisement

You nearly got it and are on the right track. Say we have a start quaternion q1 and a target quaternion q2.  We start from the quaternion derivative:

dq/dt = 0.5 * w * q

This can be approximated using the differential quotient:

(q2 - q1) / dt = 0.5 * w * q1

Solving for w yields:

w = 2 * (q2 - q1) / dt * conjugate( q1 )

 

The angular velocity omega is now the vector (imaginary) part of the (pure) quaternion w:


Vector3 omega = w.imgaginary();

 

There is a small gotcha here. Since you are subtracting quaternions, you need to make sure that q1 and q2  are in the same hemisphere. You can check polarity simply by using the dot product.


if ( dot( q1, q2 ) < 0 )
{
	q1 = -q1
}

 

Thanks a bunch. Once I have sorted out the polarity I take it I just subtract each individual element in the quaternion?

And dividing by dt I take it is again simply dividing each individual element by dt?

Correct! Quaternion addition/subtraction and scalar multiplication are per element. Just like a 4D vector.

This topic is closed to new replies.

Advertisement