On-Cloud Localization
Details on on-cloud localization
Localization Manager Options

Auto Localize: Automatic start localization at the start of the AR session
Relocalization: Trigger Localization request when AR session tracking is lost/limited; also trigger localization when the app comes from background.
Number of Frame: The number of camera frames to be sent in a single localization request can lead to better accuracy; however, an increased number of frames will also lengthen the localization response time.
Frame Capture Interval: Increase the frame capture interval between subsequent camera frames; a longer interval helps improve localization accuracy in areas with low features.
Background Localization: Trigger Localization request during an AR session, helps in reducing drift by recalibration with the map
How to Use the LocalizeFrame Method in the Unity SDK
The LocalizeFrame method is a key part of the Map Localization Manager script in our Unity SDK. This method simplifies the process of initiating a new localization request for the current frame in your AR application. Below is a detailed explanation of how to use this public method effectively. sending a Localization request
The LocalizeFrame method is designed to trigger a localization request that attempts to determine the device’s precise position and orientation in the AR environment based on available map data.
Method Definition
public void LocalizeFrame()
{
RequestForLocalization();
}
The LocalizeFrame method internally calls the RequestForLocalization method, which handles the actual process of communicating with the localization service. By exposing LocalizeFrame as a public method, we enable developers to easily trigger localization at specific points in their application.
When to Use LocalizeFrame
You can call LocalizeFrame in scenarios where you need to:
1. Recalibrate the device’s position after a significant change in its environment.
2. Ensure the accuracy of the device’s localization during a user interaction.
3. Handle scenarios where the localization state is lost or degraded.
Set MapSpace reference in Map Localization Manager
To ensure accurate placement and alignment of AR objects in the localized environment, developers must place them under the MapSpace GameObject in the Unity hierarchy. Additionally, set a reference to the MapSpace GameObject in the Map Localization Manager. This is essential because the position and rotation of the MapSpace GameObject are dynamically updated during localization, allowing all child AR objects to move and rotate accordingly, maintaining their relative positions in the real world.

Localization Callbacks
Localization init(): Event that is triggered when localization starts, You can use this event to trigger localization animation, loaders or any custom logic for your app.
Localization Success(): Event that is triggered when the localization response comes as a success. You can use this event to trigger localization success events in your app.
Localization Failure(): Event that triggered on failed localization event, you can call the localization event again in case of failure.

Example script to call Localization frame dynamically
using UnityEngine;
public class LocalizationExample : MonoBehaviour
{
// Reference to the Map Localization Manager script
private MapLocalizationManager mapLocalizationManager;
void Start()
{
// Get the Map Localization Manager component
mapLocalizationManager = FindObjectOfType<MapLocalizationManager>();
if (mapLocalizationManager == null)
{
Debug.LogError("MapLocalizationManager not found! Please ensure it is added to the scene.");
}
}
void Update()
{
// Trigger localization when a specific condition is met (e.g., user presses a button)
if (Input.GetKeyDown(KeyCode.L)) // Replace 'L' with any preferred key
{
if (!string.IsNullOrWhiteSpace(mapLocalizationManager?.mapOrMapsetId))
{
mapLocalizationManager.LocalizeFrame();
Debug.Log("Localization request initiated.");
}
else
{
Debug.LogError("Localization cannot be triggered because mapOrMapsetId is not set.");
}
}
}
}
Using Localization confidence value
In the localization API response, you will find a confidence field indicating the accuracy of the position and rotation. Higher confidence values suggest highly accurate positioning and rotation, while lower values indicate potential errors.
Normalized confidence values range from 0 to 1. By default, we do not apply any confidence-based filters in
Developers, based on their application accuracy requirements, can apply a confidence-based filter in the localization step. For example, if you are using localization in a BIM model AR overlay application and require an accuracy of less than 5 cm, you would set a confidence-based filter of 0.8 or above. Thus, only localization responses with confidence greater than 0.8 will be
Last updated
Was this helpful?