Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Attitude quaternion derivatives from Euler angular velocities

  1. Apr 24, 2012 #1
    I'm struggling to understand what the derivative of an attitude quaternion really is and how to use it. I need it to solve a problem relating to a rotating frame of reference relative an inertial frame.

    The information I have is a vector of Euler angular velocities (i.e for roll [itex]\phi[/itex], pitch [itex]\theta[/itex] and yaw [itex]\psi[/itex]), with components [itex]\dot{\phi}[/itex], [itex]\dot{\theta}[/itex] and [itex]\dot{\psi}[/itex], for each point along the path. The points correspond to a date/time [itex]t_i[/itex], rather than a spatial location (where [itex]i[/itex] is the index). The angular velocities represent the rotational velocity of the frame relative to an inertial frame at a point with date [itex]t_i[/itex].

    The only other piece of information I have is the inital attitude of the frame at time 0, i.e [itex]t_0[/itex], in the form of a quaternion [itex]Q_0[/itex] with components [itex]q_0, q_1, q_2[/itex] and [itex]q_3[/itex]

    What I want to do is to calculate the quaternion derivative at every point in time. To do this I am using the method desribed here:

    Which works for the first point, because I can create a quaternion of angular velocities and I have the initial quaternion [itex]Q_0[/itex]. I have a ready-made script that allows me to calculate this quaternion derivative using this method. So far, so good. But what then?

    Using this method, I can't calculate the derivative in the next point without first knowing the attitude quaternion in that point, say [itex]Q_1[/itex] (I have the angular velocities in each point, as mentioned above). I tried approximating this quaternion by adding the derivative of the previous point times the timestep, as follows (for each quaternion component):

    [itex]q_{0,i+1} = q_{0,i} + (t_{i+1} - t_i) \cdot \dot{q}_{0,i}[/itex]

    This effectively gives me an attitude quaternion in every point, allowing me to calculate the quaternion derivative in that point (as I have the angular velocities). However, when comparing with reference values for the quaternion components, this method is not at all accurate enough, and does not give reliable results.

    This has led me to wonder what the quaternion derivative really is. As I understand it (and as indicated by the document in the link) the quaternion derivative is the rotational velocity equivalent to the Euler angle attitude quaternion, i.e an indicator of how fast the frame is rotating relative an inertial frame at any given time. I have used quaternions in the past and I think I have a pretty good understanding of them, but quaternion differentiation is new to me.

    Ideally, I would like to be able to calculate the quaternion derivative in every point based entirely on the angular velocities and initial attitude, without ever having to use attitude quaternions (as they are not reliable when calculated using the equation above). Is there a way to do this?

    Intuitively, I think there should be a way. Euler angular velocities should be able to directly yield a corresponding velocity quaternion. Or have I completely misunderstood the problem?

    I often have trouble putting my questions into words, so I'd be glad to clarify the problem if needed. I tried to find the answer on Google, but most topics seem to relate to 3D programming, without enough "mathematical background" to help me understand the principles.

  2. jcsd
  3. Apr 24, 2012 #2

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    This is too complex a topic to delve into in an internet forum such as this.

    As a starter, the time derivatives of your roll-pitch-yaw Euler angles are not angular velocity. They are related to angular velocity by a somewhat messy transformation, and the relation depends on the order of the rotation sequence (e.g., a roll pitch yaw sequence versus a yaw pitch roll sequence). Angular velocity as measured by a rate gyro is a vector (better said, a pseudovector). Those time derivatives do not form a vector.

    Simply integrating angular velocity does not yield anything meaningful. Properly integrating the quaternion derivative does. However, that "properly" is full of caveats. Typical numerical integration schemes will quickly fail because the integrated quaternion stops being unitary. You need to do something special (and maybe hackish) to keep the integrated quaternion a unit quaternion.

    There's some stuff on this on the 'net, but it's piecemeal. What you need is a book. A good starting point is Quaternions and Rotation Sequences: A Primer With Applications to Orbits, Aerospace, and Virtual Reality by Jack B. Kuipers.
  4. Apr 24, 2012 #3
    Thank you for your answer, it was very helpful.

    I understand that Euler angle time derivatives are related to angular velocities by a matrix consisting of cosine and sine functions of the Euler angles (too much LaTeX work to write it here, but you probably know which one I'm referring to). In a similar fashion a quaternion derivative is related to "its" quaternion by a tensor consisting of angular velocities. The latter relationship is what I'm using to calculate the quaternion derivative in every point.

    But is there no way to bypass using the attitude quaternion as well as the Euler angles entirely? That is, is it possible at all to calculate the quaternion derivative directly from the Euler angle time derivatives? Maybe through the principal axis?

    Even if the Euler angle time derivatives aren't the same as the angular velocities [itex]\omega_1, \omega_2[/itex] and [itex]\omega_3[/itex] isn't there a more direct relationship to quaternion differentiation?

    Thanks for the litterature tip, it looks like a very good book. It's a little too expensive and would take a bit too long to get here, though. I only have some course literature available to me, such as Analytical Mechanics of Aerospace Systems by Schaub and Junkins, and Spaceflight Dynamics by Wiesel. They both go over quaternions, but I haven't found anything so far that would help me. Is there a more advanced book than these I would find useful?

    As for numerical integration methods, I managed to avoid inaccuracies a little by normalizing the quaternion after each step. This only works for shorter paths, though. With many points, the result drifts too much from the correct value. I'd much rather use analytical methods to solve this problem.

    I think this is largely due to me misunderstanding the physical meaning of Euler angle time derivatives, and how they are different from rotational velocities. They are more of a "rate of change" I guess, and are not used to describe attitude changes at any given moment. As you wrote, they cannot be assembled into a vector.
    Last edited: Apr 24, 2012
  5. Apr 24, 2012 #4

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    The Euler angle time derivatives don't have much physical meaning. Your attitude rate sensors aren't measuring those derivatives. They're measuring angular velocity as expressed in the rate sensor case frame. I'd drop the Euler angle derivatives ASAP. Euler angles are handy to give people an understanding of orientation, but of very little use beyond that. The derivatives of those Euler angles aren't good for much of anything at all.

    The basic problem here is that orientation is a beast of a rather different color compared to translation. Translation in three dimensional is described by the mathematics of vector space ℝ3, rotation by the mathematics of the Lie group SO(3). The problem with using techniques such as RK4 to integrate orientation is that it is a hammer when what you need is a screwdriver. It's the wrong tool. It can be forced to fit by hackery such as renormalizing the quaternion, but that is still a forced fit.

    For something that isn't a forced fit, you need to look to geometric integration techniques such as Lie group integrators. There's lots of recent literature on geometric integration and Lie group integrators, and some of it you will find online. I don't think you'll find any of this in books yet; it's too new.
  6. Jun 5, 2012 #5
    I don't mean to gravedig, sorry, but I have another question about quaternion derivatives that does not deserve its own thread, and it is within the topic of the discussion.

    I have now figured out how to calculate the quaternion derivatives from the quaternions and the angular velocities. However, when I interpolate these quaternion derivatives, and integrate the resulting polynomials, I don't get values close to my original quaternions. Strangely, only the first component of the reintegrated quaternion q0 matches its original value, while q1, q2 and q3 deviate with time. I thought it might be related to the fact that the three latter components are a function of the principal rotation vector, while q0 is a function of the principal angle only.

    Either way, it is difficult to check where the error is. But the quaternion derivatives are obviously wrong. I suspect the angular velocities are incorrect. These are calculated from the Euler angles and the Euler angle derivatives.

    First, I want to check my quaternion derivative. As the corresponding attitude quaternion is unitary, i.e a norm of one, should its derivative also be unitary? To me, it seems intuitive that a quaternion derivative should be a versor, as both frames have the same origin. But I'm not sure. If the norm of the quaternion derivative changes with time, shouldn't the norm of its quaternion also be changing? I would appreciate a clarification.

    Thanks in advance.
  7. Jun 5, 2012 #6

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    No. There's no reason the quaternion derivative is unitary. For example, the derivative of a constant unit quaternion is zero.

    What you can do to check your quaternion derivative is to verify that the product [itex]q_s \dot q_s + \vec q_v\cdot\dot{\vec q}_v[/itex] is zero. (Here, I am decomposing a quaternion q into a real scalar part [itex]q_s[/itex] and an imaginary part expressed a real 3-vector [itex]\vec q_v[/itex].) Another way to look at it is that if you treat the quaternion and its derivative as real 4-vectors, the inner product is zero. In other words, the quaternion derivative is either zero or normal to the quaternion (normal in a Euclidean 4-space sense).
  8. Jun 6, 2012 #7
    I have been trying to find evidence of this relationship in literature. Why should the inner product of the quaternion and its derivative be zero? In other words, why is the derivative normal to the quaternion? I do understand how this leads to the relationship though, since it is just the computation of the inner product between these quaternions. But I would like some theoretical background.

    Does it have to do with the attitude quaternions being unitary, so that they represent a point on a unit 3-sphere? Is the derivative then necessarily normal?
  9. Jun 6, 2012 #8

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    The inner product of any constant length vector in ℝn and its time derivative is necessarily zero. In other words, the time derivative either is zero or is normal to that constant length vector. Just differentiate [itex]\vec v\cdot \vec v = c^2[/itex]. Since the vector is of constant length, this derivative must be zero. Differentiating [itex]\vec v\cdot \vec v[/itex] yields [itex]\dot{\vec v}\cdot \vec v + \vec v \cdot \dot{\vec v} = 2 \dot{\vec v}\cdot \vec v[/itex].

    The magnitude of a quaternion can be computed by treating the quaternion as a 4-vector and using the standard Euclidean norm for 4-vectors.
  10. Jun 6, 2012 #9
    You're absolutely right, sorry. I understand the proof through the dot product, I had forgotten the quaternions were unitary.

    It seems my derivatives are correct at least in direction, as I get inner products which are either 0, or in the order of 10-19 and 10-20, which can be considered zero, since I'm doing numerical calculations.

    This might mean my interpolation methods are wrong. I'm going to test these.
  11. Jun 6, 2012 #10
    I've tested the interpolation methods in two different ways, and they're unlikely to be the source of error.

    It's obvious the [itex]\dot{q_1}, \dot{q_2}[/itex] and [itex]\dot{q_3}[/itex] components are wrong. If I look at how the quaternion changes with time by printing out the component values at every point, they do not match the magnitude of the derivative.

    What I do is this:

    I have three frames, an inertial frame IN, a local orbital frame LO, and the body-fixed frame BODY. I have the angular velocity of the local orbital frame around the inertial frame, [itex]\Omega^{LO/IN}[/itex], and I have the Euler angles as well as their derivatives of the body-fixed frame relative to the local orbital frame. I can use these to calculate the angular velocity of the body-fixed frame around the local orbital frame with the following relationship:

    [itex]\Omega^{BODY/LO} = \begin{bmatrix}
    \omega_1 \\
    \omega_2 \\
    \omega_3 \\
    \end{bmatrix} = \begin{bmatrix}
    cos \theta cos \psi & sin \psi & 0 \\
    - cos \theta sin \psi & cos \psi & 0 \\
    sin \theta & 0 & 1\\
    \end{bmatrix} \cdot \begin{bmatrix}
    \dot{\varphi} \\
    \dot{\theta} \\
    \dot{\psi} \\

    for the (1,2,3) i.e (roll,pitch,yaw) set of Euler angles I'm using. Now, to get the angular velocity of the Body-fixed frame around the Inertial frame I simply add the velocities:

    [itex]\Omega^{BODY/IN} = \Omega^{BODY/LO}+\Omega^{LO/IN}[/itex]

    I then convert the Euler angles to quaternions in every point to get the quaternion that describes the orientation of the Body-fixed frame relative the Local Orbital frame. Quaternion multiplication by the quaternion relating the Local Orbital frame to the Inertial frame gives the quaternion describing the orientation of the Body-fixed frame relative the Inertial frame:

    [itex]Q^{BODY/IN} = Q^{BODY/LO} \cdot Q^{LO/IN}[/itex]

    I compute the quaternion derivative in every point using the relationship

    = \begin{bmatrix}
    \dot{q_0} \\
    \dot{q_1} \\
    \dot{q_2} \\
    \end{bmatrix} =\frac{1}{2}\begin{bmatrix}
    0 & -\omega_1 & -\omega_2 & -\omega_3 \\
    \omega_1 & 0 & \omega_3 & -\omega_2\\
    \omega_2 & -\omega_3 & 0 & \omega_1\\
    \omega_3 & \omega_2 & -\omega_1 & 0
    \end{bmatrix} \cdot \begin{bmatrix}
    q_0 \\
    q_1 \\
    q_2 \\

    Finally, I interpolate each component independently over time to get a polynomial for every component. I then integrate these polynomials, and recalculate a quaternion component value at every point in time. These do not match the original quaternions I set out with. Oddly enough, only [itex]\dot{q_0}[/itex] is correct, and matches its starting value almost perfectly, accounting for the numerical error of interpolation. I have tested the interpolation independently, and it is doubtful the error comes from there.

    It seems then that the last three rows of the skew symmetric [itex]\Omega[/itex] matrix, used to calculate the derivatives above, are wrong. But I am pretty sure I used the correct formula. Is it a correct method to calculate a quaternion from a quaternion derivative?
  12. Jun 6, 2012 #11

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    That matrix is wrong. You need to either change the signs of the first row and first column or change the signs of the lower right 3x3 submatrix. And even that won't guarantee that you are doing things consistently. Rather than using a matrix, I suggest using a pure imaginary quaternion with the imaginary part being the angular velocity vector. Then use quaternion multiplication to multiply this pure imaginary quaternion and your quaternion to get the quaternion derivative. Finally, scale by 1/2 or -1/2.

    There's a problem here: which comes first, the angular velocity or the quaternion, and is the product scaled by +1/2 or -1/2? The answer depends on how you are using quaternions. There are multiple sources of ambiguity with regard to using quaternions to represent rotations in ℝ3. Left versus right quaternions, transformation versus rotation quaternions, and does the quaternion the rotation/transformation from frame A to frame B or from frame B to frame A?
  13. Jun 7, 2012 #12
    I calculated the quaternion product

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

    where I assumed that [itex]\Omega[/itex] is a pure imaginary quaternion, so that

    [itex]\Omega = \begin{bmatrix}
    0 \\
    \omega_1 \\
    \omega_2 \\
    \omega_3 \\

    This does indeed give the matrix you suggested, i.e

    0 & -\omega_1 & -\omega_2 & -\omega_3 \\
    \omega_1 & 0 & -\omega_3 & \omega_2\\
    \omega_2 & \omega_3 & 0 & -\omega_1\\
    \omega_3 & -\omega_2 & \omega_1 & 0

    for finding the quaternion derivative. However, it seems this doesn't give the correct answer either... But there aren't that many options. If I instead try [itex]\dot{Q}=\frac{1}{2} \Omega \cdot Q[/itex] I don't get the correct quaternion derivative. These are the only two products I can think of. Unless I can use the conjugate of any quaternion. But that would roughly be the equivalent of changing the sign of the equation (at least for [itex]\Omega[/itex]), and [itex]\dot{q_0}[/itex] would now be wrong.

    I tried to think about what equation made sense, instead of just trying out different combinations. If I'm not mistaken, the angular velocity vector/quaternion I'm using here is the angular velocity of the Body-fixed frame around the inertial frame. I multiply this by the quaternion representing the orientation of the Body-fixed frame relative the inertial frame. But what does the quaternion derivative represent? The change in time of the orientation of the Body-fixed frame relative to the Inertial frame? If so, then I could write

    [itex]\dot{Q}^{BODY/IN}=\frac{1}{2} Q^{BODY/IN} \cdot \Omega^{BODY/IN}[/itex]

    [itex]Q^{BODY/IN}[/itex] is clearly a versor, since it is a unitary quaternion. [itex]\Omega^{BODY/IN}[/itex] is not, however, since its norm is not one. Neither is the derivative. Does this then mean that the quaternion derivative both rotates and transforms? Does this really make sense if the frame only rotates?

    I'm also a little confused by the different derivations in literature. I got the previous matrix from Jack Kuiper's book (the one you recommended) chapter 11.5, "Derivative of the quaternion". The same matrix is presented in Schaub & Junkin's book "Analytical Mechanics of Aerospace Systems", chapter 3.4.

    As understand it, if a quaternion represents the orientation of frame A relative to frame B it also transforms frame B into frame A. Right?
  14. Jun 7, 2012 #13

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    You can also negate. There are four possibilities, pre-multiply vs post-multiply, and multiply by +1/2 or -1/2. Which one is right depends on the frame in which you are representing angular velocity, the sense of the angular velocity vector, whether you are using left or right quaternions, whether the quaternion represents rotation or transformation, and the direction sense of the quaternion. I don't know which you are using, so I don't know which of the four alternatives you should be using.

    I use left transformation quaternions and represent angular velocity as the angular velocity of the body with respect to inertial but represented in body coordinates. With this, the time derivative of the inertial frame to body frame left transformation quaternion is
    \dot{\mathcal Q}_{I \to B} =
    - \frac 1 2 \begin{bmatrix} 0 \\ \vec{\omega} \end{bmatrix} {\mathcal Q}_{I \to B}
    For right transformation quaternions, (e.g., Kuiper), simply conjugate:
    \dot{\mathcal Q}_{I \to B} =
    \frac 1 2 {\mathcal Q}_{I \to B} \begin{bmatrix} 0 \\ \vec{\omega} \end{bmatrix}

  15. Jun 8, 2012 #14
    OK, so I got an idea on how to test the handedness of the quaternions.

    First, a correction. The quaternion describing the orientation of the Body-fixed frame relative the Inertial frame is given by the quaternion multiplication

    [itex]\mathcal Q_{I \to B} = \mathcal Q_{I \to O} \cdot \mathcal Q_{O \to B}[/itex] (1)

    and NOT the other way around, as I wrote earlier, it was a typo. I've used the above equation in my calculations. Also, I hope you don't mind me using your notation, it's a bit handier :smile: (O is the Local Orbital frame).

    Now, what I did was calculate the quaternion derivatives separately. In other words, I calculated [itex]\dot{\mathcal Q}_{I \to O}[/itex] and [itex]\dot{\mathcal Q}_{O \to B}[/itex] separately, using [itex]\Omega^{O/I}[/itex] and [itex]\Omega^{B/O}[/itex], respectively (where these are pure imaginary quaternions as before). Working with two frames at a time rather than three is always easier. I tested the multiplication order of each step, and I noticed that it's different. The transition from Inertial to Orbital frames is given by

    [itex]\dot{\mathcal Q}_{I \to O} = \frac{1}{2} \Omega^{O/I} \cdot \mathcal Q_{I \to O}[/itex]

    while the transition from Orbital to Body-fixed frames is given by

    [itex]\dot{\mathcal Q}_{O \to B} = \frac{1}{2} \mathcal Q_{O \to B} \cdot \Omega^{B/O}[/itex]

    So apparently, one quaternion is left-handed, while the other is right-handed, as you wrote. Unfortunately, in this case I'm given many of these values from functions that I have little insight in. But I'll try to draw up the frames and see how they're related.

    And the fact that both equations have +1/2 suggest that the angular velocities are expressed in the target frame, right? For instance: the angular velocity of the body with respect to the orbital frame is expressed in the body-fixed frame.

    So how do I calculate the "total" derivative, i.e the time derivative of the body-fixed frame with respect to the inertial frame? Equation (1) above would suggest

    [itex]\dot{\mathcal Q}_{I \to B} = \dot{\mathcal Q}_{I \to O} \cdot \dot{\mathcal Q}_{O \to B}[/itex]

    However, this turns out to not be the case. I tried to change the order of multiplication, but this does not give correct results either. How should I reason here? Shouldn't it be the same as (1)? I'll check my code again, I wrote this last calculation a bit hastily, and the results are weird.
    Last edited: Jun 8, 2012
  16. Jun 8, 2012 #15

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    No problem. Have at it.

    Whoa! It's not left-handed versus right-handed. It's just left versus right. A left transformation quaternion transform vectors from frame A to frame B via
    [tex]\begin{bmatrix} 0 \\ \vec x_B \end{bmatrix} =
    {\mathcal Q}_{A \to B}
    \begin{bmatrix} 0 \\ \vec x_A \end{bmatrix}
    {\mathcal Q}_{A \to B}^{\ast}[/tex]
    The quaternion is unconjugated on the left, conjugated on the right. Hence the name left quaternion. With right transformation quaternions it's the other way around:
    [tex]\begin{bmatrix} 0 \\ \vec x_B \end{bmatrix} =
    {\mathcal Q}_{A \to B}^{\ast}
    \begin{bmatrix} 0 \\ \vec x_A \end{bmatrix}
    {\mathcal Q}_{A \to B}[/tex]

    Which is right? Both are. There is no right or wrong here. Just right or left.

    I suspect the problem is with your angular velocity vectors. Two issues that can trip you up: The angular velocity of what frame with respect to what other frame, and in which frame's coordinate system is the vector represented? The choice is pretty standard for position and linear velocity. Position is almost invariably the vector from the origin of the inertial frame to the origin of the rotating frame, represented in inertial frame coordinates. Or more generally, from the origin of the parent frame to the origin of the child frame, represented in child frame coordinates. Linear velocity is almost always the element-by-element time derivative of that position vector. In other words, it's the linear velocity of the origin of the rotating frame as observed by an inertial observer, with coordinates expressed in terms of the inertial frame.

    Angular velocity is not so clear. Typically it is the angular velocity of the rotating frame with respect to the inertial frame, with coordinates expressed in terms of the rotating frame. It's a bit convoluted, but this convention goes back to Euler. You have to be very, very careful with angular velocities, particularly so when there are more than two frames involved.
  17. Jun 10, 2012 #16
    I understand the difference now. I agree, it is probably about finding out which frame the angular velocities are expressed in.

    But if I manage to calculate the quaternion derivative from one frame to another, as I did, i.e [itex]\dot{\mathcal Q}_{I \to O}[/itex] as well as [itex]\dot{\mathcal Q}_{O \to B} [/itex] separately, shouldn't there be a way to find [itex]\dot{\mathcal Q}_{I \to B}[/itex] from these? Or should I instead try to conjugate one or both of my angular velocity vectors?
  18. Jun 11, 2012 #17

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    Sure. Just use the chain rule. With right quaternions, [itex]{\mathcal Q}_{I \to B} = {\mathcal Q}_{I \to O} {\mathcal Q}_{O \to B}[/itex], so [itex]\dot{\mathcal Q}_{I \to B} =\dot{\mathcal Q}_{I \to O} {\mathcal Q}_{O \to B} + {\mathcal Q}_{I \to O} \dot{\mathcal Q}_{O \to B}[/itex]
  19. Jun 20, 2012 #18
    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:
    and here:

    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 (Text):
    btQuaternion diffQuater = gyroQuater - boxQuater;
    btQuaternion diffConjQuater;


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

    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;
    Last edited: Jun 20, 2012
  20. Jun 20, 2012 #19

    D H

    User Avatar
    Staff Emeritus
    Science Advisor

    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.
  21. Jul 3, 2012 #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.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Attitude quaternion derivatives from Euler angular velocities