microsoft / mixedreality-worldlockingtools-samples Goto Github PK
View Code? Open in Web Editor NEWBroader learning resources supporting World Locking Tools for Unity
License: Other
Broader learning resources supporting World Locking Tools for Unity
License: Other
At the moment, the QR-Code Assessment does not work in a very intuitive way. Assignment in the way shown in the screenshot does not work because the index extracted from scanned code has to match the index where the matching code is stored in the VirtualMarkers List.
I adapted the code in QRSpacePinGroup.cs's ExtractIndex - method so that it looks for the name of the qrcode, which has to fit with its data-string (slight downgrade). This enables more intuitive design, such as naming the codes accordingly to their location e.g.
private int ExtractIndex(QRCode qrCode)
{
/*Original Code Start
//string code = qrCode.Data;
//string[] tokens = code.Split(new string[] { "_" }, System.StringSplitOptions.None);
//int qrIndex = GetQRCodeIndex(tokens);
//if (!QRCodeIndexValid(qrIndex))
//{
// Debug.LogError($"Failed to parse id out of code {code}");
// return -1;
//}
//return qrIndex;
Original Code End*/
//Custom Code Start
int qrIndex = -1;
for (int i = 0; i < VirtualMarkers.Count; i++)
{
if(VirtualMarkers[i].name == qrCode.Data)
{
qrIndex = i;
return qrIndex;
}
}
return qrIndex;
//Custom Code End
}
The QR Sample currently uses legacy WSA constructs to transform coordinates. These aren't available under Unity's new Plugin Management pattern, and therefore not available at all under Unity 2020+.
Here's a link for using HoloLens QR with OpenXR to get started with.
Repro steps:
Uninstall the QRSpacePin app (if it is installed).
Build, deploy, and run the QRSpacePin app.
Note that the Enumeration complete event never appears on the SimpleConsole.
Note that no QR codes are recognized.
Close app and run a second time. Everything works now, and from then on.
Expected:
The QR codes to scan and work every time, include the 1rst time after install.
I recently updated WLT and realized that SpacePins set with QR-Codes stopped being saved/loaded correctly. Whenever I restart
the program running on my HoloLens2, the scene transformation is more or less reset. I could reproduce this behavior with the sample code as written below. I adjusted the scene slightly to only use two markers which I printed on a sheet of paper.
The scene is saved and restored as expected when using the WLT version included in the sample. However, when I update CoreEngine and Tools (as well as the NuGet package dependencies), the scene is either not stored or loaded correctly.
https://github.com/microsoft/MixedReality-WorldLockingTools-Samples.git
Advanced/QRSpacePins
with UnityEditor (2019.4.22f1)Scenes/QRSpacePins
QRCode_1
and QRCode_2
from HouseHold/BarnMarkers/Markers
QRCode_1
and QRCode_2
QRCode_1
to {x: -0.0625, y:0, z: 0.2025}
and QRCode_2
to {x: -0.0625, y: 0, z: 0.0625}
Size
of QRSpacePinGroup
of MarkerPinsRoot/Barn_MarkerPins
AutoLoad
and AutoSave
in WorldLocking/WorldLockingManager
AnchorGraphVisual
'1' hovering above printout)CoreEngine
and Tools
FrozenWorld
to 1.1.0
, VCRTForwarders
to 140.1.0.7
and QR
to 0.5.2112
AnchorGraphVisual
'1' hovering above printout)AnchorGraphVisual
'1' hovers close to (but not exactly at the same position as) 'SpongySpace' root.I put it here because it took me a few hours to find out why it is not working.
Application did not provide valid credentials and therefore could not authenticate
This error message doesn't mean that you have copied the wrong Account Id or Access Key from your Azure Spatial Anchor page. It also happens when app cannot connect to Azure services for example when InternetClient or InternetNetworkClientServer Capabilities are missing in Projects Publishing Settings.
As this issue is not directly sample related I've moved it here: microsoft/MixedReality-WorldLockingTools-Unity#103
It can be closed. Apologies for the inconvenience!
Should have an API for shutting down the ASA session cleanly and completely, and then an API for starting it up.
Need these to enable a clean state at multiple points during an application's lifetime.
These should be in the IPublisher interface.
Repro:
Get “Read exception: Value cannot be null. Parameter name: gameObject."
Expected: Second Load should have same effect on the Reset pins as the first Load.
The documentation clearly states that the MRTK is optional for using the WLT, however, no example exists that does not depend on the MRTK.
There are also no tutorials for attempting to use the WLT without the MRTK, which makes if very difficult in using this for its intended purpose.
Simple use case:
On downloading a cloud anchor the second time within a session, the anchor's status will be AlreadyTracked (guessing here, it's not explicitly documented). Currently, that means the anchor will be ignored.
Needs more consideration, but it seems like the proper behavior would be something like:
If status==AlreadyTracked
If anchor is in List<AnchorRecords> records
use that AnchorRecord
else
add it as if status==Located
IPublisher API currently only allows the reading of a single cloud anchor id from the cloud.
Would be more convenient and more efficient to have an awaitable Read() API that takes takes a list of cloud anchor ids as input, and returns a dictionary like Find(), something like:
public Task<Dictionary<CloudAnchorId, LocalPegAndProperties>> Read(CloudAnchorId[] cloudAnchorIds)
Currently, trying to run a task when the SpacePinBinder/PubisherASA system is not ready or is busy will simply return, with an indication of failure.
It seems that a lot of applications might rather have the awaitable task wait until it can be processed, run, then return.
One implementation of this might be to make AcquireBusy awaitable. If the publisher has the WaitUntilReady property set to false, then get current behavior: If busy or not ready, immediate return false.
But if WaitUntilReady==true, then add self to waitQueue, spin until turn comes up, then return true.
So only code that changes is inside AcquireBusy (and ReleaseBusy).
Not sure what the problem is, but here's the repro:
Cloud anchors are found and applied, but it looks like the pin positions is the sum of the manipulation plus the cloud anchor.
Expected: When the cloud anchors are loaded into the space pins, they should overwrite any existing state. So should get the same result loading cloud anchors onto manipulated or unmanipulated space pins.
Good morning!
I am facing some issues with QR code scanning. I am currently using Unity 2020.3.25f1 and visual studio 2022. The project deployed fine and i actually have everything set up correctly.
In the simple console as soon as I run the app on my Hololens 2 these messages appear:
-QRcodewatcher.Issupported=True
-Requested caps, access: Allowed
-SetupQRWatcher Success
-Enumerated_
so everything seems exactly the same as in your demo video.
The only thing is QR codes are not recognized and scanned. I tried every kind of QR code version but nothing seem to work.
I also tried different version of Unity editor but again nothing changes.
Do you have any suggestions?
Thanks in advance,
Alessandro.
Shouldn't there also be a reference to Microsoft.MixedReality.OpenXR in following Assembly Definition? :
Assets/QRSpacePin/QRSpacePin.asmdef
Hello,
im newbie in this section and i have some questions.
i would like to ask if i want to use the qrcodes for georeference a BIM model inside a floor how should i setup my qrcodes? What i mean. In this situation i have one model and not 4-5 different models, like the example, and everytime i scan a qrcode the model will change rotation . Even if i scan 1 QRcode the georeference is not correct. I measure all distances with tape and disto and after that i put qrcode on the wall. Any thoughts about that ?
I saw an example here https://www.youtube.com/watch?v=wYb0hf68n6o . Should i scan qrcode A and then qrcode B but how can i make that ? Generally how can i have the best accuracy on georeference ?
Thanks in advance.
I just read about the Ray Pins Example here and it seems like it does exactly what I want to achieve. Could you please share it? I could not find it yet.
Thanks!
In attempting to clone and setup the samples to run on device, the current samples repo has several issues:
In short, the samples need a serious update and upgrade to the latest versions / patterns.
Hello and thanks for this project.
i create a BIM model and i use this project, so i can lock the model to the real world using qr codes. I would like to ask if there is a way to spawn the model only when i first scan the qr code and not when app is starting .
Thanks in advance
Hello!
I am trying to access the frozen pose of the QRcode using
Pose frozen_pose = WorldLockingManager.GetInstance().FrozenFromSpongy;
Unluckily there is no so much on the internet as i could see. Is it the correct way to do it?
I have also tried to use WorldLockingManager.GetInstance().FrozenFromSpongy.Multiply(CurrentspongyPose) but the pose is pretty much the same as the spongy one. Do you have any suggestion? Basically what i am trying to do is to align an holographic cube witha real one and if i am close the allignment is good but as soon a si move around it or far from it the hologram shifts. Is it related to the world locking ?
Thank you in advance!
Alessandro.
I had a lot of trouble (not a Unity regular user) just figuring out how to load the samples. In fact, I had no idea and could not find documentation anywhere in the Microsoft Mixed Reality pages. I also did not find it here. I guess it is assumed the visitor is very knowledgeable of Unity generally. In my case I only use it when I absolutely have to in a project.
I got help, thankfully and you can find it here. I linked rather than copy so the true author is revealed.
My suggestion is that this be added to the Samples Getting Started page.
Hello,
ive tried [QRSubScene] and after i measure all distances from the top left point of QRcode_1 (real world) i put them to unity, but i have problem in rotation and translate. Even if the walls are perpendicular the hologram, after qr code scanning, is not right.
If i want to fix the error on image 2 i have to make a rotation, but i dont know why. It shouldnt spawned correctly and with accuracy ?
If QRcode axes is like image below hologram spawns correctly.
If QRcode axes is like image below hologram spawns on the opposite side even if axes of all objects have the same orientation.
The orientation that i pin the qr code on the wall (real world) is the same as image
Thanks in advance.
Not sure this is even a bug, but it surprised me. Worth thinking through.
Repro:
On the final publish, no pins are found to be published, even though both pins are pinned.
Expected: The pinned pins should be ready to be published, and get published when hitting the Publish button.
I have made a unity project (v2020) and added OpenXR, MRTK foundation and WL core via MRTK toolkit. I then drag and drop the align subscene folder (asset and project settings) into the Project. I open the align subscene scene which under 'demo' folder. I see the scene but I cannot build the project.
Has anyone else experienced this? What is reccomended?
Hello, I'm trying to move a QR code connected to a spacepin.
In my system, I dynamically add/remove spacepins when I scan different QR codes.
SpacePinOrientable spacePin is my spacePin.
spacePin.Reset()
alignSubtree.RemoveOwnedPin(spacePin)
Destroy(spacePin.gameObject)
I wait for two frames before allowing the hololens to scan again QR codes (not sure if it's necessary).
Result : there is a "bug", like if the qr code C was still in the memory and WLT try to adjust the previous virtual world to the new physical world (and it's not matching). My holograms position is now wrong.
To correct it, I need to delete it again (like step 2). If I scan it again, without moving the physical QR code, it works.
Is there a way to totally remove a Space pin from WLT ? or is there another issue, something I'm doing wrong ?
I am trying to use WLT with classes from the SpacePin Example with the Unity version 2020.3.13f1 Personal. The problem is that in the class QRSpatialCoord in line 203 there is following code:
rootCoordinateSystem = System.Runtime.InteropServices.Marshal.GetObjectForIUnknown(
UnityEngine.XR.WSA.WorldManager.GetNativeISpatialCoordinateSystemPtr()
) as SpatialCoordinateSystem;
The build-in XR was removed from Unity (https://stackoverflow.com/questions/66314181/unityengine-xr-wsa-worldmanager-namespace-not-found-where-does-it-reside-now). On Stackoverflow I found this solution:
spatialCoordinateSystem = SpatialLocator.GetDefault().CreateStationaryFrameOfReferenceAtCurrentLocation().CoordinateSystem;
With that Unity can build and Visual Studio is able to deploy it to the Hololens 2 and I am able to start the app. However it works not perfect, it recognizes the QrCodes, but the positioning in the room is just strange. It seems to me that it has a offset, but I have no clue where it comes from.
So, fits the stackoverflow solution for this too or do I need a different solution?
Hi!
I'm currently having issues trying to run the "PinTestSofa" scene (unity) on Android.
I followed all the recommended steps concerning gradle and enabling wi-fi, but I still can't move a pin to a different location.
Whenever I try to move a Space Pin, it always comes back to the starting position.
I reach the "ready" state, however at lauch I get a "Not ready: No ASA manager" notification.
Currently using:
Unity - 2020.3.36f1
MRTK Foundation - 2.7.3
WLT ASA, Core, and Samples - 1.5.0
ASA SDK for Android - 2.10.0
ASA SDK Core - 2.10.0
Any advice on how to proceed?
Thank you!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.