Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong transforms returned from GARFrame.anchors #102

Open
ertembiyik opened this issue May 4, 2024 · 11 comments
Open

Wrong transforms returned from GARFrame.anchors #102

ertembiyik opened this issue May 4, 2024 · 11 comments

Comments

@ertembiyik
Copy link

ertembiyik commented May 4, 2024

About 3 days ago I started to notice that transforms returned from GARFrame.anchors were wrong. The nodes were either not in the desired spot nor not showing at all. The issue can be reproduced with the sample app from this repository.
The issue only takes place when restoring the session, for example adding saved anchors.

I'm using ARCore 1.42 on iPhone 14 Pro, i also reproduced the issue with iPhon 12 too

@ertembiyik
Copy link
Author

Seems like all transforms are getting the translations equal to the device's translation at the beginning of the ar session

@15kingben
Copy link

Hi Ertem, can you clarify the steps to reproduce this issue? I am not able to reproduce this on the GeospatialExample app. Note that the GeospatialExample does not save geospatial anchors on streetscape geometry. Are the sample app's terrain and rooftop anchors affected as well?

Can you additionally check what values are read from the user defaults to ensure that is not an issue https://github.com/google-ar/arcore-ios-sdk/blob/master/Examples/GeospatialExample/GeospatialExample/ViewController.m#L540

@ertembiyik
Copy link
Author

Hi Ben, I was able to properly add saved terrain anchor from example app, but unfortunately the WGS84 anchors didn't load (my app uses them too).
I don't use any streetscape geometry inside my app nor in the example one

@15kingben
Copy link

When you click the "SHOW GEOMETRY" switch on the sample app, do you see different behavior? When that switch is enabled, the sample app creates anchors on the streetscape geometry which are not saved between sessions, however if you place them on the terrain they may appear the same as normal anchors. When that switch is disabled, anchors are placed on ARKit planes instead, and can be saved.

@ertembiyik
Copy link
Author

When I add and then load WGS84 anchors the "SHOW GEOMETRY" switch is in off state, but the saved anchors are not appearing in the scene

@ertembiyik
Copy link
Author

Hi @15kingben have you managed to reproduce the issue? Saved WGS84 still don't load in any circumstances

@15kingben
Copy link

I am now able to reproduce the issue, sorry for the misunderstanding. I am taking a look now

@15kingben
Copy link

Hi Ertem, it seems like an issue with https://github.com/google-ar/arcore-ios-sdk/blob/master/Examples/GeospatialExample/GeospatialExample/ViewController.m#L667 where the nodes are removed when they are added because the current garFrame does not yet have the new anchors. The terrain and Rooftop anchors are async so take at least one frame to resolve. I'm not sure if this was always the case, perhaps SceneKit changed the timing/threading of certain things. It's a race condition regardless. I'll add a fix for this in the next release.

@ertembiyik
Copy link
Author

Thanks for your elaboration on that one!
To help you more, I wanted to mention that I'm able to reproduce the issue with RealityKit too and it seems to me like the transforms returned from GARFrame's anchors are invalid even after the first frame was processed.
They won't update to the correct ones even after some time passes.
So I think the issue is somewhere in the sdk itself or more likely in the api response, because I was able to reproduce the same behavior on ARCore 1.41

@ertembiyik
Copy link
Author

Hi @15kingben
Can you please share the approximate date of the next release?
This issue is fatal for apps using WGS84 anchors

Thanks

@15kingben
Copy link

The only fix would be in the sample app, note that GARFrames and GARAnchors are immutable, so they will never be updated over time. Rather, you need to get the latest snapshot from garFrame.anchors and update any anchors accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants