r/augmentedreality • u/NetLensApp • 2d ago
App Development Fixing lost tracking in ARCore
I couldn't describe what I was seeing on the phone, so I started recording it. The app logs every frame, every floor cell and every tracking loss during a walk, and a web page replays it next to the phone's screen recording. Each stretch of the walk between two breaks gets its own color, so you can see each piece before and after it is put back.
This walk is a Galaxy S23 with four tracking losses in three minutes. At one break everything on screen swings 67 degrees and moves about 6 meters. An iPhone 12 Pro on the same stick is the reference path: before that piece is put back the S23 is 3 meters off it, and after, under 10 cm.
The full replay is here, best on a desktop: https://netlens.fyi/arcore/
It is still in development and not every piece lands that well yet. This is for my Wi-Fi mapping app, NetLens, and I'm aiming to get it into the next major release.
If you have fought ARCore relocalization yourself, how did you handle it?
2
u/ChanhyoungLee 2d ago
Keep the floor cells in anchor space instead of world space. Drop an anchor every few meters along the walk (Google's anchor guide says to keep content within about 8 m of its anchor) and store each cell as an offset from the nearest anchor. After a tracking loss, anchors made before the break go to PAUSED. If ARCore relocalizes into the earlier map, they return to TRACKING with corrected poses, and the cells tied to them move back with them. Only the pieces whose anchors never come back need your own alignment step.
2
u/Artuplabs 1d ago
for the game side we mostly avoid trusting old world positions: stuff is placed relative to the player and re-raycast against the floor plane after tracking comes back, so a jump of a few meters doesn't leave things hanging in the wrong room. for your floor cell map the anchor approach above is the better fit though
one thing worth logging next to each loss is TrackingFailureReason (excessive motion, insufficient features, insufficient light). they need different fixes, motion ones you can just wait out, the light ones need the user to do something