| 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; 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 |
|
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.
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 |
|
Mentor
|
|
| 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: 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 |
|
Mentor
|
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 |
|
|
|
| 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 | ||