【发布时间】:2014-09-22 22:44:30
【问题描述】:
我正在使用来自MISB KLV Local Dataset 的数据和NASA Worldwind 中提供的矩阵运算。 MISB 数据以 Yaw、Pitch 和 Roll 提供平台方向以及在 Yaw、Pitch 和 Roll 中相对于平台的传感器方向。我正在尝试根据平台方向和传感器相对方向计算传感器相对于北方的绝对方向(偏航、俯仰、滚动)。
我目前正在计算平台旋转矩阵和传感器相对旋转矩阵,并将结果相乘。生成的旋转矩阵似乎不正确。根据第 6.2.4 节中的 MISB 文档,欧拉角操作顺序是偏航、俯仰、然后滚动。组合旋转矩阵以获得绝对旋转的正确方法是什么?
//use transpose for clockwise rotation
Matrix mpYaw = Matrix.fromRotationZ(pYaw).getTranspose();
Matrix mpPitch = Matrix.fromRotationY(pPitch).getTranspose();
Matrix mpRoll = Matrix.fromRotationX(pRoll).getTranspose();
Matrix msYaw = Matrix.fromRotationZ(sYaw).getTranspose();
Matrix msPitch = Matrix.fromRotationY(sPitch).getTranspose();
Matrix msRoll = Matrix.fromRotationX(sRoll).getTranspose();
Matrix mpRot = mpYaw.multiply(mpPitch).multiply(mpRoll); //platform
Matrix msRot = msYaw.multiply(msPitch).multiply(msRoll); //sensor
Matrix maRot = mpRot.multiply(msRot); //absolute
示例 MISB 数据:
Platform Heading Angle:175.66308079652094
Platform Pitch Angle:3.4296700949125647
Platform Roll Angle:-0.3982665486617634
Sensor Rel. Az. Angle:326.08593764856596
Sensor Rel. El. Angle:-21.60937493741949
Sensor Rel. Roll Angle:0.0
Sensor Latitude:33.03482410173622
Sensor Longitude:-114.45451377632772
Sensor True Altitude:1022.4368657969026
Frame Center Lat.:33.01531312661958
Frame Center Lon.:-114.4367867216639
Frame Center El.:79.58953231097883
Slant Range:2883.640118614687
编辑 1:
应用@anjruu 建议的修复后,结果看起来很接近,但仍然略有偏差。我通过将旋转矩阵的前向向量乘以 MISB 提供的目标距离来计算到目标位置的局部 NED 坐标。然后我计算了 MISB 提供的目标位置的本地 NED 坐标(使用 ViewUtil),原点设置为提供的平台位置,结果略有偏差。
Matrix mpYaw = Matrix.fromRotationZ(pYaw).getTranspose();
Matrix mpPitch = Matrix.fromRotationY(pPitch).getTranspose();
Matrix mpRoll = Matrix.fromRotationX(pRoll).getTranspose();
Matrix msYaw = Matrix.fromRotationZ(sYaw).getTranspose();
Matrix msPitch = Matrix.fromRotationY(sPitch).getTranspose();
Matrix msRoll = Matrix.fromRotationX(sRoll).getTranspose();
Matrix mpRot = mpRoll.multiply(mpPitch).multiply(mpYaw); //platform
Matrix msRot = msRoll.multiply(msPitch).multiply(msYaw); //sensor
Matrix maRot = msRot.multiply(mpRot); //absolute
Globe globe = new Earth();
Position pPlatform = Position.fromDegrees(33.03482410173622, -114.45451377632772, 1022.4368657969026);
Position pTarget = Position.fromDegrees(33.01531312661958, -114.4367867216639, 79.58953231097883);
double targetRange = 2883.640118614687;
Vec4 vTarNED = new Vec4(1,0,0).transformBy3(maRot.getTranspose()).multiply3(targetRange);
//NED = (-2165.935747907422, 1656.9597179630864, 937.3298046411029, 1.0)
Matrix localENU = ViewUtil.computePositionTransform(globe, pPlatform);
Vec4 vTarENU = globe.computePointFromPosition(pTarget).transformBy4(localENU);
//ENU = (1656.3846316600684, -2163.7501770820236, -943.4305881811306, 1.0)
//NED = (-2163.7501770820236, 1656.3846316600684, 943.4305881811306, 1.0)
【问题讨论】:
-
您能否包含 Matrix 类,或者至少包含
multiply的规范?我猜Matrix::multiply是一个右乘法,并且相机姿势是相对于平台姿势的,这意味着它应该是msRot.multiply(mpRot),并且你应该反转乘法链以获得mpRot和@987654332 @,但我不知道multiply实际做了什么。 -
@anjruu 文章中的 NASA WorldWind 链接指向 Matrix 类。
-
确实如此,抱歉。是的,
A.multiply(B)是A*B(这很正常),所以我认为应该是Matrix mpRot = mpRoll.multiply(mpPitch).multiply(mpYaw);,msRot和maRot也是如此。 -
@anjruu 我添加了一个测试用例来验证您的更改,但我仍然得到稍微不正确的结果。
标签: matrix rotational-matrices