Commit c090e25c authored by Sylvain Buche's avatar Sylvain Buche
Browse files

Add debug lines and modify tracking prefab aspect for geospatial trackables

parent 08b37b47
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ GameObject:
  m_Icon: {fileID: 0}
  m_NavMeshLayer: 0
  m_StaticEditorFlags: 0
  m_IsActive: 1
  m_IsActive: 0
--- !u!4 &5663275178603938767
Transform:
  m_ObjectHideFlags: 0
+5 −1
Original line number Diff line number Diff line
@@ -393,8 +393,13 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface
                }
            }


            /// Collect relocalization information
            ETSI.ARF.OpenAPI.WorldStorage.Response response = RelocalizationInformationRequest.GetRelocalizationInformation(m_worldStorageServer, uuids, modes, capabilities);
            if(response == null)
            {
                Debug.Log("ESTI ARF GetRelocalizationInformation : request response is null");
            }
            relocInfo = response.RelocInfo.First(); //Only one uuid requested
        }
        else
@@ -408,7 +413,6 @@ public class WorldAnalysisARFoundation : MonoBehaviour, WorldAnalysisInterface
            /// Subscription not possible
            return InformationSubscriptionResult.NONE;
        }

        return CreateSubscriptionWithRelocalizationInformation(relocInfo, uuid, mode, callback, ref validity, out subscriptionUUID);
    }

+13 −2
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundati
    /// <returns>geopose or not (does not check is solved)</returns>
    public bool AddTrackable(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable)
    {
        Debug.Log("GEO : Add Geosptial Trackable");
        if (!geospatialSupported) return false;

        if (trackable.TrackableType != ETSI.ARF.OpenAPI.WorldStorage.TrackableType.GEOPOSE)
@@ -113,19 +114,29 @@ public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundati
    /// <param name="trackable"></param>
    public async void CreateGeosptialAnchor(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable)
    {

        double[] values = new double[trackable.TrackablePayload.Length / sizeof(double)];

        for (int i = 0; i < values.Length; i++)
        {
            values[i] = BitConverter.ToDouble(trackable.TrackablePayload, i * sizeof(double));
        }

        if (geospatialSupported)
        {
            while (ARSession.state == ARSessionState.CheckingAvailability || ARSession.state == ARSessionState.None || ARSession.state == ARSessionState.SessionInitializing || m_arEarthManager.EarthState != EarthState.Enabled || m_arEarthManager.EarthTrackingState != TrackingState.Tracking)
            {
                Debug.Log("Geo : checking " + ARSession.state + "  " + m_arEarthManager.EarthState + "   " + m_arEarthManager.EarthTrackingState);
                await System.Threading.Tasks.Task.Delay(100);
            }
            if (m_arEarthManager.IsGeospatialModeSupported(GeospatialMode.Enabled) != FeatureSupported.Supported)
            {
                geospatialSupported = false;
                Debug.Log("Geo : not supported");
            }
            else
            {
                double[] values = new double[trackable.TrackablePayload.Length / sizeof(double)];
                values = new double[trackable.TrackablePayload.Length / sizeof(double)];

                for (int i = 0; i < values.Length; i++)
                {
@@ -164,7 +175,7 @@ public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundati
            }
            else
            {
                Debug.Log("ARCore Geospatial Anchor No correspondance for Local Anchor " + localId);
                //Debug.Log("ARCore Geospatial Anchor No correspondance for Local Anchor " + localId);
                continue;
            }