google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.95k stars 1.22k forks source link

Anchor sometimes jump with respect to the camera #1001

Open korneeld opened 4 years ago

korneeld commented 4 years ago

SPECIFIC ISSUE ENCOUNTERED

When creating an anchor based on the camera position, it sometimes happens that the position of this anchor is moved far away from the camera shortly after. This shift is at least a couple of meters, but sometimes also 30-40 meters. I can see this visually since my scene jumps from one location to another and back. I'm guessing this is caused by ARCore world corrections (maybe wrongly identified feature points). Is there any way to be notified of large AR-world corrections (> 2m)? Or maybe the Anchor should lose its tracking state.

VERSIONS USED

STEPS TO REPRODUCE THE ISSUE

  1. create an anchor at the camera position
  2. compare the anchors position to the camera position a few frames later
  3. occasionally observe the large difference
RGregat commented 4 years ago

I encounter the same effect. I use the hit test on a trackable to place objects. But instead of setting an anchor on that trackable, I use the session. Maybe you ask why, well because of a statement in the documenetation:

Session Anchor "Appear to stay at the same pose in world space throughout the user experience"

Trackable Anchor "Appear "welded" to the Trackable and be subject to the same rotational effects as the Trackable."

I thought the jumping will effect all points the same, if anchored to the session, but so far this is not that what I experienced. If I move to a point it first is on the wrong position and eventual jumps to the correct position. But this effects all other points as well. This happens most of the time, if I visit one anchored point.

I implemented a little debug window to monitor the distance between anchored points, the diff from the last check and the diff of the world position from the last check. I guess, I will output that to a CSV-File and put it into Excel or so, to have a better understanding.

So maybe a dev could explain how to get the best stable result from ARCore? Maybe any advise to first walk around before anchoring points, or some extra care before placing an anchor (maybe circle the desired position).

Augmentaio commented 4 years ago

"Is there any way to be notified of large AR-world corrections (> 2m)?" I find that very interesting too