You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The reference frame for Orientation on iOS does not always match that on Android because React-Native-Sensors does not explicitly configure CoreMotion to return attitude readings relative to the ground plane and magnetic north.
Expected behavior
A consistent reference frame for Orientation values across platforms, or at least reference frames that both integrate gyroscope and magnetometer data.
Additional context
On Android, React-Native-Sensors pulls values from getOrientation() on SensorManager. According to the API docs, the reference frame is relative to magnetic north and gravity.
On iOS, React-native-Sensors pulls values from attitude from CMMotionManager.deviceMotion(). According to the API docs, the default reference frame is xArbitraryZVertical. However, CMMotionManager can be configured to use xMagneticNorthZVertical by passing it to startDeviceMotionUpdatesToQueue:…in RNSensorsOrientation.m (docs). Availability can be checked with isMagnetometerAvailable() or availableattitudereferenceframes(). While setting this reference frame requires a magnetometer, the same requirement applies to the current Android implementation of Orientation.
I'd be happy to submit a patch but wanted to get feedback on the proposal, first.
The text was updated successfully, but these errors were encountered:
Describe the bug
The reference frame for
Orientation
on iOS does not always match that on Android because React-Native-Sensors does not explicitly configureCoreMotion
to return attitude readings relative to the ground plane and magnetic north.Expected behavior
A consistent reference frame for
Orientation
values across platforms, or at least reference frames that both integrate gyroscope and magnetometer data.Additional context
On Android, React-Native-Sensors pulls values from
getOrientation()
onSensorManager
. According to the API docs, the reference frame is relative to magnetic north and gravity.On iOS, React-native-Sensors pulls values from
attitude
fromCMMotionManager.deviceMotion()
. According to the API docs, the default reference frame isxArbitraryZVertical
. However,CMMotionManager
can be configured to usexMagneticNorthZVertical
by passing it tostartDeviceMotionUpdatesToQueue:…
in RNSensorsOrientation.m (docs). Availability can be checked withisMagnetometerAvailable()
oravailableattitudereferenceframes()
. While setting this reference frame requires a magnetometer, the same requirement applies to the current Android implementation ofOrientation
.I'd be happy to submit a patch but wanted to get feedback on the proposal, first.
The text was updated successfully, but these errors were encountered: