Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Currently active Space and WorldAnchor store

I have started to experiment with persisting WorldAnchors.

I use my devices in a number of distinctly different locations on a regular basis, each being a different "Space" on the a device's Spaces list.

When I run my app with my experimental WorldAnchor persistence code at one location and then the other location and ultimately back at the first location, I have noticed that the WorldAnchor store does not seem to automagically map the store to the currently active Space. So I am guessing that I need to make unique id strings for each world anchor for each space, which will be easy to do if there is a way to make an api call to get the name or id of the currently active Space that the lens has resolved.

The apps in the shell seem to be Space aware. Does anyone know of an api call to get the currently active space? Is there some other way to make our world anchors space aware similar to the app placement in the shell?

Windows Holographic User Group Redmond

WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
WinHUGR YouTube Channel -- live streamed meetings

Answers

  • @Patrick this sounds like one you might know the answer to?

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Just in case it wasn't clear, here is a picture of the Spaces list I was referring to taken from a new instance of the emulator (therefore it has just the one space listed):

    On my actual Hololens devices there are several listed on that page for the regular locations where I use the device.

    When I use the device at a different location, once the device scans the location and figures out where it is, the shell seems to use the recognized stored location id information to display only those windows that were previously opened at that location.

    Can we access that same recognized location id information?
    Is there an event that we can listen to that fires when new Space recognized or an API that can query current Space id or something along those lines?

    WorldAnchors seem to be relevant and related to a particular Space, but I have yet to find the way to make the correlation and set or read the relationship.

    @neerajwadhwa ? is there any insight that you can provide here? You and @Patrick appear to be the goto guys on most things related to spatial mapping and anchors.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Hey sheep,

    I don't know the answer, but I'll see what I can figure out.

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

  • I think you want something like this:

    #if WINDOWS_UWP
            IReadOnlyList<ConnectionProfile> cps = Windows.Networking.Connectivity.NetworkInformation.GetConnectionProfiles();
            if (cps == null)
            {
                Debug.Log("no cps");
            }
            else
            {
                foreach (ConnectionProfile cp in cps)
                {
                    if (cp.WlanConnectionProfileDetails != null)
                    {
                        // Presumably you'll only get hit line once, and you can prepend the SSID to the persisted anchor name or something like that...
                        Debug.Log(cp.WlanConnectionProfileDetails.GetConnectedSsid());
                    }
                }
            }
    #endif
    

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

  • Interesting @Patrick, so that would imply that individual Space profiles require a wireless connection for association, and when the HoloLens is not connected to wifi you would get a different space profile than the one you would get when you are connected in the same physical location.

    It might also mean that when not connected to wifi that multiple physical locations might all get lumped together in one big messy space profile if there is no other way to differentiate distinct locations.

    I will need to do some experimentation and report back.

    Thanks for the direction to explore. I hadn't thought about that one.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • There is a problem with this approach: the device will sometimes make a second space for the same Wi-Fi SSID. I don't think that there is an API to get some sort of unique 'space id', but I think there should be one. Until then querying the SSID will usually work.

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

  • @HoloSheep and @Patrick

    I too am interested in understanding how spaces and WorldAnchors are managed. I have used my phone as a wifi hotspot in different locations with my HoloLens and it does have different spaces for a given wifi name.

    The functionality I want to achieve is accessing a world anchor via a hash table and then if it exists for the space, using it to again place items exactly as in prior sessions, independent of where the HoloLens is located when the app starts up. I then also want to keep that saved world anchor name in files that I store on the hololens with the data that I am showing.

    This has to be a common use case. It is persistence of location and data based on the space you are in, and is handled for the holoshell, which puts windows in the same place for a space each time.

    I am digging into the new SpatialUnderstanding module for HoloToolkit, to see what is possible for that, but my initial impression is that this is focused on input - find me types of areas like volumes on ceiling, instead of persistence.

    Another place I am looking is in the Sharing module which is focused on sharing a scene between HoloLens, something like Room.cs. There does not seem to be many examples of persisting anchors independent of the overhead of networked sharing.

  • PatrickPatrick mod
    edited August 2016

    Here's the latest guidance for this scenario from the platform team. There is no api that will provide a unique ID for a 'space'.

    1. If possible, design your application to be location agnostic.
      a. Let objects load as their corresponding anchors are found.
    2. To make the location detection transparent to the user consider this approach
      a. Try to load a set of 'primary' anchors.
      b. if a 'primary' anchor is found, proceed to load any other anchors that the app previously loaded for the location.
      c. If none of the 'primary' anchors are found, create a new 'primary' anchor and treat the location as a new location.
      d. Design the app with the possibility that a previous unfound 'primary' anchor might be found. You may need to handle merging objects.
    3. Otherwise, consider if you can let the user inform the application which location it is in.
      a. Fragments and Conker take a similar approach, and the shell will even fall back to this.

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

  • @Patrick you know I very much appreciate all the great info you provide.
    That said, the "latest guidance" post is as clear as mud. :-)
    For me it raises far more questions than it answers.

    Windows Holographic User Group Redmond

    WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
    WinHUGR YouTube Channel -- live streamed meetings

  • Well, let's think through the scenario then.

    In the OP, it sounds like you have a couple of spaces you run your application in.

    You could save an anchor for both spaces. The one that gets located informs you which space you are in.

    The design of the app would try to locate an existing anchor (maybe the name of the anchor could inform if it is one of the 'primary' or location identifying anchors), and, after some time if one of the existing anchors cannot be found, the app creates a new anchor, and behaves like it is in a new space. Otherwise it behaves like it is in the space for the first anchor that gets found.

    I think this solves your problem. Not in the satisfying 'I have a unique id for my space' way, but the scenario should still be achievable.

    ===
    This post provided as-is with no warranties and confers no rights. Using information provided is done at own risk.

    (Daddy, what does 'now formatting drive C:' mean?)

  • In case anyone is interested in WorldAnchors, they should take a look at the HoloToolKit code on github:

Sign In or Register to comment.