Updating Orientation with Angular Velocity

Started by
29 comments, last by Fulcrum.013 5 years, 10 months ago

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

Reject the basic asumption of civialisation especially the importance of material possessions
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.

 

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

Reject the basic asumption of civialisation especially the importance of material possessions

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.

@alvaro,

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

Reject the basic asumption of civialisation especially the importance of material possessions

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

Reject the basic asumption of civialisation especially the importance of material possessions

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

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.

@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

Reject the basic asumption of civialisation especially the importance of material possessions

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.

 

This topic is closed to new replies.

Advertisement