Find the rotational difference between two quaternions to calibrate two coordinate systems

£可爱£侵袭症+ 提交于 2019-12-22 17:42:47

问题


I need to offset streaming quaternion data by a specific amount. To do this I plan to get the difference between the 2, then offset the first by the second.

I am having trouble finding the difference between the 2.

Using this converter.

I am running this code:

public void convertQuat180()
{
    Quaternion q = new Quaternion(0.65328f, 0.2706f, 0.65328f, -0.2706f); //45,180,0

    Quaternion q180 = new Quaternion(0.70711f, 0, 0.70711f, 0);  // 0,90,0

    Quaternion result = q180 * Quaternion.Inverse(q);

    Console.WriteLine(result);
}

I would expect result to be:

(euler) diff = 45, 90 , 0

But instead i get:

135,-180,0

Where am i going wrong here?


回答1:


What you want is a transformation of coordinate systems. You have a rotation measured by the sensor RS and a rotation of the camera RC. Both are related by a constant (let's call it) offset RO:

RS = RC * RO

Or alternatively

RC = RS * RO^-1

During your calibration procedure, you acquire RS and RC. Then, you can calculate the offset as:

RO = RC^-1 * RS
RO^-1 = RS^-1 * RC

Just calculate the one that you will use more often (probably RO^-1 because you want to get the camera rotation from the sensor rotation).



来源:https://stackoverflow.com/questions/39192856/find-the-rotational-difference-between-two-quaternions-to-calibrate-two-coordina

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!