0
我一直在尝试使用getOrientation()方法获取标题值。Android:getOrientation()是否需要连续重映射?
boolean success = SensorManager.getRotationMatrix(rot, incl, accel, magnet);
if (success) {
// Compute orientation
float orientation[] = new float[3];
SensorManager.getOrientation(rot, orientation);
}
即使我将手机保持稳定并保持稳定的姿势,这些值也会大幅变化。
我然后试图在我的加速度值的基准从电话改变到世界轴:
// Compute world acceleration
float wAccel[] = new float[4];
float newAccel[] = new float[]{accel[0],accel[1],accel[2], 0};
android.opengl.Matrix.multiplyMV(wAccel, 0, rot, 0, newAccel, 0);
magnetLine += "W" + LOGSEPARATOR +
tsString + LOGSEPARATOR +
wAccel[0] + LOGSEPARATOR +
wAccel[1] + LOGSEPARATOR +
wAccel[2] + "\n";
}
我然后从X轴和Y轴上的ATAN2函数中使用的值来确定的角度向量。即使以不同的方式变化,这些值仍然显示出奇怪的行为(有时值是恒定的,有时显示周期性行为,仿佛跟随着脚步)。
我已经看到一些人调用remapCoordinate系统的情况有些类似于这种情况。这是我失踪的吗?
感谢使用重力传感器的技巧,它非常显着地平滑了信号。我不认为我在图表中丢失了磁力计的数值,因为每当我读到数据时都会绘制所有这些点。 – ravemir