MicrosoftDocs / mixed-reality

Mixed Reality documentation
Creative Commons Attribution 4.0 International
175 stars 186 forks source link

Anchor transform not updating with located spatial anchors #487

Open pablomz97 opened 2 years ago

pablomz97 commented 2 years ago

Hi, I am trying to create a collaborative app between two Hololens 2 devices. After following the tutorial, the anchors are correctly stored in Azure Cloud and correctly retrieved, but when the Spatial Anchor is obtained from Azure, it indicates that the anchor has been correctly located, but no changes are made to the transform of the Anchor that should be updated.

I found a similar thread here but Unity's WorldAnchors (which is the solution provided) are deprecated.

I have tried to use CloudNativeAnchor.CloudToNative() as its used in the DemoScriptBase example but to no avail. Any help is appreciated!


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

arvinkx commented 2 years ago

@pablomz97 I'm experiencing the same issue - were you able to find a solution to this? No matter what - when I run with two Hololens 2 devices, the anchor is not updated to the correct position.

pablomz97 commented 2 years ago

@arvinkx I did not manage to make it work without external tools. I would recommend having a look at World Locking Tools (WLT) which you can use with Azure Spatial Anchors as well (link) or depending on your use case a simple Image Target from Vuforia could get the job done (at least for mine it did).

arvinkx commented 2 years ago

@pablomz97 Thanks, I'll try out WLT in the meantime. @yl-msft Would you be able to provide any kind of update on this or pull in someone who may know more about what's going on with the ASA multi-user sample?

ThibaultPotier commented 2 years ago

Hi, I'm having the exact same issue. I'm testing this with two Hololens 2. I followed every instructions very carefully, several times. The Debug.Logs messages seems happy, but position is never changed despite what logs says. image

Following the debug.Logs I fell on this line in the AnchorModulScript.cs :
image

the line 390 is commented, which could explain maybe why nothing happens after the successfull message saying "Local anchor position successfully set to Azure anchor position"

But uncommenting this line throw errors about UnityEngine.XR.WSA.WorldAnchor that I'm unable to solve.

Is there anyone who successfully made this tutorial works at any time ? I spent the last week trying to setup a multi-user demo with Hololens 2 and I don't want to end up putting a big QR code on the floor :|

yl-msft commented 2 years ago

Since you called my name, i'm reaching out to the Azure spatial anchor team to find experts on this. I'm not familiar with this tutorial, but want to ask if you have tried the Azure Spatial anchor sample on GitHub at following link and see if this sample works for you. Maybe borrow the sample code here: https://github.com/microsoft/OpenXR-Unity-MixedReality-Samples/tree/main/AzureSpatialAnchorsSample

pablomz97 commented 2 years ago

@ThibaultPotier as I mentioned previously if you do not want to rely on a QR code check World Locking Tools, their sample scene with ASA works and syncs up between devices but its a bit laggy when I tried it myself, maybe mess with a smaller implementation based of WLT_min example.

As for this sample itself I tried multiple times as well and while it seemed to pull the anchor correctly the space never got updated.

Sorry I can't help any more but definetely would recommend a look into WLT since it seemed to work for me (at least the sample since I opted for a QR code in the end).

arvinkx commented 2 years ago

@yl-msft I did get that sample running but specifically I am looking at this due to its multiuser capabilities, which correct me if I'm wrong, the sample you linked doesn't cover. I also tried WLT with ASA (which is great for a stable coordinate system) but again I don't think multiuser experiences are covered in the WLT samples. As far as I've seen I think this is the only multiuser tutorial that exists (other than spectator view which seems to be deprecated).

fast-slow-still commented 2 years ago

@arvinkx , what is the multiuser aspect you're not seeing in the WLT ASA sample? While it could be used to persist a coordinate space on a single device, the intended scenario was more:

  1. A "curator" user establishes the registration points (ASA locations) and publishes them to the cloud.
  2. All other app instances download those registration points, and now all users' coordinate spaces are collocated in physical space.
arvinkx commented 2 years ago

@fast-slow-still What you described is exactly what I experienced with multiple users with WLT with ASA but this "multiuser" sample uses PUN and is "real-time" collaboration. Specifically, I'm looking to be able to track movements of objects and users in real-time as a replacement for the spectator view so we can capture video from one of the two HL2s. I can achieve that with this sample but the problem is no matter what, the users coordinate spaces are off by a certain amount after finding an anchor from ASA.

Varnauld commented 2 years ago

Tagging @pamistel for further support here, thank you

arvinkx commented 2 years ago

@pamistel @Varnauld Any chance there are any updates on this?

Varnauld commented 2 years ago

@arvinkx not yet sorry, but our team is looking into this (+@Sean-Kerawala who is reviewing this too)

MehranAzimi-msft commented 2 years ago

@arvinkx please see this related post which I believe has a workaround for the issue you posted.

Note the tutorial page you are using is the MRTK tutorial for adding ASA to an app. ASA SDK does not require using MRTK. Please have a look at our Unity tutorial here that disucsses creating ASA powered apps without MRTK. ASA SDK samples are posted here which include a Unity sample app that shows basic use cases of ASA such as crating/locating anchors by anchor IDs (i.e. using AnchorLocateCriteria.Identifier, see here for more details), or by near device criteria (see here and here) which will rely on GPS or Wifi signature to filter to anchors close to your device, and then visually searches for those anchors to find the pose.