[Note: this question was written against the beta version of ARKit during the pre-release version of iOS11 / High Sierra. Retained for historical interest only]
I see erroneous placement and orientation for world origin when I set ARWorldTrackingSessionConfiguration.worldAlignment to .gravityAndHeading .
The position of the origin is stable after the scene is opened. But the axes often rotate 180 or 90 degrees around the Y axis.
Are there any additional settings that I skip? I use iPad 2017 (vanilla, not Pro) and Xcode 9 beta 2. I have tested several compass apps on this iPad and they give me the correct results, so I believe that the equipment works correctly.
override func viewDidLoad() { super.viewDidLoad()
Here are a few samples (in all I look south).
Positive X and Z indicate west and north (wrong, 180 degrees against the phase):

Positive X and Z indicate east southeast and south southeast (close to right):

Positive X and Z indicate east and south (correctly), but the origin is offset by a couple of meters:

Positive X and Z indicate south and west (90 degrees against phase):

From the .gravityAndHeading documentation:
The y-axis corresponds to the direction of gravity detected by hardware that is sensitive to the movement of the device; that is, the vector (0, -1, 0) points down.
The x- and z-axes correspond to the longitude and latitude directions measured by the Location Services. Vector (0,0, -1) indicates true north, and vector (-1, 0,0) indicates west. (That is, the positive x-, y-, and Z axes indicate east, up, and south, respectively.)