欧拉角和四元数方向
如何将 wintracker II 设备的四元数方向输出转换为仅欧拉角输出。因为Wintracker II设备输出欧拉角和四元数方向。我只想输出欧拉角。
how to convert Quaternion orientation output of wintracker II device to Euler Angles output only. Because Wintracker II device Output Euler angles and Quaternion orientation. i want to Euler angles output only.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经实现了本文中描述的算法,并且效果很好:
http://www.euclideanspace.com/maths/geometry /rotations/conversions/quaternionToEuler/quat_2_euler_paper_ver2-1.pdf
答案#1中列出的维基百科文章的问题在于它只提供了 XYZ 旋转的公式。这里引用的论文给出了一个通用算法,适用于 12 个序列中的任何一个。您可能需要阅读几次,并且一定要完成该示例。这不是最容易理解的,但我已经对它进行了单元测试,它非常防弹。
根据第一条评论,以下是我的代码的主要组成部分。应该足以让你继续下去:
第一类是“AxisType”。我使用的主要功能是它的“getNextCircular()”。它还可以使我的代码轻松转换为向量。
接下来是 EulerOrder,它表示轴的特定顺序(例如 XYX、ZYX 等)和一堆静态构造函数。这是很多样板文件,但它就是......
这让我们看到了算法本身。我保留了 Hugh 先生的变量名称,以便于使用原始文档进行调试。
这里缺少一些我没有包含的类(Angle、RotationSequence、Quaternion),但我相信上面的代码为人们提供了一个非常可靠的起点。
I have implemented the algorithm described in this paper and it works very well:
http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/quat_2_euler_paper_ver2-1.pdf
The problem with the Wikipedia article listed in answer #1 is that it only provides the formula for the X-Y-Z rotation. The paper referenced here gives a general algorithm that will work for any of the 12 sequences. You may need to read it a few times, and definitely work through the example. It's not the easiest to follow, but I have unit tested the snot out of it and it's pretty bulletproof.
Per the first comment, here are the major components of my code. Should be enough to get you going:
The first class is 'AxisType'. The main feature that I use is the 'getNextCircular()' on it. It also makes for easy conversions in my code to Vectors.
Followed by EulerOrder, which represents a specific ordering of axis's (so XYX, ZYX, etc) and a bunch of static constructors. It's a lot of boilerplate, but here it is...
This brings us to the algorithm itself. I kept Mr. Hugh's variable names for easier debugging with the original document.
There are a few classes missing here that I have not included (Angle, RotationSequence, Quaternion), but I believe that the above code gives folks a very solid jumping off point.