Re: Averaging quaternions [message #38707 is a reply to message #38643] |
Sun, 21 March 2004 15:26   |
jelansberry
Messages: 3 Registered: March 2004
|
Junior Member |
|
|
"Arnold Neumaier" <Arnold.Neumaier@univie.ac.at> wrote in message
news:405DD571.1020208@univie.ac.at...
> jelansberry wrote:
>> "Arnold Neumaier" <Arnold.Neumaier@univie.ac.at> wrote in message
>> news:405D56B6.6030403@univie.ac.at...
>>
>>> jelansberry wrote:
>>>
>>>> I would compute the average of the
>>>> Euler angles, and then convert the resulting average Euler angles back
to a
>>>> quaternion (convert the Euler angles to a direction cosine matrix, then
>>>> extract the quaternion).
>>>
>>> This has exactly the same problems as averaging over quaternions, since
>>> angles are only unique up to a multiple of pi or 2pi; so the average
>>> depends on whether you represent an angle by a number close to pi or
>>> close to -pi ...
>>>
>>> Arnold Neumaier
>>>
>>
>>
>> "Uniqueness" of the Euler angles is not the issue, it's more an issue of
>> continuity of the angles. Euler angles do not have the "same" problems
as
>> averaging over quaternions. My basic beef with averaging quaternions is
>> that the initial result of the average is not a quaternion (i.e., the
result
>> does not have unit norm). Euler angles do not suffer from such a
>> complication.
>
> The real part of a unit quaternion (with nonnegative real part)
> is redundant in that it can be recomputed from the imaginary part.
> Thus averaging the imaginary parts and recomputing the real part
> would be a simpler recipe of the same kind as yours with Euler angles.
> And it would have exactly the same problems as the avarage-and-scale
> method, although there are no asingularities. It is a matter of
> non-uniqueness in both cases, which implies that one must make ad hoc
> normalizations: A choice of sign in the quaternion case, and a choice
> of some normalization interval in the Euler case. This cannot be
> done without introducing discontinuities - these are not present
> in the mathematics but only in the normalization chosen.
I'm not following what you mean by a "normalization" interval (or
"normalization bounds" below). Euler angles do not require "normalization."
I still maintain that any "discontinuity" in the Euler angles usually is the
result of passing through the singularity that exists in any three-parameter
representation of the direction cosine matrix, and it is generally easy to
avoid this situation. Let's put it this way - in the aerospace industry (in
which I work), we typically use the 3-2-1 Bryant sequence for guided
missiles. Why? Because the singularity (i.e., where yaw and roll are not
distinguishable) occurs at a pitch angle of 90 degrees, which is an unusual
attitude for a guided missile to obtain (relative to local level). One
could say the same for a manned aircraft. You don't see too many planes
heading "straight up" relative to local level. If one stays away from 90
degree pitch angles, a plot of the Bryant angles over time is rarely
discontinuous. Hence, averaging the Euler angles over any time interval is
usually a reasonable thing to do. For that matter, interpolating in a time
history of Euler angles is usually a reasonable thing to do. It is rarely a
problem, and, if it is, selecting an alternative Euler/Bryant sequence is
typically enough to avoid any problems.
As for quaternions, even if cos(theta/2) passes through zero, it does not
represent a singularity or discontinuity unless one desires to keep
cos(theta/2) positive (always). I've yet to find a simulation where the
time history of quaternions shows any singularity or discontinuity. That's
one of the advantages of quaternions relative to Euler angles when it comes
to simulations.
>
>> If all the OP is doing is trying to find the average attitude over some
>> fairly small period of time, then one might expect the Euler angles
>> corresponding to the quaternion samples to fairly continuous.
>
> Not if one of the angle is just a little less than pi and increasing
> beyond pi (suddenly becoming -pi)
Yes, typically this happens when you pass through the singularity of the
Euler sequence. It rarely occurs otherwise. This requires inspection of
the data and a "wise" choice of Euler sequence, but what's the big deal? If
your main argument is that one of the Euler angles could pass from -pi to pi
(e.g., the yaw or roll Euler angle getting close to +/- 180 degrees), then
the argument is weak. I can always redefine my reference frame to avoid
that kind of problem for the purpose of "averaging" Euler angles. It really
isn't that hard - I do it all the time.
>
>> I agree (and my post gave fair warning) that with Euler angles one has
to be
>> careful of choosing sequences near the singularity of the sequence.
>
> AND near the normalization bounds! The average-and-scale technique is
> thus even better since it has no singularities and only the
> problem with possible discontinuities in the representation.
As I said previously, my main issue with "average and scale" is that the
initial "average" results in something that is not even a quaternion. This
is why SLERP was created in the first place - to interpolate between two
unit vectors under the constraint that the result is also a unit vector. If
the unit vectors are widely separated (the angle between them is "large"),
linear interpolation between the unit vector components (followed by
"normalization" to get a unit vector back) may result in something
non-sensical. I can imagine the same type of problems with "averaging and
scaling" a bunch of quaternions. Clearly, this will be less of a "problem"
if the unit vectors are not widely separated, which is probably the case for
the OP. Admittedly, if the unit vectors are close to one another, it
probably doesn't matter much what you do. But I think I can take the
average of Euler angles of 0 degrees and 135 degrees and get a more
reasonable result than averaging the components of the corresponding
quaternions, especially if the data is taken at regularly sampled time
intervals.
>
>
> Arnold Neumaier
>
|
|
|