从android读取方向时,节距值为-90度到90度
我正在读取手机的方向值,方位角和滚动数据非常正常,因为它们是-180到180,但我在俯仰上有问题,因为只有当我将手机从0度旋转到360度时,它才是-90到90从android读取方向时,节距值为-90度到90度,android,android-sensors,Android,Android Sensors,我正在读取手机的方向值,方位角和滚动数据非常正常,因为它们是-180到180,但我在俯仰上有问题,因为只有当我将手机从0度旋转到360度时,它才是-90到90 SensorManager.getRotationMatrixFromVector(mRotationMatrix, event.values); SensorManager.getOrientation(mRotationMatrix, orientationVals); float azimuth = (float)Math.toDe
SensorManager.getRotationMatrixFromVector(mRotationMatrix, event.values);
SensorManager.getOrientation(mRotationMatrix, orientationVals);
float azimuth = (float)Math.toDegrees(orientationVals[0]);
float pitch = (float)Math.toDegrees(orientationVals[1]);
float roll = (float)Math.toDegrees(orientationVals[2]);
float deltaX = Math.abs(mLastOrientation[0] - azimuth);
float deltaY = Math.abs(mLastOrientation[1] - pitch);
float deltaZ = Math.abs(mLastOrientation[2] - roll);
if (deltaX < ORIENTATIONNOISE) azimuth = mLastOrientation[0];
if (deltaY < ORIENTATIONNOISE) pitch = mLastOrientation[1];
if (deltaZ < ORIENTATIONNOISE) roll = mLastOrientation[2];
mLastOrientation[0] = azimuth;
mLastOrientation[1] = pitch;
mLastOrientation[2] = roll;
SensorManager.getRotationMatrixFromVector(mRotationMatrix,event.values);
SensorManager.getOrientation(mRotationMatrix,orientationVals);
浮动方位=(浮动)数学到角度(方向值[0]);
浮动节距=(浮动)数学到度数(方向值[1]);
浮动辊=(浮动)数学到角度(方向值[2]);
float deltaX=Math.abs(MLA方向[0]-方位角);
float deltaY=Math.abs(MLA方向[1]-俯仰);
float deltaZ=Math.abs(MLA定向[2]-滚动);
如果(deltaX
有人能帮忙吗。谢谢你,我觉得这很正常。如果你想一想,螺距本质上是设备坐标系中的纬度,纬度的大小不能超过90度——在那个点上(也就是北极和南极),它会卷起并再次开始减小