iOS プロトタイプでは、CMDeviceMotion.deviceMotion.yaw と CLHeading.trueHeading の組み合わせを使用して、応答性が高く正確な安定したコンパス ヘディングを作成します。これは、iPhone が平らに保持されている場合にうまく機能し、安定したコンパスの方向を指すグラフィカルな矢印が表示されます。
この問題は、iPhone をポートレート モードで垂直に保持すると発生します。UIDeviceOrientation は、UIDeviceOrientationFaceDown から UIDeviceOrientationFaceUp に、またその逆に常に変化します。これにより、ピッチの小さな変化に基づいてヨー値が前後に +/-180 度スキップします。安定したヨー値を与える 1 つの方向にデバイスをロックしたり、グリッチなしで変化を予測したり、他の方法でジャイロ ヨー (またはこの方向でロール) を計算したりすることは可能ですか?
この哀れな男も同じ問題を抱えていますが、答えはありません。ダブルポイント可能者!:) https://stackoverflow.com/questions/10470938/euler-angle-yaw-not-working-when-iphone-orientation-changes