简体   繁体   English

俯仰偏航角,角度独立

[英]pitch yaw roll, angle independency

I am trying hard to figure out how to make pitch yaw and roll independent between them. 我正在努力弄清楚如何使它们之间的偏航和侧倾独立。 As soon as I rotate something in the z axis (pitch) the second rotation (yaxis yaw) depends on the results of the first and the third rotation (x axis, roll) depends on the other two. 一旦我在z轴(螺距)上旋转某些东西,第二旋转(y轴偏航)就取决于第一和第三旋转的结果(x轴,横摇)取决于其他两个。 So instead of having independent pitch,yaw,roll I get a mixture of the three of them, ugly. 因此,我没有将它们三个单独地混合在一起,而是丑陋了。

I wish it was possible to store the object angles in an array [pitch,yaw,roll] and then decode those angles during the transformation so that yawing put the object in a given position and then it took the angle corresponding to the pitch, but not a compound of both... 我希望可以将对象角度存储在数组[pitch,yaw,roll]中,然后在转换过程中对这些角度进行解码,以使偏航将对象放置在给定位置,然后采用与角度相对应的角度,但是两者都不是...

I have seen references to an 'arbitrary axis rotation matrix'. 我已经看到了对“任意轴旋转矩阵”的引用。 Would it be useful to get the desired results??? 获得期望的结果会有用吗??? 1) apply yaw (gl.glRotatef(beta, 0.0f, 1.0f, 0.0f);) 2) get the resulting axis of manually rotating the vector (1.0f,0.0f,0.0f) arround beta 3) apply pitch using the axis got in 2 {and for roll... if 1,2,3 are correct} 4) rotate the axis got in 2 arround its x for a roll 5) apply roll using the axis got in 4 1)应用偏航(gl.glRotatef(beta,0.0f,1.0f,0.0f);)2)获取手动旋转矢量的结果轴(1.0f,0.0f,0.0f)围绕beta 3)使用轴进入2 {并且用于滚动...如果1,2,3是正确的} 4)旋转进入2的轴绕其x进行滚动5)使用进入4的轴进行滚动

Would it work? 能行吗? Any better solution? 有更好的解决方案吗? I would like keeping my object local orientations in the [pitch,yaw,roll] format. 我想将对象的局部方向保持为[pitch,yaw,roll]格式。

I have been struggling with it for days, I would like to avoid using quaternions if possible. 我已经为此苦苦挣扎了好几天,如果可能的话,我想避免使用四元数。 The 3D objects are stored relatively to 0,0,0 and looking along {1,0,0} and transformed to their destination and angles each frame, so the gimbal lock problem should probably be avoided easily. 3D对象相对于0,0,0进行存储并沿{1,0,0}进行查看,并转换为它们的目的地和每一帧的角度,因此应该很容易避免万向架锁定问题。

In other words, my camera is working fine, World coordinates are being correctly made, but I do not know how or where object-local-transformations based on yaw,pith,roll should be applied. 换句话说,我的相机工作正常,可以正确制作世界坐标,但是我不知道应该如何或在何处基于偏航,纵摇,横摇应用对象局部变换。

The results should be read from the array [y,p,r] and combinations of them should not overlap . 结果应从数组[y,p,r]中读取,并且它们的组合不应重叠

Actually my transformations are: 实际上,我的转换是:

gl.glLoadIdentity(); 
float[] scalation = transform.getScalation();
gl.glScalef(scalation[0], scalation[1], scalation[2]); 
float[] translation = transform.getTranslation();
gl.glTranslatef(translation[0], translation[1], translation[2]);
float[] rotation = transform.getRotation();
gl.glRotatef(rotation[0], 1.0f, 0.0f, 0.0f);
gl.glRotatef(rotation[1], 0.0f, 1.0f, 0.0f);
gl.glRotatef(rotation[2], 0.0f, 0.0f, 1.0f);

The orientation always depends on angles order. 方向始终取决于角度顺序。 You can't make them indipendent. 你不能让他们独立。 You rotate vectors multipling them by matrices, and matrix multiplication is not commutative. 旋转将向量乘以矩阵,矩阵乘法是不可交换的。 You can choose one order and be consistent with it. 您可以选择一个订单并与之保持一致。 For these problems, a common choice is the ZYX orientation method (first roll, then pitch and at the end yaw). 对于这些问题,通常的选择是ZYX定向方法(先滚动,然后俯仰,最后偏航)。 My personal reference when I work with angles is this document , that helps me a lot. 我在处理角度时的个人参考是此文档 ,对我有很大帮助。

if you use yaw/pitch/roll, your final orientation will always depend on the amounts and order in which you apply them. 如果您使用偏航/俯仰/滚动,则最终方向将始终取决于应用它们的数量和顺序。 you can choose other schemes if you want readability or simplicity. 如果您希望可读性或简单性,则可以选择其他方案。 i like choosing a forward vector (F), and calculating a right and up vector based on a canonical 'world up' vector, then just filling in the matrix columns. 我喜欢选择前向矢量(F),然后根据规范的“世界向上”矢量计算右向上矢量,然后仅填充矩阵列。 You could add an extra 'axis spin' angle term, if you like. 如果愿意,可以添加一个额外的“轴旋转”角度项。 It's a bit like a quaternion, but more human-readable. 它有点像四元数,但是更易于理解。 I use this representation for controlling a basic WASD-style camera. 我使用此表示来控制基本的WASD风格的相机。

Accumulating (yaw, pitch, roll) rotations requires to keep a transformation matrix, which is the product of the separate transformations, in the order in which they occur. 累积旋转(偏航,俯仰,横滚)需要保持一个变换矩阵,该矩阵是各个变换按其发生的顺序生成的。 The resulting matrix is a rotation around some axis and some angle. 生成的矩阵是围绕某个轴和某个角度的旋转。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM