02-29-2024 01:09 PM
I'm not sure exactly what update caused this, but it's within the last few months. The spatial anchors for my project stop getting valid poses when our Quest 3s either sleeps on their own or the power button is pressed. On wakeup, the positions and orientations don't line up where expected (it's as if we had a recenter event) and the XrSpaceLocationFlags bits are all false
For example:
XrSpaceLocation persistedAnchorLoc = {XR_TYPE_SPACE_LOCATION};
XrResult res = xrLocateSpace(anchor.space,
m_space, predictedDisplayTime,
&persistedAnchorLoc);
if (res == XR_SUCCESS) {
XrSpaceLocationFlags flags = persistedAnchorLoc.locationFlags;
bool valid = (flags & XR_SPACE_LOCATION_ORIENTATION_VALID_BIT) != 0
&& (flags & XR_SPACE_LOCATION_POSITION_VALID_BIT) != 0;
bool tracked = (flags & XR_SPACE_LOCATION_ORIENTATION_TRACKED_BIT) != 0
&& (flags & XR_SPACE_LOCATION_POSITION_TRACKED_BIT) != 0;
bool anchorIsValid = valid && tracked; // These are both always false upon wakeup
// persistedAnchorLoc.pose also appears to be incorrect
// ...
}
I have found, however, if I add a new anchor after wakeup the old anchors start getting valid poses again. It's definitely a timing issue though too. I can't immediately generate a new anchor (the frame during the wakeup) so I end up with a really ugly hack that waits some time before generating a temporary anchor to fix the current anchors.
I have tried the official samples and I found the same behavior. I could add anchors in the XrSpatialAnchor sample, sleep the headset, wakeup and find they are all missing. When I add a new anchor, all the previous anchors appear again.
I'm not sure if it's relevant or not, but I do have Developer -> Boundary disabled. This is a requirement for our application since the guardian area can't grow large enough. This is all used in-house, so it's not a problem for our users.
03-05-2024 10:34 PM
Hello Michael -
Thanks for flagging that issue where applications left running between sessions end up with stale anchor positions. We've seen this happen in v62, where the anchor poses get fixed only when another API call is made to reconnect to Tracking.
We've already taken steps to mitigate this issue in v63. We recommend updating to v63 when it is publicly available. Thanks for your patience!