Eigen - 旋转矩阵的重新正交化 [英] Eigen - Re-orthogonalization of Rotation Matrix

查看:175
本文介绍了Eigen - 旋转矩阵的重新正交化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在乘以大量旋转矩阵后,由于舍入问题(去正交化),最终结果可能不再是有效的旋转矩阵

After multiplying a lot of rotation matrices, the end result might not be a valid rotation matrix any more, due to rounding issues (de-orthogonalized)

重新正交化的一种方法是按照以下步骤操作:

One way to re-orthogonalize is to follow these steps:

  1. 将旋转矩阵转换为轴角表示(链接)
  2. 将轴角转换回旋转矩阵(链接)

Eigen 库中是否有一些东西通过隐藏所有细节来做同样的事情?或者有没有更好的食谱?

Is there something in Eigen library that does the same thing by hiding all the details? Or is there any better recipe?

由于特殊的奇点情况,这个过程必须小心处理,所以如果 Eigen 提供了一个更好的工具,那就太好了.

This procedure has to be handled with care due to special singularity cases, so if Eigen provides a better tool for this it would be great.

推荐答案

我没有使用 Eigen,也没有费心去查找 API,但这里有一个简单、计算成本低且稳定的过程来重新正交化旋转矩阵.此正交化过程取自 方向余弦矩阵 IMU:理论William Premerlani 和 Paul Bizard;等式 19-21.

I don't use Eigen and didn't bother to look up the API but here is a simple, computationally cheap and stable procedure to re-orthogonalize the rotation matrix. This orthogonalization procedure is taken from Direction Cosine Matrix IMU: Theory by William Premerlani and Paul Bizard; equations 19-21.

xyz 为(稍微混乱的)旋转矩阵的行向量.让 error=dot(x,y) 其中 dot() 是点积.如果矩阵正交,则xy的点积,即error为零.

Let x, y and z be the row vectors of the (slightly messed-up) rotation matrix. Let error=dot(x,y) where dot() is the dot product. If the matrix was orthogonal, the dot product of x and y, that is, the error would be zero.

error 平均分布在 xy 中:x_ort=x-(error/2)*yy_ort=y-(error/2)*x.第三行 z_ort=cross(x_ort, y_ort),根据定义与 x_orty_ort 正交.

The error is spread across x and y equally: x_ort=x-(error/2)*y and y_ort=y-(error/2)*x. The third row z_ort=cross(x_ort, y_ort), which is, by definition orthogonal to x_ort and y_ort.

现在,您仍然需要对 x_orty_ortz_ort 进行归一化,因为这些向量应该是单位向量.

Now, you still need to normalize x_ort, y_ort and z_ort as these vectors are supposed to be unit vectors.

x_new = 0.5*(3-dot(x_ort,x_ort))*x_ort
y_new = 0.5*(3-dot(y_ort,y_ort))*y_ort
z_new = 0.5*(3-dot(z_ort,z_ort))*z_ort

到此为止,已经完成了.

That's all, were are done.

使用 Eigen 提供的 API 应该很容易实现这一点.您可以轻松地提出其他正交化程序,但我认为它不会在实践中产生显着差异.我在我的运动跟踪应用程序中使用了上述程序,它运行良好;它既稳定又快速.

It should be pretty easy to implement this with the API provided by Eigen. You can easily come up with other orthoginalization procedures but I don't think it will make a noticable difference in practice. I used the above procedure in my motion tracking application and it worked beatifully; it's both stable and fast.

这篇关于Eigen - 旋转矩阵的重新正交化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆