[英]Find the rotational difference between two quaternions to calibrate two coordinate systems
我需要将四元数流数据偏移一定数量。 为此,我计划获取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
关联:
RS = RC * RO
或者
RC = RS * RO^-1
在校准过程中,您将获得RS
和RC
。 然后,您可以将偏移量计算为:
RO = RC^-1 * RS
RO^-1 = RS^-1 * RC
只需计算出您将更常使用的那个(可能是RO^-1
因为您想从传感器的旋转中获取摄像机的旋转)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.