microsoft / MixedReality-WorldLockingTools-Unity

Unity tools to provide a stable coordinate system anchored to the physical world.
https://microsoft.github.io/MixedReality-WorldLockingTools-Unity/README.html
MIT License
188 stars 45 forks source link

Hololens 2 Sleep Removes Anchor Subsystem in App #290

Open NicholasCDAS opened 2 years ago

NicholasCDAS commented 2 years ago

Hello!

I've been working on an app that is using the WLT tools with OpenXR to create a global coordinate system for everything to follow. The problem I am having is that it works great. On shutdown, restart, install, closing and reopening the app works flawlessly, but then we get to sleep...I am also using space pins oriented on QR codes.

If I close the app then let my hololens sleep then try to reopen the app it infinitely throws the error: ErrorMessageOnHololens2

Relevant info within the log file: image

Important excerpts from the log file to show that it was working but then it doesn't: excerpt1.txt

excerpt2.txt

The full log is here but it is quite large: UnityPlayer_Hazmat.log.txt

fast-slow-still commented 2 years ago

Excellent detail, thank you very much!

I will try to check with the OpenXR team to see if they have a recommended workaround/workflow for that.

Meanwhile, I will see if I can repro the issue myself. If not, I might ask back here for additional details.

I am curious whether the same problem shows up when using the Windows MR Plugin, rather than the MR OpenXR Plugin? If it's convenient, you might try that. If it isn't convenient, no worries, I will definitely be trying that after I've got a solid set of repro steps.

If it is a known MR OpenXR Plugin issue that is currently being fixed, I will see about a WLT workaround for the interim.

I will update the thread in this issue as I learn anything related.

One question, it appears from the log that you are using the MR OpenXR Plugin version 1.3.1. Can you confirm or correct that?

Thanks again for the detailed information!

fast-slow-still commented 2 years ago

I have repro'd the issue using both MR OpenXR Plugin v1.3.1 and v1.4.0.

Further, I've established that the issue does NOT occur using the Windows XR Plugin v4.6.1. I also haven't seen this problem with mobile devices.

So it sounds like a bug in MR OpenXR. I am trying to get a policy statement on the subject from the MR OpenXR team, and will proceed from there.

NicholasCDAS commented 2 years ago

Thanks for the timely replies! Yes, I am using version 1.3.1

Not really convenient switching to Windows MR haha.

Thank you so much!

fast-slow-still commented 2 years ago

It appears this has been fixed and will be included in an upcoming OpenXR plugin release.

No code changes will be required to get the fix, just installing the latest plugin.

I'll post back the specifics of what plugin and version when I've verified the fix. Leaving this issue open until then.

FreakTheMighty commented 2 years ago

@fast-slow-still I'm noticing that after putting the HL to sleep, waking it, and quickly relaunching our app, our scene has shifted. This happens with and without "auto save/load" enabled. I have not see the exceptions reported by @NicholasCDAS , so I'm not entirely sure its the same issue.

Any idea when this release might land to test with?

fast-slow-still commented 2 years ago

@FreakTheMighty , I agree, this sounds like a different issue. Could you open a separate issue on this?

Please include enough info to reproduce the problem you are seeing. I can't tell from your brief description exactly what the problem is, much less how to create a repro.

Any idea when this release might land to test with?

The current state of the master branch in the WLT repo is essentially the next release (1.5.9). It's currently in packaging and test, and if no significant bugs are found, will be released in the next couple of days. But you are welcome to try it now.

The fix for the issue NicholasSDAS reported is in an update from Unity (not WLT). I have been told the update will be released this week or next, but I don't really have inside visibility on that process. I can only keep an eye out for it, test the fix when it appears, and report here then.

FreakTheMighty commented 2 years ago

@fast-slow-still I'm starting work on reproducing the issue using your sample QR code application. I feel there is still a chance the underlying issue is that OpenXR doesn't handle the device going to sleep properly. In the device logs I can see OpenXR start up again after the device awakes. However, WLT's debug UIs (anchors & pins) no longer update.

It makes me wonder if OpenXR has completed a full restart, forgetting whatever anchor that were in memory, while Unity GameObjects have managed to persist.


Anywho, I know this isn't much to go on so I'll do my best to distill this down to something you can actually look at.

fast-slow-still commented 2 years ago

In the device logs I can see OpenXR start up again after the device awakes. However, WLT's debug UIs (anchors & pins) no longer update.

That sounds like it could be the issue fixed in the upcoming Unity OpenXR Plugin release. It is not available yet, but should be out any day now. When it is released, I will verify it still fixes the problem (I tested a preview version), and post back to this thread.

Till then, probably best not to put in too much work on an issue that may already be resolved.

FreakTheMighty commented 2 years ago

Cool, thanks for that, I will put this on the back burner for now. FWIW, I did update Unity to 2020.3.34f1 yesterday and found that the application crashed after being woke from sleep 😓 . Since upgrading Unity to 2020 (+MRTK2.7, OpenXR) we've faced a number of sleep related bugs.

derekfreed commented 1 year ago

Having the same issue as OP, except the problem shows when re-opening an app window image

Upon opening the app, the content is in a different location and visuals are very glitchy looking

derekfreed commented 1 year ago

Here's the versions I was using, along with Unity 2020.3.20f1 image

I tried upgrading to version 1.5.1 for Mixed Reality OpenXR plug-in using the latest MRTK Feature Tool and the OpenXR Plugin to version 1.4.2. It looks like this upgrade fixed the problem for me! image

edgar-rodrigo-santos commented 1 year ago

We are having a similar issue. The error and stack-trace are exactly the same, except that the app actually crashed afterwards. Is there still a known issue here or should we try to pursue how to reproduce the problem? Here are the versions we're using with Unity 2021.3.9f1: image Thank you