Code Monkey home page Code Monkey logo

mixedreality-worldlockingtools-samples's Introduction

WLT Samples

The World Locking Tools - Samples (WLT-S) repository hopes to give you isolated independent examples, or even starting points, for anything you might do with the World Locking Tools for Unity.

Useful links

This documentation on github.io

World Locking Tools Samples github repo.

Getting started with Samples.

World Locking Tools for Unity (WLT) github repo.

World Locking Tools for Unity (WLT) documentation landing page.

Prerequisites

The basics of building and deploying a HoloLens application from Unity are assumed. If you aren't familiar with that, here's a good place to start. Or if you want to go straight to HoloLens2, then here.

For the Advanced samples, obviously familiarity with the basic World Locking Tools for Unity is assumed. Start here.

The Tutorials are most useful as auxiliary information for the documentation. Start with the documentation, and jump to the Tutorials when the documentation directs you there for illustration.

Contributing in plain language

Some simple talk about contributing to this project.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct.

Resources:

mixedreality-worldlockingtools-samples's People

Contributors

fast-slow-still avatar microsoft-github-operations[bot] avatar microsoftopensource avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mixedreality-worldlockingtools-samples's Issues

Handle status=AlreadyTracked

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

Something wrong on loading after moving space pin

Not sure what the problem is, but here's the repro:

  1. Load the sample (either one), move both space pins, and publish
  2. Load new instance of app
  3. Move both space pins (but DON'T publish)
  4. Hit Load from Oracle (or Search)

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.

QRcodes not detected

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.

Compile errors

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?

QR Code assignment improvement

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.
image

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
    }

Getting the froze pose instead of the spongy one

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.

QR codes don't scan on first run

Repro steps:

  1. Uninstall the QRSpacePin app (if it is installed).

  2. Build, deploy, and run the QRSpacePin app.

  3. Note that the Enumeration complete event never appears on the SimpleConsole.

  4. Note that no QR codes are recognized.

  5. 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.

Republish does nothing

Not sure this is even a bug, but it surprised me. Worth thinking through.

Repro:

  1. Setup pins and publish
  2. Relaunch new instance of application
  3. Load from Oracle (or Search)
  4. Purge (or Clear from Oracle)
  5. Note that pins are still pinned
  6. Hit Publish

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.

Suggestion: add warning when ASA service is not connected or offline

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.

QRCodeSpacePins are not persistent with recent WLT versions

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.

Steps to reproduce

Preparation

  • Clone https://github.com/microsoft/MixedReality-WorldLockingTools-Samples.git
  • Load Advanced/QRSpacePins with UnityEditor (2019.4.22f1)
  • Load Scene Scenes/QRSpacePins
  • Remove all markers except QRCode_1 and QRCode_2 from HouseHold/BarnMarkers/Markers
  • Reset transform of QRCode_1 and QRCode_2
  • Set position of QRCode_1 to {x: -0.0625, y:0, z: 0.2025} and QRCode_2 to {x: -0.0625, y: 0, z: 0.0625}
  • Adjust Size of QRSpacePinGroup of MarkerPinsRoot/Barn_MarkerPins
  • Enable AutoLoad and AutoSave in WorldLocking/WorldLockingManager

This works

  • Build, deploy and run project (on HL2)
  • accept all the permission dialogs and restart the program
  • look at printout of wlt_markers.pdf
  • markers should be detected and scene should be adjusted
  • restart program
  • scene transformation should be loaded (AnchorGraphVisual '1' hovering above printout)

This does not

  • Download WLT 1.32 CoreEngine and Tools
  • Drag packages to UnityEditor and import them
  • Update NuGet packages FrozenWorld to 1.1.0, VCRTForwarders to 140.1.0.7 and QR to 0.5.2112
  • delete previous build folder
  • Build, deploy and run project (on HL2)
  • accept all the permission dialogs and restart the program
  • look at printout of wlt_markers.pdf
  • markers should be detected and scene should be adjusted
  • restart program

What I expected

  • scene transformation should be loaded (AnchorGraphVisual '1' hovering above printout)

What happened instead

  • AnchorGraphVisual '1' hovers close to (but not exactly at the same position as) 'SpongySpace' root.

Qrcode Scans - BIM

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 ?

Screenshot_1

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.

Samples fail to compile and run on device

In attempting to clone and setup the samples to run on device, the current samples repo has several issues:

  • None of the samples have been updated to use the new Mixed Reality Feature tool method of deployment using UPM
  • Attempting to update the samples to the latest version of the MRTK fails
  • Attempting to update the samples to the latest version of the WLT fails

In short, the samples need a serious update and upgrade to the latest versions / patterns.

Error on Rotation and Translate.

Hello,

Question 1

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.

3

1

2

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 ?

Question 2

If QRcode axes is like image below hologram spawns correctly.

4

If QRcode axes is like image below hologram spawns on the opposite side even if axes of all objects have the same orientation.

5

The orientation that i pin the qr code on the wall (real world) is the same as image

QRCode_01

Thanks in advance.

Read multiple cloud anchor ids with single call

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)

Move a QRCode/SpacePin in the physical world without altering the virtual world

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.

  1. I scan QR code A (that is the origin, known in the database). Then I scan QR codes B and C and dynamically add them to my database. Then I place holograms in the world. Everything works fine.
  2. Let's say I want to move QR Code C in the physical world (for X reasons) WITHOUT moving the virtual world.
    I delete the space pin related to QR code C.

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).

  1. I move the QR code C in the physical world (without scanning it) e.g a few centimeters.
  2. I try to scan it (and dynamically add it) again.

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 ?

How to Load the Samples Into Unity

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.

Start and stop ASA

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.

Load fails after Reset

Repro:

  1. Load from Oracle (or Search)
  2. Reset pins (note Reset doesn't affect cloud anchors, only local pins)
  3. Load from Oracle again

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.

No sample for WLT without depending on the MRTK

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:

  • Using the WLT for a digital twin scenario
  • Having a lifesize virtual model of a space
  • Aligning and anchoring that virtual model to the physical space

SpacePin Sample with Unity 2020.3.13f1

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.
grafik

So, fits the stackoverflow solution for this too or do I need a different solution?

ASA Option to run task when ready/available?

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).

How to disable 3D Model from spawing when app starts.

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

WLT + ASA sample running on Android

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.