From c090e25c3e145337104e736a52ea24c329903a51 Mon Sep 17 00:00:00 2001 From: Sylvain Buche <sylvain.buche@orange.com> Date: Mon, 29 Jul 2024 15:05:56 +0200 Subject: [PATCH] Add debug lines and modify tracking prefab aspect for geospatial trackables --- Runtime/Resources/ARFAnchorTrackingPrefab.prefab | 2 +- Runtime/Scripts/WorldAnalysisARFoundation.cs | 6 +++++- .../WorldAnalysisARFoundationModuleGeospatial.cs | 15 +++++++++++++-- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Runtime/Resources/ARFAnchorTrackingPrefab.prefab b/Runtime/Resources/ARFAnchorTrackingPrefab.prefab index 1c0ee73..e50e5ac 100644 --- a/Runtime/Resources/ARFAnchorTrackingPrefab.prefab +++ b/Runtime/Resources/ARFAnchorTrackingPrefab.prefab @@ -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 diff --git a/Runtime/Scripts/WorldAnalysisARFoundation.cs b/Runtime/Scripts/WorldAnalysisARFoundation.cs index b40662f..34925a2 100644 --- a/Runtime/Scripts/WorldAnalysisARFoundation.cs +++ b/Runtime/Scripts/WorldAnalysisARFoundation.cs @@ -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); } diff --git a/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs b/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs index bd8e034..6a8c093 100644 --- a/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs +++ b/Runtime/Scripts/WorldAnalysisARFoundationModuleGeospatial.cs @@ -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; } -- GitLab