Skip to main content
Version: 1.12.1

VLSDKManager

The core component responsible for managing VL API requests and performing real-time position estimation. It processes VL responses to calculate the device position in the global coordinate system.

Properties​

PropertyTypeDescription
playOnAwakeboolWhether to start the session automatically when the VLSDKManager is created (default: true)
settingsVLSDKSettingsSettings of the VLSDKManager
arCameraTransformTransform of the AR camera
originTransformOrigin that converts the camera's local coordinate system into the global coordinate system in space. The Transform of the XR Origin
mainCameraCameraMain camera (Camera.main)
poseTrackerPoseTrackerInternal PoseTracker instance. For advanced users
trackerStateTrackerStateCurrent state of the VLSDKManager
versionstringVLSDK package version (read-only)

Methods​

Initialize​

void Initialize()

Initializes the VLSDKManager system. Do not call it directly unless you are creating the VLSDKManager at runtime. If you create the VLSDKManager at runtime and assign VLSDKSettings yourself, you must assign the VLSDKSettings to the VLSDKManager before calling the initialization method.

Example:

m_VLSDKManager.settings = m_NewLocationSettings;
m_VLSDKManager.Initialize();

StartSession​

void StartSession()

Starts the VLSDK session and begins sending VL requests. When playOnAwake is true, the session starts automatically without calling StartSession().

Example:

m_VLSDKManager.StartSession();

StopSession​

void StopSession()

Stops the VLSDK session. It stops only the VL requests while retaining the current camera position and all recognition information.

Example:

m_VLSDKManager.StopSession();

ResetSession​

void ResetSession()

Resets the VLSDK session, clearing all VLSDK state. When ResetSession() is called, the OnStateChanged(TrackerState) event is invoked with TrackerState.INITIAL.

Example:

m_VLSDKManager.ResetSession();

EnableResetByDevicePose​

void EnableResetByDevicePose(bool active)

Sets whether to enable the session reset feature that uses the device pose. By default, VLSDK automatically resets the whole session when the top of the device faces the floor. If you pass false, the session is not reset even when the device pose is abnormal.

Parameters:

NameTypeDescription
activebooltrue enables the automatic reset, false disables it

Example:

EnableResetByDevicePose(false);   // Do not reset automatically even if the device pose is abnormal.
EnableResetByDevicePose(true); // Reset automatically when the device pose is abnormal.

ChangeState​

void ChangeState(TrackerState state)

Forcibly changes the VLSDK state. This is not used in normal situations; use it only for testing or special cases.

Parameters:

NameTypeDescription
stateTrackerStateState to change to

Example:

m_VLSDKManager.ChangeState(TrackerState.INITIAL);

SetTrackerConfig​

void SetTrackerConfig(TrackerConfig config)

Changes the internal settings of the PoseTracker. This method is for advanced users.

Parameters:

NameTypeDescription
configTrackerConfigTrackerConfig struct to apply

Example:

TrackerConfig config = m_VLSDKManager.GetTrackerConfig();
config.requestIntervalAfterLocalization = 2000; // Change to 2 seconds
m_VLSDKManager.SetTrackerConfig(config);

GetTrackerConfig​

TrackerConfig GetTrackerConfig()

Gets the current internal settings of the PoseTracker.

Returns:

TypeDescription
TrackerConfigCurrent tracker config

Example:

TrackerConfig config = m_VLSDKManager.GetTrackerConfig();
Debug.Log($"Request interval: {config.requestIntervalAfterLocalization}ms");

FindLocation​

string FindLocation(double latitude, double longitude)

Finds the VL Location ID that corresponds to the given GPS coordinates. GPS Guide must be enabled.

Parameters:

NameTypeDescription
latitudedoubleLatitude
longitudedoubleLongitude

Returns:

TypeDescription
stringLocation ID of the given position. Returns an empty string if no area matches

Example:

string locationId = m_VLSDKManager.FindLocation(37.5665, 126.9780);
if (!string.IsNullOrEmpty(locationId))
{
Debug.Log($"Found location: {locationId}");
}

StartDetectingGPSLocation​

void StartDetectingGPSLocation()

Starts GPS-based VL Location detection. When GPS Guide is enabled, it checks the GPS position every second. It is normally called automatically, so you do not need to call it yourself.

StopDetectingGPSLocation​

void StopDetectingGPSLocation()

Stops GPS-based VL Location detection.

Events​

VLSDKManager provides various events such as VL requests/responses, state changes, and position updates. Each event inherits from Unity's UnityEvent, so you can add listeners from the Inspector or from code.

OnVLPoseRequested​

public VLRequestEvent OnVLPoseRequested

An event invoked every time a VL request is sent.

Event Data:

TypeDescription
VLRequestEventDataRequest URL, secret key, request image, and so on

Example:

m_VLSDKManager.OnVLPoseRequested.AddListener((requestData) =>
{
Debug.Log($"VL Request sent to: {requestData.Url}");
});

OnVLPoseResponded​

public VLRespondedEvent OnVLPoseResponded

An event invoked every time a VL response is received.

Event Data:

TypeDescription
VLResponseEventDataResponse status, VL position, confidence, etc.

Example:

m_VLSDKManager.OnVLPoseResponded.AddListener((responseData) =>
{
if (responseData.Status == ResponseStatus.Success)
{
Debug.Log($"VL Success! Confidence: {responseData.Confidence}");
}
});

OnStateChanged​

public ChangedStateEvent OnStateChanged

An event invoked every time the VLSDK state changes.

Event Data:

TypeDescription
TrackerStateINITIAL, NOT_RECOGNIZED, VL_PASS, VL_FAIL, VL_OUT_OF_SERVICE

Example:

m_VLSDKManager.OnStateChanged.AddListener((state) =>
{
switch (state)
{
case TrackerState.VL_PASS:
Debug.Log("VL localization successful!");
break;
case TrackerState.VL_FAIL:
Debug.LogWarning("VL localization failed continuously");
break;
}
});

OnLayerInfoChanged​

public ChangedLayerInfoEvent OnLayerInfoChanged

An event invoked when the layer information of the recognized space changes. The value of the datasetInfo field of the VL response is passed.

Event Data:

TypeDescription
stringLayer Info (e.g. "NAVER_GND_123")

Example:

m_VLSDKManager.OnLayerInfoChanged.AddListener((layerInfo) =>
{
Debug.Log($"Layer changed to: {layerInfo}");
});

OnARFrameUpdated​

public UpdatedARFrameEvent OnARFrameUpdated

An event invoked every frame. The raw frame data of the active AR framework is passed.

Event Data:

TypeDescription
ARFrameCamera texture, position, rotation, intrinsic, etc.

Example:

m_VLSDKManager.OnARFrameUpdated.AddListener((frame) =>
{
Texture cameraTexture = frame.texture;
Vector3 position = frame.localPosition;
});

OnPoseUpdated​

public UpdatedPoseEvent OnPoseUpdated

An event invoked every frame. It passes the matrices related to the camera position updated in the global coordinate system.

Event Data:

NameTypeDescription
viewMatrixMatrix4x4View matrix of the camera
projMatrixMatrix4x4Projection matrix of the camera
texMatrixMatrix4x4Camera preview rendering matrix
relativeAltitudedoubleRelative altitude (m)

Example:

m_VLSDKManager.OnPoseUpdated.AddListener((viewMatrix, projMatrix, texMatrix, altitude) =>
{
Debug.Log($"Relative altitude: {altitude}m");
});

OnGeoCoordUpdated​

public UpdatedGeoCoordEvent OnGeoCoordUpdated

An event invoked every time GPS position recognition is performed.

Event Data:

NameTypeDescription
latitudedoubleLatitude
longitudedoubleLongitude

Example:

m_VLSDKManager.OnGeoCoordUpdated.AddListener((latitude, longitude) =>
{
Debug.Log($"GPS: {latitude}, {longitude}");
});

OnRelativeAltitudeUpdated​

public UpdatedRelAltitudeEvent OnRelativeAltitudeUpdated

An event invoked every time the relative altitude is updated.

Event Data:

NameTypeDescription
altitudedoubleRelative altitude (m)

Example:

m_VLSDKManager.OnRelativeAltitudeUpdated.AddListener((altitude) =>
{
Debug.Log($"Altitude: {altitude}m");
});

OnObjectDetected​

public DetectedObjectEvent OnObjectDetected

An event invoked when an object is detected.

Event Data:

TypeDescription
DetectedObjectInformation of the detected object

Example:

m_VLSDKManager.OnObjectDetected.AddListener((detectedObject) =>
{
Debug.Log($"Object detected: {detectedObject}");
});

Usage examples​

Basic usage​

Example
using UnityEngine;
using ARCeye;

public class VLSDKController : MonoBehaviour
{
public VLSDKManager vlsdkManager;
public VLSDKSettings vlsdkSettings;

void Start()
{
// Assign VLSDKSettings and initialize
vlsdkManager.settings = vlsdkSettings;
vlsdkManager.Initialize();

// Register event listeners
vlsdkManager.OnStateChanged.AddListener(OnStateChanged);
vlsdkManager.OnVLPoseResponded.AddListener(OnVLResponded);

// Start the session (when playOnAwake is false)
vlsdkManager.StartSession();
}

void OnStateChanged(TrackerState state)
{
Debug.Log($"State changed to: {state}");
}

void OnVLResponded(VLResponseEventData data)
{
if (data.Status == ResponseStatus.Success)
{
Debug.Log($"VL Success! Position: {data.VLPosition}");
}
}
}

Session control​

Example
// Pause the session
public void PauseVL()
{
vlsdkManager.StopSession();
}

// Resume the session
public void ResumeVL()
{
vlsdkManager.StartSession();
}

// Reset the session (when the position was recognized incorrectly)
public void ResetVL()
{
vlsdkManager.ResetSession();
}

Checking the position based on GPS​

Example
void CheckLocation()
{
double latitude = 37.5665;
double longitude = 126.9780;

string locationId = vlsdkManager.FindLocation(latitude, longitude);

if (!string.IsNullOrEmpty(locationId))
{
Debug.Log($"The current position is in the {locationId} area.");
}
else
{
Debug.Log("Outside the service area.");
}
}

See also​