Reputation: 1883
I am trying to use AreaDescription and AreaLearning under Unity to place, save and load objects in AR but I have a problem when relocalisation and loop closures.
For now I am able to learn an ADF, load it and relocalize (from the AreaLearning tutorial of the developer website). I also manage to place objects and save their coordinates in an xml.
My problem is when I load the xml, the coordinates of my objects are with respect to the start of service of the App when I saved them so they are not in the right position in my scene.
I don't understand how this is done in the AreaLearning example. I know this is in AreaLearningInGameController, but I really don't understand the workflow of it.
To summerize in one question: How do I save an object in AR with respect to an ADF, and how do I retrieve its position from the ADF to my app?
If you have hints, tutos, or explanations, I would be very grateful !
Thanks.
Upvotes: 0
Views: 223
Reputation: 61
You are correct that the XML saves the position of the object relative to start of service. For a newly recorded area description, that area description's origin gets fixed to start of service at the initial recording. When loading the area description in the future, its origin will not change.
To make the objects stay persisted, you need to load the previously recorded area description and make sure Tango Manager and Tango Pose Controller are both configured to use Area Description (and not Start of Service) as the origin.
I hope this helps!
Upvotes: 1
Reputation: 1883
Okay so I found the answer to my question and the solution to my problem.
It is surprising that Google doesn't emphasize more on this in their ADF tutorial.
Anyway the key is to check "Use AreaDescription" in Tango Pose Controller script of the Tango AR Camera Prefab. This is this boolean which defines if the reference frame for estimating the pose is regarding ADF or Start of Service. Et voilaa... Nothing more to do.
This is so simple and dumb but really not obvious to find out as this boolean is disabled by default, and in the SDK's ADF example it is checked in the Unity editor (so you won't find out by looking at the scripts).
Upvotes: 0