Jump to content
  • Advertisement
Cacks

Updating Orientation with Angular Velocity

Recommended Posts

Hi,

I have read from 2 sources Orientation cannot be updated directly using Angular Velocity, see attached equation 1

This seems incorrect to me

Surely I can do attached equation 2?

I.e. put the angular velocity into a quaternion with the angle scaled by delta time & concatenate with the orientation?

1.jpg

2.jpg

Share this post


Link to post
Share on other sites
Advertisement
1 hour ago, Cacks said:

I have read from 2 sources Orientation cannot be updated directly using Angular Velocity, see attached equation 1

I don't understand what you are saying. That equation is a way to update the orientation using angular velocity...

I am not sure what "q_rot" does, so I can't comment on your second equation.

 

Share this post


Link to post
Share on other sites

@alvaro,

the 1st equation is from a book to update orientation using angular velocity, it says:

new orientation = old orientation + time delta * (0.5 * angular vel quaternion * old orientation)

The 2nd equation is mine to update orientation, it says:

new orientation = old orientation * Quaternion(angularVel.normalise(), angularVel.length() * time delta)

I think my equation should work?

Share this post


Link to post
Share on other sites

I believe the first equation is a linearization of the second one. Notice how the first one doesn't involve any trigonometric functions, but the second one does.

Remember to re-normalize the orientation after you use the first formula.

Share this post


Link to post
Share on other sites

@alvaro,

ok I understand, the 1st equation is used because it gives better performance, that makes sense, cheers

Share this post


Link to post
Share on other sites

@alvaro

on second look they both use trig functions because in the first equation 'w' is a Quaternion made from a vector

The 2nd equation seems to give more rotation as well, wondering which 1 is correct?

Share this post


Link to post
Share on other sites

No, no. `w' is just the angular velocity, with a 0 as real part. No trigonometric functions involved.

Share this post


Link to post
Share on other sites
Posted (edited)

Notice the equations could be re-written like this:

(1) q' = (1 + 0.5 * w * dt) * q

(2) q' = exp(0.5 * w * dt) * q

 

Since exp(z) = 1 + z + z^2/2 + z^3/6 + ..., you can think of the first equation as using a linear approximation to the exponential function.

Edited by alvaro

Share this post


Link to post
Share on other sites

@alvaro,

in my implementation of Quaternion I use the trig functions in the constructor to scale the axis & angle so I used them in both forms of the equation

I may as well use the 2nd equation, cheers

Share this post


Link to post
Share on other sites

You should probably provide a mechanism to create a quaternion from a vector by making the real part 0. For instance, when you use the quaternion to apply a rotation, you normally do something like

q' = q * v * conj(q)

That `v' means the vector used as a quaternion in the manner I described.

 

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

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!