Jump to content
  • Advertisement
Sign in to follow this  
Naruto-kun

Qdot from 2 quaternions

Recommended Posts

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

Share this post


Link to post
Share on other sites
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
}

 

Edited by Dirk Gregorius

Share this post


Link to post
Share on other sites

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?

Edited by Naruto-kun

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!