-
Notifications
You must be signed in to change notification settings - Fork 237
Area Learning Example: Loop Closure correction not working #104
Description
Final result: the red markers should be "leading up" to the blue one.
It seems that the loop closure correction on ARMarkers in the AreaLearning example (this code) is not working. I have created a test to make this visible, and even tho a loop closure event occurs, the markers are not moved to the "correct" positions on save.
The way I test this is the following:
- I create a new area, and scan a little in a specific location, to make it possible to relocalize later.
- I exit the area and load it again, with area learning disabled.
- I place the blue marker in the place that is scanned in the ADF (this is where the loop closure correction will happen, where Tango will realize that is has travelled in a loop, and is supposed to update the path it's taken to reflect that. So when querying with GetPoseAtTimestamp later, one should get the the pose from the new, updated trajectory).
- I walk away about ten meters, and spin around slowly to accumulate noticeable drift.
- I walk back to the place I placed the blue marker, and on my way, continually place red markers. At first, the blue marker is not in the place I placed it (because of the built-up drift, the marker is several meters away).
- When tango sees the starting area where the blue marker was placed, a loop closure event seems to happen, because the blue marker teleports back to its proper location, and the red markers I just recently placed instead become offset by the same distance that the blue marker was offset before, in the opposite direction. What's actually happening of course is that the markers' positions are not changed, but the tango camera changes its position drastically, because it realizes it is in the starting position again. Up until now, everything has worked as expected. The red markers became offset because when they were being placed, the camera thought it was a few meters away, and so that's the position they got.
- I save the scene. Here, I expect the code I linked to from AreaLearningInGameController.cs to go through the markers' positions and update them based on the "updated trajectory" that Tango computes upon a loop closure event, according to the docs about poses as I understand them. So since they were placed at the same "real" position, the red markers should end up saved very close to the blue marker (they should form a trail leading up to it, that's how they were placed).
- Instead, when I load the scene again, the red markers remain at the same offset positions as before saving.
So it seems that for some reason, the loop closure correction is not working. However, the code does seem to be doing the right thing (it is correctly asking for poses for the areaLearning/Device frame pair, instead of the startOfSetvice/Device frame pair. If it was asking for the second one, it would indeed not get the updated trajectory, according to the docs on frames of reference. But now, it is doing the right thing (I think), so what might be causing this behaviour? Is this an error in the sample, or something wrong with the Unity SDK itself? Or am I simply misunderstanding what loop closure correction is really supposed to be doing?
Any indication on what might be the cause of this problem is greatly appreciated, as I'm trying to implement loop closure correction on my own project, and using this code as an example. For example is it possible that the tango poses are actually not being updated, even tho a loop closure event happens?
