SingleFrameLocalizationManager
Last updated
Was this helpful?
Last updated
Was this helpful?
Was this helpful?
The SingleFrameLocalizationManager is a specialized component within the MultiSet SDK designed to perform VPS localization using a single camera frame per request. This approach is useful for scenarios where quick, individual localization attempts are preferred over a continuous multi-frame approach. The manager can be configured to make multiple single-frame attempts and select the best result based on confidence scores.
This manager handles the process of capturing a single, high-quality (non-blurry) image from the device's AR camera, sending it to the MultiSet backend for pose estimation, and then aligning the mapSpace GameObject with the real world. It includes features for automatic localization on startup, re-localization upon losing AR tracking, and a confidence-based validation system to ensure the reliability of the localization result. It provides UnityEvent callbacks for developers to respond to key moments in the localization lifecycle.
This section details the publicly accessible fields of the SingleFrameLocalizationManager that can be configured in the Unity Editor or through script.
Property
Type
Description
localizationType
LocalizationType
An enum specifying whether to localize against a single Map or a MapSet.
mapOrMapsetCode
string
The unique code for the map or map set that the device will attempt to localize against. This is a required field.
autoLocalize
bool
If true, the manager will automatically start the localization process after the SDK has successfully authenticated.
relocalization
bool
If true, the manager will attempt to re-localize automatically if the AR session loses tracking.
confidenceCheck
bool
When enabled, the manager will only consider a localization successful if its confidence score, returned by the API, is above the _confidenceThreshold.
_confidenceThreshold
float
The minimum confidence score required for a localization result to be considered valid when confidenceCheck is enabled. The value is clamped between 0.2 and 0.8.
_requestAttempts
int
The total number of single-frame localization attempts the manager will make in a single LocalizeFrame() cycle. The value is clamped between 1 and 5.
localizationInterval
int
The time in seconds to wait between each localization attempt. The value is clamped between 1 and 5.
showAlert
bool
If true, a toast message will be displayed on the screen indicating whether the final localization result was a success or failure.
passGeoPose
bool
If enabled, the manager will include the device's GPS coordinates in the localization request to serve as a hint for the backend.
geoCoordinatesInResponse
bool
If enabled, the manager will request that the localization response includes the geo-coordinates corresponding to the device's estimated position.
LocalizationInit
UnityEvent
A UnityEvent that is invoked at the beginning of the localization process when LocalizeFrame() is called.
LocalizationSuccess
UnityEvent
A UnityEvent that is invoked after a successful localization attempt that meets the confidence criteria (if enabled), and the mapSpace pose has been updated.
LocalizationFailure
UnityEvent
A UnityEvent that is invoked if all localization attempts fail to produce a valid pose or if the best result does not meet the confidence threshold.
This section describes the publicly accessible methods of the SingleFrameLocalizationManager.
LocalizeFrame()
Manually initiates the single-frame localization process.
public void LocalizeFrame()
Description Calling this method starts the localization sequence. The manager will attempt to capture a non-blurry image and send it to the MultiSet API. It will repeat this process for the number of times specified by _requestAttempts. After all attempts are complete, it evaluates the results to find the best pose. This is the main method to use for triggering localization on demand.