Arcore-unity-sdk: Localized and/or persistant anchors

Created on 5 Dec 2017  路  6Comments  路  Source: google-ar/arcore-unity-sdk

Hello,
Is there any way to have localized anchors ? Otherwise, is it possible to get the real world position of an object like an anchor or the camera ?
I haven't found anything about persistant anchors but will it be an ARCore feature soon ?

My goal is to place some models in my room using ARCore and save the "configuration" in order to reload it later (i.e instanciating and replacing the models at the same position). I managed to work around the non localized anchors to replace my data after a loss of tracking (camera hidden). Everything is replaced whenever the anchor is visible again by the camera. My next step is to found a way to save anchors using real world positions but I don't know if it is currently possible.

feature request

Most helpful comment

This is something that we used to be able to do with Tango, by saving and loading area definition files. Is something similar in the roadmap for ARCore? Or is the plan to utilize the (upcoming) Visual Positioning Service instead?

All 6 comments

There is currently no built in way to persist anchors from session to session. If you want to keep anchors around between sessions, you'll need to add your own localization code and then make sure to properly offset the camera position and the anchors when they get placed in the world.

This is something that we used to be able to do with Tango, by saving and loading area definition files. Is something similar in the roadmap for ARCore? Or is the plan to utilize the (upcoming) Visual Positioning Service instead?

I'm also trying to persist anchors from session to session, but I'm confused over a couple things. So far, I can cache and reload anchors between sessions, but although they retain their relative rotations and distance to each other, they aren't being placed in the same physical location as the previous session. Interestingly, if I fire up a blank session, add some anchors, save them, detach all anchors, and reload them from the cache, they _will_ retain their physical location and rotation, regardless of where the camera is when I load them. Why is that? I thought that I would've had to offset the translation and rotation values of the anchors to account for the new camera position? It seems like I need to persist data from the session object so that it can be restored in the next session.

Based off your comment @chaosemer, I created a PoseSnapshot class with two members: ObjectPosition and CameraPosition. Both hold the Translation and Rotation values at the time the anchor was created through a user tap. These PoseSnapshots is what I'm caching, and then I'm creating Session Anchors from them on load. From reading the docs, my understanding is that the Translation and Rotation values can change drastically as ARCore's understanding of the world improves. Because of this, I'm surprised my objects retain their physical location so well in the same session considering any updates to the coordinates will be lost as the snapshot only holds the ObjectPosition from the time the the user taps Save.

Also can you clarify what you mean by localization code?
Is there an equation you can provide to help me with getting this camera offset correct to persist the physical locations between sessions (if that is in fact what I need to do)

Update: I'm noticing that even during the same session, if the planes I'm tracking get lost and then I load the anchors once they're back, the physical locations aren't perfect. If I get some trackables, place anchors, and move around but still have the same trackables, the anchors are loaded perfectly regardless of camera position.

Hi, Cloud Anchors was released in ARCore SDK for Unity v1.2.0. Although it does not allow long lived anchors (they live up to 24 hours), it may help with some of these session to session use cases.

can you provide some reference for how can we add localization using arcore?Some code snippet or some way to start with localization?

Please look at the Cloud Anchors sample in our SDK for examples of how to localize two people to the same space.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joshliebe picture joshliebe  路  3Comments

tavilad picture tavilad  路  6Comments

a-kaul picture a-kaul  路  3Comments

Noobay picture Noobay  路  6Comments

alexbu92 picture alexbu92  路  4Comments