documentation

Visometry.VisionLib.SDK.Core.TrackingManager Class Reference

Inherits MonoBehaviour.

Inherited by Visometry.VisionLib.SDK.Core.SynchronousTrackingManager.

Data Structures

class  WorkerNotFoundException
 

Public Types

enum class  ImageStream { None , CameraImage , DebugImage }
 

Public Member Functions

bool AddCameraCalibrationDB (string uri)
 Adds the camera calibration DataBase using the URI. It will not be loaded at this point but only the possibility to add it will be checked. The loading of the actual database happens when starting the tracking pipe! More...
 
delegate void CalibratedImageAction (CalibratedImage calibratedImage)
 Delegate for OnCalibratedImage events. More...
 
delegate void ExtrinsicDataAction (ExtrinsicData extrinsicData)
 Delegate for OnExtrinsicData events. More...
 
DeviceInfo GetDeviceInfo ()
 Returns the device info, when the worker object has been initialized. You can call this function in order to get useful system information before starting the tracking pipe You might use this structure for retrieving the available cameras in the system. More...
 
string GetDeviceType ()
 Returns the type of the loaded device pipeline. Works for tracking configurations loaded from a vl-file or vl-string. More...
 
LicenseInformation GetLicenseInformation ()
 
Texture2D GetStreamTexture (ImageStream streamType)
 
bool GetTrackerInitialized ()
 
string GetTrackerType ()
 Returns the type of the loaded tracking pipeline. Works for tracking configurations loaded from a vl-file or vl-string. More...
 
bool GetTrackerType (out string trackerType)
 Returns the type of the loaded tracking pipeline. Works for tracking configurations loaded from a vl-file or vl-string. More...
 
bool GetTrackingRunning ()
 
Worker GetWorker ()
 Returns the owned Worker object. More...
 
delegate void ImageAction (Image image)
 Delegate for OnImage events. More...
 
delegate void IntrinsicDataAction (IntrinsicData intrinsicData)
 Delegate for OnIntrinsicData events. More...
 
delegate void IssueTriggeredAction (Issue issue)
 Delegate for OnIssueTriggered events. More...
 
void PauseTracking ()
 Pause the tracking.
 
delegate void PerformanceInfoAction (PerformanceInfo state)
 Delegate for OnPerformanceInfo events. More...
 
void ResetTrackingHard ()
 Reset the tracking and all key frames. More...
 
void ResetTrackingSoft ()
 Reset the tracking. More...
 
void ResumeTracking ()
 Resume the tracking.
 
void SetFPS (int newFPS)
 Sets the frame rate of the tracking algorithm. This might limit the performance consumed by VisionLib. More...
 
async Task SetFPSAsync (int newFPS)
 Sets target number of frames per second for the tracking thread.
 
void SetWaitForEvents (bool wait)
 Set waitForEvents to the given value. More...
 
virtual void StartTracking (string filename)
 Start the tracking using a vl-file. More...
 
void StartTrackingFromString (string trackingConfig, string projectDir, string overrideParameter=null)
 Start the tracking using a tracking configuration as string. More...
 
virtual void StopTracking ()
 Stop the tracking (releases all tracking resources).
 
delegate void TrackingStatesAction (TrackingState state)
 Delegate for OnTrackingStates events. More...
 

Static Public Member Functions

static EventWrapper< SimilarityTransformAnchorTransform (string anchorName)
 
static async void CatchCommandErrors (Task task, MonoBehaviour caller=null)
 This function should be used when awaiting a Task created anywhere within the vlUnitySDK. It will await the Task while treating all VisionLib specific errors which might arise from calling a command. Using this function also preserves the call stack, so you will still be able to identify the function which causes the logged error. More...
 
static void EmitEvents (Frame frame)
 
static void InvokeOnTrackerResetHard ()
 
static void InvokeOnTrackerResetSoft ()
 

Data Fields

string calibrationDataBaseURI
 
LicenseFile licenseFile
 Path of the license file.
 
VLSDK.LogLevel logLevel = VLSDK.LogLevel.Warning
 VisionLib log level. More...
 
int targetFPS = 30
 Target number of frames per second for the tracking thread. More...
 
bool waitForEvents = false
 Whether to wait for tracking events. More...
 

Protected Member Functions

void CreateLogger ()
 
virtual void CreateWorker ()
 
virtual void OnDestroy ()
 
virtual void RegisterListeners ()
 
virtual void RegisterTrackerListeners ()
 
virtual void UnregisterListeners ()
 
virtual void UnregisterTrackerListeners ()
 
virtual void Update ()
 
virtual void UpdateAnchorTransformListeners ()
 

Protected Attributes

Worker worker = null
 
object workerLock = new object()
 

Properties

Worker Worker [get]
 

Events

static CalibratedImageAction OnCalibratedDepthImage
 Event with the current calibrated depth image. This Event will be emitted for each tracking frame.
 
static ExtrinsicDataAction OnCameraTransform
 Event with the current extrinsic data slam. This Event will be emitted for each tracking frame.
 
static ImageAction OnDebugImage
 Event with the current debug image. This Event will be emitted for each tracking frame, if debugLevel is at least 1
 
static ExtrinsicDataAction OnExtrinsicData
 Event with the current extrinsic data. This Event will be emitted for each tracking frame.
 
static ImageAction OnImage
 Event with the current tracking image. This Event will be emitted for each tracking frame.
 
static IntrinsicDataAction OnIntrinsicData
 Event with the current intrinsic data. This Event will be emitted for each tracking frame.
 
static IssueTriggeredAction OnIssueTriggered
 Event which will be emitted if an Issue was triggered
 
static PerformanceInfoAction OnPerformanceInfo
 Event with the current tracking performance. This Event will be emitted for each tracking frame.
 
static VLSDK.VoidDelegate OnTrackerInitialized
 Event which will be emitted after the tracking configuration was loaded.
 
static VLSDK.VoidDelegate OnTrackerInitializing
 Event which will be emitted once after calling the StartTracking function.
 
static VLSDK.VoidDelegate OnTrackerPaused
 Event which will be emitted after the tracking was paused.
 
static VLSDK.VoidDelegate OnTrackerResetHard
 Event which will be emitted after a hard reset was executed.
 
static VLSDK.VoidDelegate OnTrackerResetSoft
 Event which will be emitted after a soft reset was executed.
 
static VLSDK.VoidDelegate OnTrackerRunning
 Event which will be emitted once after the tracking was stopped or paused and is now running again.
 
static VLSDK.VoidDelegate OnTrackerStopped
 Event which will be emitted after the tracking was stopped or the initialization of the tracker has failed.
 
static TrackingStatesAction OnTrackingStates
 Event with the current tracking state of all tracked objects. This Event will be emitted for each tracking frame.
 
static VLSDK.VoidDelegate OnWorkerCreated
 Event which will be emitted once after the worker has been created.
 

Member Function Documentation

◆ AddCameraCalibrationDB()

bool Visometry.VisionLib.SDK.Core.TrackingManager.AddCameraCalibrationDB ( string  uri)
inline

Adds the camera calibration DataBase using the URI. It will not be loaded at this point but only the possibility to add it will be checked. The loading of the actual database happens when starting the tracking pipe!

Returns
true, if camera calibration DB was added, false otherwise.
Parameters
uriURI pointing to the camera calibration to be merged.

◆ CalibratedImageAction()

delegate void Visometry.VisionLib.SDK.Core.TrackingManager.CalibratedImageAction ( CalibratedImage  calibratedImage)

Delegate for OnCalibratedImage events.

Parameters
calibratedImageCalibratedImage.

◆ CatchCommandErrors()

static async void Visometry.VisionLib.SDK.Core.TrackingManager.CatchCommandErrors ( Task  task,
MonoBehaviour  caller = null 
)
inlinestatic

This function should be used when awaiting a Task created anywhere within the vlUnitySDK. It will await the Task while treating all VisionLib specific errors which might arise from calling a command. Using this function also preserves the call stack, so you will still be able to identify the function which causes the logged error.

Parameters
taskTask which should be awaited.
callerMonoBehaviour which should be referenced, when selecting error message in the log.

◆ ExtrinsicDataAction()

delegate void Visometry.VisionLib.SDK.Core.TrackingManager.ExtrinsicDataAction ( ExtrinsicData  extrinsicData)

Delegate for OnExtrinsicData events.

Parameters
extrinsicDataExtrinsicData.

◆ GetDeviceInfo()

DeviceInfo Visometry.VisionLib.SDK.Core.TrackingManager.GetDeviceInfo ( )
inline

Returns the device info, when the worker object has been initialized. You can call this function in order to get useful system information before starting the tracking pipe You might use this structure for retrieving the available cameras in the system.

Returns
The device info object or null.

◆ GetDeviceType()

string Visometry.VisionLib.SDK.Core.TrackingManager.GetDeviceType ( )
inline

Returns the type of the loaded device pipeline. Works for tracking configurations loaded from a vl-file or vl-string.

Returns
loaded device type

◆ GetTrackerType() [1/2]

string Visometry.VisionLib.SDK.Core.TrackingManager.GetTrackerType ( )
inline

Returns the type of the loaded tracking pipeline. Works for tracking configurations loaded from a vl-file or vl-string.

Returns
loaded tracker type

◆ GetTrackerType() [2/2]

bool Visometry.VisionLib.SDK.Core.TrackingManager.GetTrackerType ( out string  trackerType)
inline

Returns the type of the loaded tracking pipeline. Works for tracking configurations loaded from a vl-file or vl-string.

Parameters
trackerTypeloaded tracker type
Returns
returns true on success; false otherwise.

◆ GetWorker()

Worker Visometry.VisionLib.SDK.Core.TrackingManager.GetWorker ( )
inline

Returns the owned Worker object.

Returns
Worker object or null, if the Worker wasn't initialized yet.

◆ ImageAction()

delegate void Visometry.VisionLib.SDK.Core.TrackingManager.ImageAction ( Image  image)

Delegate for OnImage events.

Parameters
imageImage.

◆ IntrinsicDataAction()

delegate void Visometry.VisionLib.SDK.Core.TrackingManager.IntrinsicDataAction ( IntrinsicData  intrinsicData)

Delegate for OnIntrinsicData events.

Parameters
intrinsicDataIntrinsicData.

◆ IssueTriggeredAction()

delegate void Visometry.VisionLib.SDK.Core.TrackingManager.IssueTriggeredAction ( Issue  issue)

Delegate for OnIssueTriggered events.

Parameters
issueIssue

◆ PerformanceInfoAction()

delegate void Visometry.VisionLib.SDK.Core.TrackingManager.PerformanceInfoAction ( PerformanceInfo  state)

Delegate for OnPerformanceInfo events.

Parameters
statePerformanceInfo with information about the performance.

◆ ResetTrackingHard()

void Visometry.VisionLib.SDK.Core.TrackingManager.ResetTrackingHard ( )
inline

Reset the tracking and all key frames.

This function will be performed asynchronously.

◆ ResetTrackingSoft()

void Visometry.VisionLib.SDK.Core.TrackingManager.ResetTrackingSoft ( )
inline

Reset the tracking.

This function will be performed asynchronously.

◆ SetFPS()

void Visometry.VisionLib.SDK.Core.TrackingManager.SetFPS ( int  newFPS)
inline

Sets the frame rate of the tracking algorithm. This might limit the performance consumed by VisionLib.

This function will be performed asynchronously.

Parameters
newFPSNumber of frames per second

◆ SetWaitForEvents()

void Visometry.VisionLib.SDK.Core.TrackingManager.SetWaitForEvents ( bool  wait)
inline

Set waitForEvents to the given value.

See waitForEvents for further information.

◆ StartTracking()

virtual void Visometry.VisionLib.SDK.Core.TrackingManager.StartTracking ( string  filename)
inlinevirtual

Start the tracking using a vl-file.

The type of the tracker will be derived from the vl-file.

Reimplemented in Visometry.VisionLib.SDK.Core.SynchronousTrackingManager.

◆ StartTrackingFromString()

void Visometry.VisionLib.SDK.Core.TrackingManager.StartTrackingFromString ( string  trackingConfig,
string  projectDir,
string  overrideParameter = null 
)
inline

Start the tracking using a tracking configuration as string.

Parameters
trackingConfigTracking configuration as string
projectDirDirectory
overrideParameter

◆ TrackingStatesAction()

delegate void Visometry.VisionLib.SDK.Core.TrackingManager.TrackingStatesAction ( TrackingState  state)

Delegate for OnTrackingStates events.

Parameters
stateTrackingState with information about the currently tracked objects.

Field Documentation

◆ logLevel

VLSDK.LogLevel Visometry.VisionLib.SDK.Core.TrackingManager.logLevel = VLSDK.LogLevel.Warning

VisionLib log level.

Available log levels:

  • 0: Mute
  • 1: Fatal
  • 2: Warning
  • 3: Notice
  • 4: Info
  • 5: Debug

Log level N will disable all log messages with a level > N.

◆ targetFPS

int Visometry.VisionLib.SDK.Core.TrackingManager.targetFPS = 30

Target number of frames per second for the tracking thread.

The tracking will run as fast as possible, if the value is zero or less.

Higher values will result in a smoother tracking experience, but the battery will be drained faster.

◆ waitForEvents

bool Visometry.VisionLib.SDK.Core.TrackingManager.waitForEvents = false

Whether to wait for tracking events.

If true, the Update member function will wait until there is at least one tracking event. This will limit the speed of the Unity update cycler to the speed of the tracking, but the tracking will feel more smooth, because the camera image will be shown with less delay.

If false, the speed of the tracking and the Unity update cycle are largely separate. Due to the out of sync update rates, the camera might be shown with a slight delay.