找出两个四元数之间的旋转差以校准两个坐标系 [英] Find the rotational difference between two quaternions to calibrate two coordinate systems
问题描述
我需要将四元数流数据偏移一定数量.为此,我计划获取2之间的差,然后将第一个偏移第二个.
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.
我正在运行以下代码:
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);
}
我希望result
是:
(euler) diff = 45, 90 , 0
但是我却得到了:
135,-180,0
我在哪里错了?
推荐答案
您想要的是坐标系的转换.您有一个由传感器RS
测得的旋转和相机RC
的旋转.两者都由一个常量(我们称之为)偏移量RO
:
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
或者
RC = RS * RO^-1
在校准过程中,您获得了RS
和RC
.然后,您可以将偏移量计算为:
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
只需计算出您将更常使用的那个(可能是RO^-1
,因为您想从传感器的旋转中获取摄像机的旋转).
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).
这篇关于找出两个四元数之间的旋转差以校准两个坐标系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!