![](/img/trans.png)
[英]iOS/Android Device orientation (pitch, yaw, roll). Is it better with accelerometer or gyroscope?
[英]Pitch, roll and yaw from accelerometer and magnetometer
我想根據旋轉向量做一些工作。 問題在於大多數Android設備都沒有陀螺儀傳感器(也沒有旋轉矢量傳感器)。 我認為有一種方法可以通過使用加速度計(用於俯仰和橫滾)和磁力計(用於偏航)來計算四元數的近似值。 問題在於它們的值不受最大值限制(對於俯仰和橫滾,我可以使用G = 9.81並嘗試過濾其他加速度)。
有人可以幫我找到一個近似的解決方案嗎?
float[] rotationMatrix = new float[16];
float[] rotationMatrixRemapped = new float[16];
float[] accMagOrientation = new float[3];
SensorManager.getRotationMatrix(rotationMatrix, null, oldAccelerometerVals, oldMagnetometerVals);
SensorManager.remapCoordinateSystem(rotationMatrix, SensorManager.AXIS_MINUS_Y, SensorManager.AXIS_MINUS_X, rotationMatrixRemapped);
SensorManager.getOrientation(rotationMatrix, accMagOrientation);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.