# 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?

##### Share on other sites
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 on other sites

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 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 on other sites

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

##### Share on other sites

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 on other sites

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

##### 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 on other sites

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 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.

## Create an account

Register a new account

1. 1
2. 2
Rutin
18
3. 3
4. 4
5. 5

• 14
• 12
• 9
• 12
• 37
• ### Forum Statistics

• Total Topics
631431
• Total Posts
3000039
×