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

QR code to determine the spatial coordinates for the experience #261

Open bwHoloLens2 opened 2 years ago

bwHoloLens2 commented 2 years ago

Im working on a project where i'd like to be able to set the origin and coordinates of my virtual experience using the physical position of a QR code, and then place all of my Holograms in a way that they are related to that origin. any insight on how i might achieve this using WLT and Anchors ?

fast-slow-still commented 2 years ago

Have you looked at the QR code sample in WLT? Note that there is no manual use of anchors. (WLT uses anchors internally to create the world-locked global unity space, so the application doesn't need to mess with anchors.)

https://microsoft.github.io/MixedReality-WorldLockingTools-Samples/Advanced/QRSpacePins/QRSpacePins.html

bwHoloLens2 commented 2 years ago

Thank you for redirecting me to the QRSpacePins project as it is indeed what i require for the work im attempting to accomplish. I would like, if it's possible, to get some pointers on how to go on about using the sample or how it works internally; i gather that i should create/print a QR code using a generator online and label it using the QRCode_N format ? Am i supposed to edit the position on the Transform of the virtual QR codes on Unity to match the ones of my QR Codes in the real world ? if so, any insight on how to make it automatically stick on the physical QR code? Also, how do i go on about anchoring(persisting their position if i shall say) my manually placed holograms inside such an experience while on my HoloLens? I am working on Unity 2020.3.24 with HoloLens 2.

bwHoloLens2 commented 2 years ago

What i am trying to accomplish would be similar to what you showed on your video; Starting my experience by scanning the first QR code that would represent the origin of my coordinates. Then, i would manually place my holograms while using the app on my HoloLens in a way that they would persist during sessions. I would also make use of the other QR codes to adjust the position of some other holograms as im planning on using this inside a big factory. The virtual QR codes would be of great use to me as i'd like to keep track of their distance (Positions, Rotations) from the first QR code. Does the QRSpacepins sample allow such possibilities from scratch ? I might be getting ahead of myself but once i'll get a hang of how the sample works internally, i will explore techniques on how to export the positions of each hologram to store in a database for other Hololens to use.

fast-slow-still commented 2 years ago

I strongly recommend that you start by reading (at least) the following two articles:

The basic idea behind World Locking Tools. The idea behind SpacePins.

The first important mental shift to make is that, instead of anchoring individual objects like with spatial anchors, WLT stabilizes the entire global coordinate space with respect to the physical environment, and persists that alignment across sessions.

For example, when using spatial anchors directly (No WLT), you might place one QR code in your physical environment for each hologram you want to place.

When using WLT, instead you place enough QR codes to anchor the coordinate space. Anywhere you place a hologram, it will remain world-locked, because the entire space is world locked.

If you have WLT's persistence enabled (AutoSave & AutoLoad), then to have a hologram show up in the same physical place next session, you just give it the same pose as last session.

The discussion in this issue might help clarify.

As far as setting up and running the QRSpacePins sample, yes, you create and print QR codes and place them in your physical environment. Then modify the poses of the QR codes in the sample scene to match where you put them in your physical space.