arkitworld-map

Why anchors' position doesn't change after ARKit reconciling the recorded world map with the current environment?


Environment: ARKit 2.0, iPhone X, iOS 12.1

While running an ARSeesion at the ARWorldMappingStatusMapped state,

  1. A few custom anchors at specified positions (#A) were added to the world map via ARSession.AddAnchor.
  2. The world map was saved to a file.

Then close the app and restart the ARSession,

  1. configuration Loaded the saved world map and assigned it to ARKitWorldTrackingSessionConfiguration.initialWorldMap
  2. run option reset tracking and remove existing anchors
  3. Then restart the session by calling ARSession.runWithConfiguration with the configuration and run option above.
  4. When the state of ARSession indicates that it has reconciled the recorded world map with the current environment, read the positions of anchors (#B) from ARWorldMap.anchors.

But I found that positions of read anchors (#B) are not changed compared to positions when they were saved (#A). That's incorrect. Why?

Because the initial position of the phone is the position of coordinate origin. And the app was once closed and the phone was moved to another place. So the position of coordinate origin changed after restarting the ARSeesion. Then ARSession should also reconcile the positions of ARAnchors saved in the world map to proper places, thus the positions of ARAnchors should have been changed.


Solution

  • I found the cause. The initial session, whose initialWorldMap is nil and run option is 0, started after I restarted the session for reconciling. So it conflicted with the reconciling session. Which cancels reconciling. Thus the positions of loaded anchors will not change because they are unknown to the ARSession.