Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • arf/world-analysis-api-helpers/unity-world-analysis-arfoundation-wrapper-package
1 result
Show changes
......@@ -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
......
......@@ -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);
}
......
......@@ -30,13 +30,14 @@ public interface WorldAnalysisARFoundationModule
public bool AddTrackable(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable);
/// <summary>
///
/// Get the pose of the trackable from its uuid
/// </summary>
/// <param name="uuid"></param>
/// <param name="uuid">id of the trackable</param>
/// <returns>null or trackableInfo with last updated values</returns>
public TrackableInfo GetPoseTrackable(Guid uuid);
/// <summary>
/// Initialize capability object with the features of the
/// Initialize capability object with the features of the module
/// </summary>
public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability();
......
......@@ -74,9 +74,9 @@ public class WorldAnalysisARFoundationModuleARCoreAnchor : WorldAnalysisARFounda
}
/// <summary>
///
/// Initialize capability object with the features of the arcore cloud anchor module
/// </summary>
/// <returns></returns>
/// <returns>a Capability object</returns>
public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability()
{
ETSI.ARF.OpenAPI.WorldAnalysis.Capability capabilityARCoreAnchor = new ETSI.ARF.OpenAPI.WorldAnalysis.Capability();
......@@ -92,7 +92,7 @@ public class WorldAnalysisARFoundationModuleARCoreAnchor : WorldAnalysisARFounda
}
/// <summary>
///
/// Update arcore cloud anchors informations
/// </summary>
/// <param name="eventArgs"></param>
private void OnTrackedCloudAnchorChanged(ARAnchorsChangedEventArgs eventArgs)
......@@ -140,10 +140,10 @@ public class WorldAnalysisARFoundationModuleARCoreAnchor : WorldAnalysisARFounda
}
/// <summary>
///
/// Create a new ARCore Cloud anchor using ARCore API id
/// </summary>
/// <param name="trackable"></param>
private async void AddNewARCoreCloudAnchor(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable )
private async void AddNewARCoreCloudAnchor(ETSI.ARF.OpenAPI.WorldStorage.Trackable trackable)
{
while (ARSession.state == ARSessionState.CheckingAvailability || ARSession.state == ARSessionState.None ||ARSession.state == ARSessionState.SessionInitializing)
{
......@@ -172,7 +172,7 @@ public class WorldAnalysisARFoundationModuleARCoreAnchor : WorldAnalysisARFounda
}
/// <summary>
///
/// Resolves cloud anchor promise
/// </summary>
/// <param name="promise"></param>
/// <returns></returns>
......
......@@ -15,16 +15,26 @@ public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundati
/// </summary>
private ARAnchorManager m_anchorManager;
/// <summary>
/// Earth manager
/// </summary>
private AREarthManager m_arEarthManager;
/// <summary>
/// List of geospatial anchors with tracking infos
/// </summary>
private Dictionary<string, TrackableInfo> m_trackedGeospatialAnchors = new Dictionary<string, TrackableInfo>();
private bool geospatialSupported = true;
/// <summary>
/// Correspondance between local trackable and etsi uuid
/// </summary>
private Dictionary<string, string> m_localIdToEtsiId = new Dictionary<string, string>();
/// <summary>
/// Check if ARCore Geospatial is supported on the device
/// </summary>
private bool geospatialSupported = true;
/// <summary>
/// Initialize ARCore geospatial anchors tracking module
/// </summary>
......@@ -43,10 +53,10 @@ public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundati
}
/// <summary>
///
/// Get the pose of the trackable from its uuid
/// </summary>
/// <param name="uuid"></param>
/// <returns></returns>
/// <param name="uuid">id of the trackable</param>
/// <returns>null or trackableInfo with last updated values</returns>
public TrackableInfo GetPoseTrackable(Guid uuid)
{
if (m_trackedGeospatialAnchors.ContainsKey(uuid.ToString()))
......@@ -60,12 +70,13 @@ public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundati
}
/// <summary>
///
/// Need to be a geopose
/// </summary>
/// <param name="trackable"></param>
/// <returns></returns>
/// <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)
......@@ -77,23 +88,55 @@ public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundati
return true;
}
/// <summary>
/// Initialize capability object with the features of the geospatial module
/// </summary>
/// <returns>null if ARCore Geospatial is not supported on the device, or a Capability object</returns>
public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability()
{
if (!geospatialSupported) return null;
ETSI.ARF.OpenAPI.WorldAnalysis.Capability capabilityGeospatialAnchor = new ETSI.ARF.OpenAPI.WorldAnalysis.Capability();
capabilityGeospatialAnchor.TrackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.GEOPOSE;
ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure encodingInformation = new ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure();
encodingInformation.DataFormat = ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructureDataFormat.ARCORE;
encodingInformation.Version = "1.01";
capabilityGeospatialAnchor.EncodingInformation = encodingInformation;
capabilityGeospatialAnchor.Framerate = 30; // Not particularly specified on ARKit and ARCore
capabilityGeospatialAnchor.Latency = 0; // Not particularly specified on ARKit and ARCore
capabilityGeospatialAnchor.Accuracy = 1; // Not particularly specified on ARKit and ARCore
return capabilityGeospatialAnchor;
}
/// <summary>
/// Creates a new ARCore Geospatial anchor using informations from a geopose trackable object
/// </summary>
/// <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)
{
Debug.Log("Support : " + m_arEarthManager.IsGeospatialModeSupported(GeospatialMode.Enabled));
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++)
{
......@@ -111,31 +154,10 @@ public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundati
}
}
/// <summary>
///
/// Update geospatial anchors informations
/// </summary>
/// <returns></returns>
public ETSI.ARF.OpenAPI.WorldAnalysis.Capability GetSupportedCapability() //s'occuper de a (fonction doc)
{
if (!geospatialSupported) return null;
ETSI.ARF.OpenAPI.WorldAnalysis.Capability capabilityGeospatialAnchor = new ETSI.ARF.OpenAPI.WorldAnalysis.Capability();
capabilityGeospatialAnchor.TrackableType = ETSI.ARF.OpenAPI.WorldAnalysis.TrackableType.GEOPOSE;
ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure encodingInformation = new ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructure();
encodingInformation.DataFormat = ETSI.ARF.OpenAPI.WorldAnalysis.EncodingInformationStructureDataFormat.ARCORE;
encodingInformation.Version = "1.01";
capabilityGeospatialAnchor.EncodingInformation = encodingInformation;
capabilityGeospatialAnchor.Framerate = 30; // Not particularly specified on ARKit and ARCore
capabilityGeospatialAnchor.Latency = 0; // Not particularly specified on ARKit and ARCore
capabilityGeospatialAnchor.Accuracy = 1; // Not particularly specified on ARKit and ARCore
return capabilityGeospatialAnchor;
}
/// <summary>
///
/// </summary>
/// <param name="eventArgs"></param>
/// <param name="eventArgs">Event arguments for the <see cref="ARAnchorManager.anchorsChanged"/> event</param>
private void OnTrackedGeospatialAnchorChanged(ARAnchorsChangedEventArgs eventArgs)
{
foreach (var trackedGeospatialAnchor in eventArgs.updated)
......@@ -153,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;
}
......@@ -181,5 +203,4 @@ public class WorldAnalysisARFoundationModuleGeospatial : WorldAnalysisARFoundati
}
}
}
#endif
\ No newline at end of file