Open topic with navigation
Android reports accelerometer values in absolute terms. The values reported are always the data from the physical sensor adjusted to match the Android "canonical" format so that all devices report such data in the same fashion. Android does not transform accelerometer data to be relative to the device orientation. Applications requiring this must perform their own transformations.
To that end, this document uses the following definitions of coordinate spaces and coordinate space transformations to maintain consistency:
|Device Raw||The accelerometer device can output acceleration values in a variety of ways and is not subject to any particular standard.|
|Canonical||Android specifies that the coordinate frame outputted by the driver must remap Device Raw so that the positive X axis is oriented increasing to the right side of the device, the positive Y axis should be increasing to the top of the device, and the positive Z axis is increasing out the display of the device towards the user.
See the Accelerometer Canonical Axes reference for further visual guide to Canonical accelerometer layout.
|Screen||The Android window manager’s screen coordinate origin is at the upper left corner and the maximum coordinate is at the lower right corner, i.e. increasing x is right, increasing y is down. Android’s display manager will change the screen orientation based on sensor readings. The screen coordinate system is always relative to the current rotation.|
|World||This coordinate space is specific to OpenGL ES applications. App developers may need to alter the sample code to fit their assumptions in this regard. In this document, it is assumed that applications are using a right-handed coordinate system, up can be any arbitrary vector.
NOTE: Many applications will require additional transforms to those shown here to orient their models. Apps using left-handed coordinates may require an additional coordinate inversion as well.
The table below shows transforms of interest and defines a vocabulary for this paper. OpenGL applications will typically be using
canonToWorld. Android windowing system based applications will use
canonToScreen. Hybrid applications, such as OpenGL applications that use the Android window system to render widgets, will require both.
NOTE: The accelerometer device driver handles conversion into Canonical space (handling the
deviceToCanon transform), this whitepaper focuses on the
NVIDIA® GameWorks™ Documentation Rev. 1.0.200608 ©2014-2020. NVIDIA Corporation. All Rights Reserved.