Skip to main content

Get started with VPS2

This guide shows how to add VPS2 to your project, configure its localization options, and manage its lifecycle. For an explanation of universal and VPS map localization, assets, and tracking states, see Visual Positioning System 2.

Prerequisites​

This guide assumes that you have already completed:

If you are upgrading an existing ARDK 3.x application, see Migrate from VPS to VPS2.

Add and configure VPS2​

The Niantic Spatial Unity SDK (NSDK) uses AR Foundation as the interface for exposing its features. Adding VPS2 is therefore similar to adding other AR Foundation components.

ARVps2Manager​

ARVps2Manager is the entry point to VPS2: configuration, localization, geolocation, anchors, and asset tracking. It owns the VPS2 feature's lifecycle. Tracked assets and anchors are served as trackables by the ARVps2AssetManager and ARVps2AnchorManager components it requires next to it; Unity adds both automatically when you add ARVps2Manager to a GameObject.

The manager can also convert between local AR poses and global geopositions (and vice versa).

AR VPS2 Manager Component

Configuration Fields​

FieldDefaultWhat it controls
Universal Localization EnabledDisabledWhen active, the VPS2 session sends AR sensor data and camera imagery to the server to localize against global-scale maps. This method can improve geoposition accuracy beyond local sensor fusion but requires a network connection. If disabled, the system relies exclusively on local sensor fusion.
Universal Localization Requests per Second1Frequency of network requests sent for universal localization.
VPS Map Localization EnabledEnabledWhen active, the VPS2 session sends AR sensor data and camera imagery to the server to localize against VPS maps.
Initial Requests per Second1.0Server request frequency prior to the first successful VPS map localization. For example, 1.0 is one request per second.
Continuous Requests per Second0.2Server request frequency after the initial VPS map localization. For example, 0.2 is one request every five seconds.
Geolocation Smoothing Enabled—Enables interpolation between localization updates. This minimizes “snapping” or visual jumps during abrupt GPS or compass recalibrations, for a more stable AR experience.
Blur Detection EnabledDisabledEnables an advisory image blur check on the frames VPS2 sends for VPS map localization. A frame whose sharpness score falls below the threshold produces a FrameFlagged localization request record with error ImageTooBlurry, but is still sent for localization, never rejected. Use the signal to coach the user, for example "hold the device steady". See Prompt users through blurry frames.
Min Sharpness Score0Sharpness threshold below which a frame is flagged as too blurry. The default of 0 flags nothing. Higher scores mean sharper images. There is no universal "sharp" value; 1000 is a good starting point and is the value the VPS2 samples use.

Universal and VPS map localization are configured independently. VPS map localization is enabled by default; universal localization is disabled by default, so turn it on explicitly if you want cloud geopositioning.

ARVps2Manager enables VPS Map Localization but not Universal Localization, so a scene that uses the component runs VPS map localization only. Tick Universal Localization Enabled on the inspector component to run both together.

Start and stop VPS2​

VPS2 starts and stops according to the Unity component lifecycle. When started, universal localization, if enabled, begins collecting the sensor data required for localization, and coarse positioning estimates are typically available within a few seconds after the AR session begins running. VPS map localization does not start until you call TryLocalize:

A Site must have a processed VPS map tagged for production to be eligible for map-relative localization. Localize requests are additive, and the submitted Sites stay in the localization set until the manager stops. TryLocalize returns false until the manager has been enabled for the first time. After that, you can call it while the manager is disabled; the request is submitted when the manager is enabled again.

To check whether the Site has localized, call TryGetAssetTrackingData; it returns data once the Site's asset is localized and tracked. Do not use the session's Vps2TrackingState for that check. For the difference between those two states, see Tracking states.

When stopped, all localization and anchor state is reset.

Configuration changes to ARVps2Manager are applied only when the component starts and cannot be modified while it is running. The blur detection fields are the exception: they are applied live while the component is running.

To restart VPS2 with a different configuration, disable the ARVps2Manager component, change the configuration, then re-enable it. Because configuration is read at start, changing a field on a running manager has no effect until the next start.

Next Steps​

GoalGuide
Complete an end-to-end Site localizationFirst localization with NSDK
Retrieve global position, heading, and accuracyGeolocate with VPS2
Localize to a Site and attach AR contentPlace virtual content with VPS2
Retrieve Sites and assets at runtimeGetting Started with Sites
Guide users to a successful localizationGuide users during localization
Explore complete implementationsNSDK sample projects