New Reply

Attitude quaternion derivatives from Euler angular velocities

 
Share Thread Thread Tools
Jun20-12, 03:22 PM   #18
 

Attitude quaternion derivatives from Euler angular velocities


Sorry for interference, but I need to understand almost the same thing. The difference is I need to calculate angular velocity from quaternion orientation difference and time.

I am using Bullet Physic library to program some function, where I have difference between orientation from gyroscope given in quaternion and orientation of my object, and time between each frame in milisecond. All I want is set the orientation from my gyroscope to orientation of my object in 3D space. But all I can do is set angular velocity to my object. I have orientation difference and time, that is why I need vector of angular velocity [Wx,Wy,Wz] from that.

And I found here:
http://www.euclideanspace.com/physic...entiation2.pdf
and here:
http://www.euclideanspace.com/physic...gularvelocity/

that formula:

[itex](W_{x}(t),W_{y}(t),W_{z}(t)) = 2\frac{dq(t)}{dt}q^{-1}(t)[/itex]

But, probably I misunderstand something, because I did something like:
Code:
btQuaternion diffQuater = gyroQuater - boxQuater;
btQuaternion diffConjQuater;

diffConjQuater.setX(-(diffQuater.x()));
diffConjQuater.setY(-(diffQuater.y()));
diffConjQuater.setZ(-(diffQuater.z()));

////////////////
//W(t) = 2 * dq(t) /dt * conj(q(t))

btQuaternion velQuater;

velQuater = ((diffQuater * 2) / d_time) * diffConjQuater;
But it is not working as I expect, I mean, there is written, vector part of the result quaternion should be vector of angular velocity, and scalar part should be 0, but my result is not like that.

Can someone help me with that?

Edit:
I know where was a problem, I should do:

velQuater = ((diffQuater * 2) / d_time) * conjBoxQuater;

But I get another problems, when my difference between quaternions is not so small (I mean when angular velocity should be high), and when I get 120 degrees I have some weird results. Can someone help me with that?


I know where was a problem, I should do:
velQuater = ((diffQuater * 2) / d_time) * conjBoxQuater;
 
Jun20-12, 10:35 PM   #19
D H
 
Mentor
You just can't take two random packages that use quaternions to represent orientation and expect them to work together without some glue. There are 32 combinations of representational choices, 30 of which represent ways things won't work together without glue.
  1. Do the quaternions represent transformations or rotations?
  2. Do quaternions transform (rotate) via QvQ* or Q*vQ ?
  3. Is the scalar part of the quaternion first or last?
  4. Is angular velocity from the inertial frame to the rotating frame, or the reverse?
  5. Is angular velocity represented in the inertial frame or in the rotating frame?
That's 25=32 opportunities for Murphy's law to rear it's ugly head. You need to know how each package works. The problem is confounded by the fact that a lot of authors don't even know these distinctions exist.

You've added yet another issue to the mix in using (Q(t+Δt)-Q(t))/Δt to estimate a quaternion derivative. This implicitly makes the small angle approximation due to the nature of the quaternion exponential. This will create problems eventually.
 
Jul3-12, 11:28 AM   #20
 
I need to revive this thread, yet again, for another related question. Sorry. At least I won't have to re-explain the problem and all the parameters.

Thanks for the help with the quaternion derivatives, I understand them much better now.

I now wish to integrate the angular velocity [itex]\boldsymbol{\omega}_n[/itex] at every point n, where my time variable is [itex]t_n[/itex]. This would yield the angular displacement [itex]\boldsymbol{\theta}_n[/itex]. Now, since I have a vector with known components in every timstep, I can integrate component-wise:

[itex]\theta_{i,n}=\omega_{i,n} \cdot t_n + C[/itex]

where C is the integration constant and i=1,2,3. But how do I find the value of this constant? Should it be zero? This would imply that at t=0, there is no angular displacement. Right? So should I then set the constant to whichever initial angular displacement I have? This seems like such a simple problem and a resulting stupid question, but I'm just confused by the physical implications.


Thanks in advance.
 
Jul3-12, 11:41 AM   #21
D H
 
Mentor
Quote by vicjun View Post
I now wish to integrate the angular velocity [itex]\boldsymbol{\omega}_n[/itex] at every point n, where my time variable is [itex]t_n[/itex]. This would yield the angular displacement [itex]\boldsymbol{\theta}_n[/itex].
This is not possible. While this works in SO(2) (rotation in 2D space, where angular velocity is a scalar), it does not work in any higher dimension. It has do with the noncommutativity of SO(3) and higher.
 
Jul3-12, 01:35 PM   #22
 
Thanks for the reply, I should have been clearer about the context. I found a method to numerically integrate quaternions, in a book. It basically involves integrating the kinematic equation

[itex]\dot{Q}=\frac{1}{2} Q \, \Omega[/itex]

where [itex]\Omega[/itex] is the pure quaternion representation of the angular velocity vector. In the method, it is assumed that it commutates with its integral, i.e.

[itex]\Omega \cdot \int_{t_n}^{t_{n+1}}\Omega(\tau)d\tau=(\int_{t_n}^{t_{n+1}}\Omega(\tau) d\tau) \cdot \Omega [/itex]

which allows for analytical integration of the kinematic equation using

[itex]Q(t)=Q \cdot exp(\frac{1}{2} \int_{t_n}^{t_{n+1}}\Omega(\tau)d\tau)[/itex]

and if we write

[itex]\theta_{i,n}=\int_{t_n}^{t_{n+1}}\omega_i(\tau) d\tau[/itex]

then we get

[itex]Q(t)=Q \cdot exp(\frac{1}{2} \theta_{i,n})[/itex]

and this can then be expanded with Euler notation to give an expression of the type

[itex]Q_{n+1}=Q_n \cdot expression(\theta_{i,n}\, \text{as a quaternion and its norm})[/itex]

However, this procedure implies a commutation error. I quote from the book:

However the commutation relation only holds in the very specific case of rotation around a fixed axis. Once the rotation axis is mobile, applying the method leads to an error known as a commutation error
The method is then built upon by compensating for this error. It is assumed that both the angular velocity quaternion and the attitude quaternion allow for Taylor expansions at any point [itex]t_n[/itex]. This effectively does just that, and so the method can be used for mobile axes.

So is it possible to integrate the angular velocity vector, if the commutation error is compensated for? I'm still trying to understand this method, but it is from a reliable source.
 
Jul3-12, 02:39 PM   #23
D H
 
Mentor
Quote by vicjun View Post
So is it possible to integrate the angular velocity vector, if the commutation error is compensated for? I'm still trying to understand this method, but it is from a reliable source.
Yeah, but all you are doing is the exact same thing described in that text.

There are a number of ways to represent rotation in 3D space. Quaternions are but one of many. Transformation or rotation matrices are another. Euler angles, yet another. Rodrigues parameter and modified Rodrigues parameters, yet another. There are a number of people who are moving toward MRPs to represent rotation. Yet another is what is variously called an Euler rotation, an eigenrotation, or a single axis rotation. Per Euler, any rotation in three space can be represented as a single rotation by some angle about some axis.

Euler angles, Rodrigues parameters, MRPs, and eigenrotations are represented by three parameters. That's a good thing, particularly when it comes to Kalman filters. I hope that you aren't talking about Euler angles. Euler angles are a mess. They're nice for human representation, sometimes nice for commands to robots, but they are extremely nasty when it comes to propagating state. I doubt you are talking about Rodrigues parameters or MRPs (but you may want to look into them). So that leaves eigenrotations.

Eigenrotations are just quaternions in disguise, but without the solid mathematical basis that quaternions describe. Try to integrate angular velocity to yield the eigenrotation and you'll be doing the equivalent of integrating a quaternion, using the exact same semi-valid tricks used to integrate the quaternion. You'll be doing quaternion integration but without the benefits that come with representation as a quaternion.
 
Jul4-12, 02:40 AM   #24
 
Quote by D H View Post
Yeah, but all you are doing is the exact same thing described in that text.
Do you mean what I did previously, i.e. integrating the quaternion derivatives?

I doubt you are talking about Rodrigues parameters or MRPs (but you may want to look into them). So that leaves eigenrotations.
In this case I am constrained to quaternions as a final result (interpolation polynomials), starting from Euler angles and Euler angle rates. I know about Rodrigues parameters, though I've never used them in practice. One of the advantages as I see it, is that there are no redundant parameters, while they are more suited for numerical calculations than Euler angles, and are better for describing large and small rotations. But for now, I have to use quaternions.


Eigenrotations are just quaternions in disguise, but without the solid mathematical basis that quaternions describe. Try to integrate angular velocity to yield the eigenrotation and you'll be doing the equivalent of integrating a quaternion, using the exact same semi-valid tricks used to integrate the quaternion. You'll be doing quaternion integration but without the benefits that come with representation as a quaternion.
The method I tried earlier with quaternion derivatives works quite well. The purpose of my work is to find different methods to reach the same results, a polynomial describing each quaternion component. I then compare these methods to reference results to see which one is best. I guess integrating the angular velocity is very similar to integrating quaternion derivatives (both methods are based on the kinematic equation), but maybe there's a difference in accuracy? I'm not sure pursuing this will give interesting results, but it might be worth a try, if I get it to work. The challenge is finding the correct eigenrotation (thanks for explaining what it is!) from the angular velocity.
 
Oct15-12, 09:50 AM   #25
 
If you use MATLAB to do this you can utilize built in functions to transform between quaternion and euler angles and from there transform to the body axis to determine angular rates. It's not easy but it is totally possible. However, you do really need to know what you're doing.
 
New Reply
Thread Tools


Similar Threads for: Attitude quaternion derivatives from Euler angular velocities
Thread Forum Replies
Euler-Lagrange Equations and Derivatives Advanced Physics Homework 5
Functional Derivatives/Euler-Lagrange Calculus & Beyond Homework 0
Conserved angular momentum: finding angular velocities of drums as a function of time Introductory Physics Homework 2
quaternion conversion in satellite attitude using sun-earth sensors simulation Astrophysics 0
Angular momentum at near-c velocities Special & General Relativity 10