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

"...Library not initialized" #302

Open Jversen opened 2 years ago

Jversen commented 2 years ago

I've just started implementing WLT (1.5.9) in my project and managed to successfully save and retrieve object poses on fixed locations in the room, regardless of where I started the HoloLens.

However, today when I tried it out in a new physical location, it didn't seem to remember the room between runs, and I got the error EngineException: Error in call to FrozenWorld.Engine: "FrozenWorld_ClearAnchors: (failed s_state) Library not initialized"

Now, when I go back to my original room which worked before, I get the same error. I've tried restarting Windows, Hololens and removing and reinstalling WLT core, but it's still broken.

It seems that when I restart windows and open the project again, I am able to get the correct anchors for the room, but no fragments, and the error: vEngineException: Error in call to FrozenWorld.Engine: "hkAnchorGraphFracture::detect: (failed associationSlot < (sizeof(Bits) * 8)) [internal error 0x6DAC5CE2 in Base\hkAnchorGraphFracture.cpp line 150]" Then, when I restart the project, I get the first error message indefinitely again.

Setup HoloLens 2 Unity 2020.3.27f MRTK Foundation 2.8.2 WLT core 1.5.9 Windows Mixed Reality XR plugin Using Windows Mixed Reality Holographic Remoting

Addition After clearing all spatial/holographic data and multiple restarts of the Unity editor it seemed to resolve itself. ... And Now it's back again...

I was under the impression that when visiting a new location disjoint from a previous mapped location, a new anchor system would be setup for that new fragment? (https://docs.microsoft.com/en-us/mixed-reality/world-locking-tools/documentation/howtos/usingwlt/persistencetricks#a-walkthrough) What seems to be happening is that the unrecognized location appears to cause confusion when WLT tries to fit the anchors from the old fragment into the new one. The current fragment id is shown as "1" no matter the room, which I guess is the root of the problem. The only solution I've found is to reset all spatial data from the Hololens and restart. But this means that I am never able to run my project in more than one different physical location without resetting all mapping before hand, which makes me unable to make meaningful use of any persistence.

fieldsJacksonG commented 1 year ago

The "Library not Initialized" error means that FrozenWorld_Init was not called.

Check that your remoting session has created a new plugin in the WorldLockingManager here: https://github.com/microsoft/MixedReality-WorldLockingTools-Unity/blob/204e507df8e7a1b6e53a4f95cfa3710655ec5945/Assets/WorldLocking.Core/Scripts/WorldLockingManager.cs#L786

And that you have successfully disposed of the previous references here when a remoting session ends: https://github.com/microsoft/MixedReality-WorldLockingTools-Unity/blob/ad94e0cd48fe70431439e71b16d5c4f02d16db4d/Assets/WorldLocking.Engine/Plugin.cs#L72