[CCPPETMR/SIRF] Quaternion (#375)

瀏覽次數:1 次
跳到第一則未讀訊息

Richard Brown

未讀,
2019年4月29日 中午12:34:592019/4/29
收件者:CCPPETMR/SIRF、Subscribed

Ashley Gillman

未讀,
2019年4月29日 下午4:58:352019/4/29
收件者:CCPPETMR/SIRF、Subscribed

Hey Rich, there might be some issue with the quaternion averaging.

https://arc.aiaa.org/doi/abs/10.2514/1.28949

Looks like you should at least divide by the norm to make sure you have a unit quaternion.

David Atkinson

未讀,
2019年4月30日 凌晨3:50:022019/4/30
收件者:CCPPETMR/SIRF、Subscribed

I haven't looked at what you are doing, but in cases where the mean of a set is not clearly defined, one option is to pick from the set an entry that is closest to your expectation of the most representative. (In other words, pick one of the quaternions.) This approach enables you to choose based on expectations, for example, you could compute deformation fields for each quaternion and then select the quaternion that gives the deformation field closest to the mean deformation field within a region of interest.

Richard Brown

未讀,
2019年4月30日 清晨5:38:482019/4/30
收件者:CCPPETMR/SIRF、Subscribed

@DANAJK

for example, you could compute deformation fields for each quaternion and then select the quaternion that gives the deformation field closest to the mean deformation field within a region of interest.

It sounds like that involves human input. The current method is simply to align all quaternions with the first:

// Sum up all quaternions. Start with first, loop over rest
    Quaternion result(quaternions[0]);

    for (unsigned i=1; i<quaternions.size(); ++i) {

        // But first, check whether subsequent quaternions need to be inverted.
        // Because q and -q are the same rotation, but cannot be averaged, we have to make sure they are all the same.
        if (quaternions[i].is_quaternion_close(quaternions[0])) {
            result.w += quaternions[i].w;
            result.x += quaternions[i].x;
            result.y += quaternions[i].y;
            result.z += quaternions[i].z;
        }
        else {
            Quaternion flipped = quaternions[i].inverse_sign_quaternion();
            result.w += flipped.w;
            result.x += flipped.x;
            result.y += flipped.y;
            result.z += flipped.z;
        }

@ashgillman

Looks like you should at least divide by the norm to make sure you have a unit quaternion.

Good spot, I put in a normalise method, but forgot to use it!

Richard Brown

未讀,
2019年4月30日 清晨7:10:512019/4/30
收件者:CCPPETMR/SIRF、Push

@rijobro pushed 1 commit.


You are receiving this because you are subscribed to this thread.

View it on GitHub or mute the thread.

codecov[bot]

未讀,
2019年4月30日 清晨7:24:502019/4/30
收件者:CCPPETMR/SIRF、Subscribed

Codecov Report

Merging #375 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@

##           master     #375   +/-   ##

=======================================

  Coverage   50.05%   50.05%           

=======================================

  Files           2        2           

  Lines        1720     1720           

=======================================

  Hits          861      861           

  Misses        859      859

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e600e14...5b2441c. Read the comment docs.

Richard Brown

未讀,
2019年4月30日 上午10:44:222019/4/30
收件者:CCPPETMR/SIRF、Push

@rijobro pushed 6 commits.


You are receiving this because you are subscribed to this thread.

View it on GitHub or mute the thread.

Ashley Gillman

未讀,
2019年4月30日 下午6:39:292019/4/30
收件者:CCPPETMR/SIRF、Subscribed

I think David is proposing that you use something more like a median than a mean. If you are trying to choose the best of a few possible transforms for a time point, that could be a good choice to eliminate outliers. If you can measure the distance between two quaternions, you could implement something like a simplified k-medoids algorithm to find a median. But it depends what you are trying to achieve, might not be suitable.

Richard Brown

未讀,
2019年5月2日 清晨6:03:462019/5/2
收件者:CCPPETMR/SIRF、Subscribed

Ah I see. Seems overkill for my purpose, so I won't put it in. But you're right, it would be useful to make everything more robust in the future if more people start using it.

Richard Brown

未讀,
2019年5月2日 清晨6:11:342019/5/2
收件者:CCPPETMR/SIRF、Subscribed

Closed #375.

回覆所有人
回覆作者
轉寄
0 則新訊息