TakahiroMiyaura / WayFindingSamplesUsingASA

this Sample is realize the 'way-finding' demo using Azure Spatial Anchors.
MIT License
11 stars 4 forks source link

Not working on device (Hololense 2 / iOS) #1

Open florolf1 opened 4 years ago

florolf1 commented 4 years ago

Everything works perfectly in the editor. I have tested the app on the Hololense and iOS devices and found that the app does not work properly in WayFinding mode. After the base point is found and the destination is selected, the app searches for the next anchor. As soon as it is found, it will connect to the base point. From here on the search for new anchors does not work anymore.

TakahiroMiyaura commented 4 years ago

Thank you for your feedback!

I'm sorry that I can't tell you how to use this app well. (I’m translating the 'README.md',so I'm not yet push English version.)

After the base point is found and the destination is selected, the app searches for the next anchor. As soon as it is found, it will connect to the base point. From here on the search for new anchors does not work anymore.

This app doesn't show all the anchors related the selected destination at once. Way-Finding mode is the follow operations.

  1. After The base point is found and the destination is selected.
  2. this app search and placement the first point automatically.
  3. If we get close to first visualized anchor,this app search next anchor nearby the anchor.

After The base point is found and the destination is selected, please get close to next visualized anchor. the app search next anchor. If you don't visualize the next anchor, there is possibility that Azure Spatial Anchors is failed to search the anchor. In that situation,the app restart(sorry,this sample isn't implement to retry searching).

Would you please confirm it anyway?

Best regards,

florolf1 commented 4 years ago

Sorry for the delay. Really great work from you.

On both the Hololens and the iPhone, the App only works up to the first waypoint. The base point is always found, and you can also choose different destinations. (if different destinations are defined) As soon as the destination is selected, the next waypoint is found. But from that point on no other waypoint is found.

I took a closer look at your code. I noticed a few things.

Wayfinding: 1) If the first waypoint is too close to the basepoint and you start the app between both points, the OnTriggerEnter method of the waypoint is executed immediately and the app searches for close anchors. This leads to an exception, because two watcher are created at the same time and this is currently not supported by ASA. 2) If the first waypoint is about 3 meters away from the base point, it will be found and visualized after selecting the destination. At this time both, the base point and the first waypoint, are visualized. But both points are not connected to each other (no line connects the two points). Only when you get close to the waypoint, the OnTrigger method is executed and the base point is connected to the first waypoint.

In general.

If I have seen this correctly, when creating the waypoints or the endpoint at each anchor properties are saved. These AppProperties contain the type of point (waypoint or endpoint) and the anchor ID of the previous anchor. This means that when I search for Nearby Anchors, it always searches for the AnchorID of the previous anchor and not for the next Anchor?

To enable universal wayfinding you have to get a direction to the next waypoint as soon as the navigation is started. Is it not possible to save the relative positions to the previous anchor in the AppProperties to give a direction if the anchor is not in range of the camera and therefore can not be found directly when the OnTriggerEnter method is executed?

In the Unity Editor, when the OnTriggerEnter method is executed, the next anchor is searched for. AnchorModelScriptForStub public void FindNearByAnchor(string anchorId) { . . . var data = (int.Parse(anchorId) + 1).ToString(); . . . } Here you search for the next Anchor.

In AnchorModelScript you search for Anchors near to the Anchor in which the method in triggerd. `public void FindNearByAnchor(string anchorId) { // Set the criteria to search for Azure Spatial Anchors. // Assign a NearAnchorCriteria instance to the Criteria to search around the anchor. anchorLocateCriteria.NearAnchor = new NearAnchorCriteria();

            // Set the information of the anchor as the base point.
            anchorLocateCriteria.NearAnchor.SourceAnchor = locatedAnchors[anchorId];

            // Set the search range and the number of simultaneous detections.
            anchorLocateCriteria.NearAnchor.DistanceInMeters = distanceInMeters;
            anchorLocateCriteria.NearAnchor.MaxResultCount = maxResultCount;

            // Set up rules for search. Set AnyStrategy for edge search.
            anchorLocateCriteria.Strategy = LocateStrategy.AnyStrategy;

}`

This means that as soon as a near anchor is found in the callback method AnchorLocated the previous anchor is not considered, because it falls under 2LocateAnchorStatus.AlreadyTracked2 and only the next anchor is considered. However, this is not found.

TakahiroMiyaura commented 4 years ago

Hi florolf1,

Sorry for the delay. Thank you for sharing the details!

Wayfinding:

1.If the first waypoint is too close to the basepoint and you start the app between both points, the OnTriggerEnter method of the waypoint is executed immediately and the app searches for close anchors. This leads to an exception, because two watcher are created at the same time and this is currently not supported by ASA. 2.If the first waypoint is about 3 meters away from the base point, it will be found and visualized after selecting the destination. At this time both, the base point and the first waypoint, are visualized. But both points are not connected to each other (no line connects the two points). Only when you get close to the waypoint, the OnTrigger method is executed and the base point is connected to the first waypoint.

Thank you for telling this to me. There was not enough my idea.

At the time,when I share this sample, I had thought some ideas how realizing way-finding with ASA.

  1. searching the next anchor using OnTriggerEnter. (on this time)

  2. searching the next anchor using AirTap.

  3. setting next anchor Id to AddProperties of the current anchor,seraching the next anchor by the anchor id.

and more...

I had supposed the sample of searching the anchors nearby the current anchor is few, so I implement this sample on this time.

To enable universal wayfinding you have to get a direction to the next waypoint as soon as the navigation is started. Is it not possible to save the relative positions to the previous anchor in the AppProperties to give a direction if the anchor is not in range of the camera and therefore can not be found directly when the OnTriggerEnter method is executed?

Great Idea!!! Actually I had known this problem(the direction of camera), but I couldn't came up with how to resolve. I can set the general direction of the next anchor in AppProperties.

I thought the below featrures,what do you think about this?

  1. On setting the route

    1. we set below infomations to AppProperteis of the current anchor.

      • next anchor id(for searching the next anchor)
      • next anchor direction and distance(general).
      • anchor type(point / destination)
      • previous anchor id(for visualizing link)
      • destination title
  2. Way-finding

    1. Setting the base point.
    2. visualize the marker for searching the next anchor direction. This is because that it is guided user to the next anchor direction.
    3. When we exists the marker in range of camera and reach nearby the marker (about 1-2 m,changeable optional variable) , searching automatically the next anchor by 'Anchor Id'.
    4. If CloudSpatialAnchorWatcher already create(searching the net anchor), next anchor search process is ignore until finish searching it in current process.
    5. When the next anchor is loaded, the app visualize 'Link Object'connected between current to next.

Best Regards, Takahiro

florolf1 commented 4 years ago

1) Definition of the route I would also try (just an idea) to save the direction to the last anchor in the AppProperties. This does not have to be stored in the azure cloud, but can be stored in a separate DB.

I haven't tested it myself yet, so just an idea: Once the ARSession is started, I can determine the distance and angle between 2 objects created during the AR session.

Additionally ASA offers functions for approximate location: Coarse relocalization

2) Wayfinding that's exactly what I would do

Especially the approximate location sounds very interesting and will certainly be helpful in the implementation.