documentation

Functions for managing Worker objects. More...

Functions

VL_SDK_API vlWorker_t *VL_CALLINGCONVENTION vlNew_Worker (vlAbstractApplicationWrapper_t *aap)
 Creates a Worker object. More...
 
VL_SDK_API vlWorker_t *VL_CALLINGCONVENTION vlNew_SyncWorker (vlAbstractApplicationWrapper_t *aap)
 Creates a synchronous Worker object. More...
 
VL_SDK_API void VL_CALLINGCONVENTION vlDelete_Worker (vlWorker_t *worker)
 Deletes a Worker object. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_Start (vlWorker_t *worker)
 Starts the tracking thread. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_Stop (vlWorker_t *worker)
 Stops the tracking thread. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RunOnceSync (vlWorker_t *worker)
 Processes the enqueued commands and the tracking once. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_ProcessJsonCommandSync (vlWorker_t *worker, const char jsonString[], vlCallbackJsonString callback, void *clientData)
 Processes the passed command. More...
 
VL_SDK_API vlImageWrapper_t *VL_CALLINGCONVENTION vlWorker_GetImageSync (vlWorker_t *worker)
 Returns a pointer to the camera image. More...
 
VL_SDK_API vlImageWrapper_t *VL_CALLINGCONVENTION vlWorker_GetImageByNameSync (vlWorker_t *worker, const char *image_name)
 Returns a pointer to the camera image with the given name. More...
 
VL_SDK_API vlImageWrapper_t *VL_CALLINGCONVENTION vlWorker_GetNodeImageSync (vlWorker_t *worker, const char node[], const char key[])
 Returns a pointer to the image with the given name from a given node. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_SetNodeImageSync (vlWorker_t *worker, vlImageWrapper_t *image, const char node[], const char key[])
 Sets the given image in the given input of the given node. More...
 
VL_SDK_API vlExtrinsicDataWrapper_t *VL_CALLINGCONVENTION vlWorker_GetNodeExtrinsicDataSync (vlWorker_t *worker, const char node[], const char key[])
 Returns a pointer to extrinsicdata with the given name from a given node. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_SetNodeExtrinsicDataSync (vlWorker_t *worker, vlExtrinsicDataWrapper_t *extrinsicData, const char node[], const char key[])
 Sets the given extrinsicData in the given input of the given node. More...
 
VL_SDK_API vlIntrinsicDataWrapper_t *VL_CALLINGCONVENTION vlWorker_GetNodeIntrinsicDataSync (vlWorker_t *worker, const char node[], const char key[])
 Returns a pointer to IntrinsicData with the given name from a given node. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_SetNodeIntrinsicDataSync (vlWorker_t *worker, vlIntrinsicDataWrapper_t *intrinsicData, const char node[], const char key[])
 Sets the given IntrinsicData in the given input of the given node. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_IsRunning (vlWorker_t *worker)
 Returns whether the thread is currently running or not. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_PushCommand (vlWorker_t *worker, const char name[], const char parameter[], vlCallbackBool callback, void *clientData)
 Enqueues a command for the tracking thread as zero terminated string. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_PushJsonCommand (vlWorker_t *worker, const char jsonString[], vlCallbackJsonString callback, void *clientData)
 Enqueues a command for the tracking thread as zero terminated JSON string. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_PushJsonAndBinaryCommand (vlWorker_t *worker, const char jsonString[], const char data[], unsigned int size, vlCallbackJsonAndBinaryString callback, void *clientData)
 Enqueues a json command along with binary data for the visionLib. More...
 
VL_SDK_API void VL_CALLINGCONVENTION vlReleaseBinaryBuffer (const char data[])
 Helper function for releasing a binary memory block. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_ProcessCallbacks (vlWorker_t *worker)
 Executes all enqueued callbacks. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddImageListener (vlWorker_t *worker, vlCallbackImageWrapper listener, void *clientData)
 Registers a listener for image events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveImageListener (vlWorker_t *worker, vlCallbackImageWrapper listener, void *clientData)
 Unregisters a listener from image events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddExtrinsicDataListener (vlWorker_t *worker, vlCallbackExtrinsicDataWrapper listener, void *clientData)
 Registers a listener for ExtrinsicData events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveExtrinsicDataListener (vlWorker_t *worker, vlCallbackExtrinsicDataWrapper listener, void *clientData)
 Unregisters a listener from ExtrinsicData events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddIntrinsicDataListener (vlWorker_t *worker, vlCallbackIntrinsicDataWrapper listener, void *clientData)
 Registers a listener for IntrinsicData events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveIntrinsicDataListener (vlWorker_t *worker, vlCallbackIntrinsicDataWrapper listener, void *clientData)
 Unregisters a listener from IntrinsicData events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddTrackingStateListener (vlWorker_t *worker, vlCallbackZString listener, void *clientData)
 Registers a listener for tracking state events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveTrackingStateListener (vlWorker_t *worker, vlCallbackZString listener, void *clientData)
 Unregisters a listener from tracking state events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddPerformanceInfoListener (vlWorker_t *worker, vlCallbackZString listener, void *clientData)
 Registers a listener for performance information events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemovePerformanceInfoListener (vlWorker_t *worker, vlCallbackZString listener, void *clientData)
 Unregisters a listener from performance info events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddNamedImageListener (vlWorker_t *worker, const char key[], vlCallbackImageWrapper listener, void *clientData)
 Registers a listener for named image events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveNamedImageListener (vlWorker_t *worker, const char key[], vlCallbackImageWrapper listener, void *clientData)
 Unregisters a listener from named image events events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddNamedExtrinsicDataListener (vlWorker_t *worker, const char key[], vlCallbackExtrinsicDataWrapper listener, void *clientData)
 Registers a listener for named ExtrinsicData events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveNamedExtrinsicDataListener (vlWorker_t *worker, const char key[], vlCallbackExtrinsicDataWrapper listener, void *clientData)
 Unregisters a listener from named ExtrinsicData events events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddNamedIntrinsicDataListener (vlWorker_t *worker, const char key[], vlCallbackIntrinsicDataWrapper listener, void *clientData)
 Registers a listener for named IntrinsicData events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveNamedIntrinsicDataListener (vlWorker_t *worker, const char key[], vlCallbackIntrinsicDataWrapper listener, void *clientData)
 Unregisters a listener from named IntrinsicData events events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddAnchorToWorldTransformListener (vlWorker_t *worker, const char anchorName[], vlCallbackExtrinsicDataWrapper listener, void *clientData)
 Register a listener for anchor to world transform events (ExtrinsicData events) produced by a certain anchor. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveAnchorToWorldTransformListener (vlWorker_t *worker, const char anchorName[], vlCallbackExtrinsicDataWrapper listener, void *clientData)
 Unregister a listener from anchor to world transform events (ExtrinsicData events) produced by a certain anchor. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_ClearListeners (vlWorker_t *worker)
 Removes all listeners. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_PollEvents (vlWorker_t *worker)
 Calls the registered listeners for the enqueued events. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_WaitEvents (vlWorker_t *worker, unsigned int timeout)
 Waits for enqueued events and calls the registered listeners. More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_Lock (vlWorker_t *worker)
 For testing purposed. Don't use! More...
 
VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_Unlock (vlWorker_t *worker)
 For testing purposed. Don't use! More...
 

Detailed Description

Functions for managing Worker objects.

A Worker object controls the tracking thread.

Function Documentation

◆ vlDelete_Worker()

VL_SDK_API void VL_CALLINGCONVENTION vlDelete_Worker ( vlWorker_t worker)

Deletes a Worker object.

Parameters
workerPointer to a Worker object.

◆ vlNew_SyncWorker()

Creates a synchronous Worker object.

A synchronous Worker object doesn't create a new thread. Instead one has to explicitly tell the Worker when to do his work by calling the vlWorker_RunOnceSync function. This has the advantage, that we know exactly when the tracking is running, when it's finished and when we can get the results.

If you want to call vlWorker_RunOnceSync from a different thread, then you must call vlAbstractApplicationWrapper_RegisterThread first.

Use vlDelete_Worker after usage to avoid memory leaks.

Parameters
aapPointer to an AbstractApplicationWrapper object.
Returns
Pointer to a synchronous Worker object. Use vlDelete_Worker after usage to avoid memory leaks.

◆ vlNew_Worker()

Creates a Worker object.

Use vlDelete_Worker after usage to avoid memory leaks.

Parameters
aapPointer to an AbstractApplicationWrapper object.
Returns
Pointer to an Worker object. Use vlDelete_Worker after usage to avoid memory leaks.

◆ vlReleaseBinaryBuffer()

VL_SDK_API void VL_CALLINGCONVENTION vlReleaseBinaryBuffer ( const char  data[])

Helper function for releasing a binary memory block.

When an vlCallbackJsonAndBinaryString is issued, a memory block passed should be removed after using.

Currently this command is used internally and will be documented in future versions. Thus it is considered as BETA!

Parameters
dataPointer to a binary object.

◆ vlWorker_AddAnchorToWorldTransformListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddAnchorToWorldTransformListener ( vlWorker_t worker,
const char  anchorName[],
vlCallbackExtrinsicDataWrapper  listener,
void *  clientData 
)

Register a listener for anchor to world transform events (ExtrinsicData events) produced by a certain anchor.

Parameters
workerPointer to a Worker object.
anchorNameName of the anchor to be addressed.
listenerListener function which will be notified during the event processing, if an event occurred.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_AddExtrinsicDataListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddExtrinsicDataListener ( vlWorker_t worker,
vlCallbackExtrinsicDataWrapper  listener,
void *  clientData 
)

Registers a listener for ExtrinsicData events.

Parameters
workerPointer to a Worker object.
listenerListener function which will be notified during the event processing, if an ExtrinsicData event occurred.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_AddImageListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddImageListener ( vlWorker_t worker,
vlCallbackImageWrapper  listener,
void *  clientData 
)

Registers a listener for image events.

Parameters
workerPointer to a Worker object.
pListener function which will be notified during the event processing, if an image event occurred.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_AddIntrinsicDataListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddIntrinsicDataListener ( vlWorker_t worker,
vlCallbackIntrinsicDataWrapper  listener,
void *  clientData 
)

Registers a listener for IntrinsicData events.

Parameters
workerPointer to a Worker object.
listenerListener function which will be notified during the event processing, if an IntrinsicData event occurred.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_AddNamedExtrinsicDataListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddNamedExtrinsicDataListener ( vlWorker_t worker,
const char  key[],
vlCallbackExtrinsicDataWrapper  listener,
void *  clientData 
)

Registers a listener for named ExtrinsicData events.

Parameters
workerPointer to a Worker object.
keyKey of the requested ExtrinsicData as zero terminated string.
listenerListener function which will be notified during the event processing, if a named ExtrinsicData event occurred.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_AddNamedImageListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddNamedImageListener ( vlWorker_t worker,
const char  key[],
vlCallbackImageWrapper  listener,
void *  clientData 
)

Registers a listener for named image events.

Parameters
workerPointer to a Worker object.
keyKey of the requested image as zero terminated string.
listenerListener function which will be notified during the event processing, if a named image event occurred.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_AddNamedIntrinsicDataListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddNamedIntrinsicDataListener ( vlWorker_t worker,
const char  key[],
vlCallbackIntrinsicDataWrapper  listener,
void *  clientData 
)

Registers a listener for named IntrinsicData events.

Parameters
workerPointer to a Worker object.
keyKey of the requested IntrinsicData as zero terminated string.
listenerListener function which will be notified during the event processing, if a named IntrinsicData event occurred.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_AddPerformanceInfoListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddPerformanceInfoListener ( vlWorker_t worker,
vlCallbackZString  listener,
void *  clientData 
)

Registers a listener for performance information events.

Parameters
workerPointer to a Worker object.
listenerListener function which will be notified during the event processing, if a performance information event occurred.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_AddTrackingStateListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_AddTrackingStateListener ( vlWorker_t worker,
vlCallbackZString  listener,
void *  clientData 
)

Registers a listener for tracking state events.

Parameters
workerPointer to a Worker object.
listenerListener function which will be notified during the event processing, if a tracking state event occurred.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_ClearListeners()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_ClearListeners ( vlWorker_t worker)

Removes all listeners.

Parameters
workerPointer to a Worker object.
Returns
true, on success; false otherwise.

◆ vlWorker_GetImageByNameSync()

VL_SDK_API vlImageWrapper_t* VL_CALLINGCONVENTION vlWorker_GetImageByNameSync ( vlWorker_t worker,
const char *  image_name 
)

Returns a pointer to the camera image with the given name.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker).

The worker is the owner of the image. Therefore you should not call vlDelete_ImageWrapper with the returned image as parameter.

NOTICE: This functions is experimental and might get removed in future.

Parameters
workerPointer to a Worker object.
image_namename of the image to get
Returns
A pointer to an ImageWrapper object, on success; NULL otherwise.

◆ vlWorker_GetImageSync()

VL_SDK_API vlImageWrapper_t* VL_CALLINGCONVENTION vlWorker_GetImageSync ( vlWorker_t worker)

Returns a pointer to the camera image.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker).

The worker is the owner of the image. Therefore you should not call vlDelete_ImageWrapper with the returned image as parameter.

NOTICE: This functions is experimental and might get removed in future.

Parameters
workerPointer to a Worker object.
Returns
A pointer to an ImageWrapper object, on success; NULL otherwise.

◆ vlWorker_GetNodeExtrinsicDataSync()

VL_SDK_API vlExtrinsicDataWrapper_t* VL_CALLINGCONVENTION vlWorker_GetNodeExtrinsicDataSync ( vlWorker_t worker,
const char  node[],
const char  key[] 
)

Returns a pointer to extrinsicdata with the given name from a given node.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker).

The returned ExtrinsicData has to be freed using vlDelete_ExtrinsicDataWrapper.

NOTICE: This function is experimental and might get removed in future.

Parameters
workerPointer to a Worker object.
nodeThe name of the node.
keyThe name of the exposed ExtrinsicData.
Returns
A pointer to an ExtrinsicDataWrapper object, on success; NULL otherwise.

◆ vlWorker_GetNodeImageSync()

VL_SDK_API vlImageWrapper_t* VL_CALLINGCONVENTION vlWorker_GetNodeImageSync ( vlWorker_t worker,
const char  node[],
const char  key[] 
)

Returns a pointer to the image with the given name from a given node.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker).

The returned image has to be freed using vlDelete_ImageWrapper.

NOTICE: This functions is experimental and might get removed in future.

Parameters
workerPointer to a Worker object.
nodename of the node
keyName of the exposed image
Returns
A pointer to an ImageWrapper object, on success; NULL otherwise.

◆ vlWorker_GetNodeIntrinsicDataSync()

VL_SDK_API vlIntrinsicDataWrapper_t* VL_CALLINGCONVENTION vlWorker_GetNodeIntrinsicDataSync ( vlWorker_t worker,
const char  node[],
const char  key[] 
)

Returns a pointer to IntrinsicData with the given name from a given node.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker).

The returned IntrinsicData has to be freed using vlDelete_IntrinsicDataWrapper

NOTICE: This function is experimental and might get removed in future.

Parameters
workerPointer to a Worker object.
nodeThe name of the node.
keyThe name of the exposed IntrinsicData.
Returns
A pointer to an IntrinsicData object, on success; NULL otherwise.

◆ vlWorker_IsRunning()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_IsRunning ( vlWorker_t worker)

Returns whether the thread is currently running or not.

Parameters
workerPointer to a Worker object.
Returns
true, if the thread is running; false otherwise.

◆ vlWorker_Lock()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_Lock ( vlWorker_t worker)

For testing purposed. Don't use!

◆ vlWorker_PollEvents()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_PollEvents ( vlWorker_t worker)

Calls the registered listeners for the enqueued events.

Listeners aren't called immediately from the tracking thread in order to avoid synchronisation problems. Instead this method should be called regularly from the main thread.

Parameters
workerPointer to a Worker object.
Returns
true, on success; false otherwise.

◆ vlWorker_ProcessCallbacks()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_ProcessCallbacks ( vlWorker_t worker)

Executes all enqueued callbacks.

Callbacks aren't called immediately from the tracking thread in order to avoid synchronisation problems. Instead this method should be called regularly from the main thread.

Parameters
workerPointer to a Worker object.
Returns
true, on success; false otherwise.

◆ vlWorker_ProcessJsonCommandSync()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_ProcessJsonCommandSync ( vlWorker_t worker,
const char  jsonString[],
vlCallbackJsonString  callback,
void *  clientData 
)

Processes the passed command.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker).

Parameters
workerPointer to a Worker object.
jsonStringCommand as zero terminated JSON string.
callbackCallback function, which will be called after the command was processed.
clientDataThe callback function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, if the command is supported; false, otherwise.

◆ vlWorker_PushCommand()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_PushCommand ( vlWorker_t worker,
const char  name[],
const char  parameter[],
vlCallbackBool  callback,
void *  clientData 
)

Enqueues a command for the tracking thread as zero terminated string.

The command gets processed asynchronously by the tracking thread and a callback will called once after the processing has finished.

The following tracking independent commands exist:

  • createTracker <trackingFile>: Creates a tracker from a vl-file.
  • createTrackerFromString <trackingString>: Creates a tracker from a vl-string.
  • createLineTracker <trackingFile>: Creates a model tracker.
  • runTracking: Starts the tracking.
  • pauseTracking: Stops the tracking.
  • setTargetFPS <fps>: Sets the target number of frames per seconds of the tracking thread.

The following commands exist for the model tracker:

  • resetSoft: Resets the tracking.
  • resetHard: Resets the tracking and all keyframes.
  • setInitPose: Set the initial pose. The parameter must have the following structure: t_{x} t_{y} t_{z} q_{x} q_{y} q_{z} q_{w}.
  • writeInitData: Writes the captured initialization data as file to disk. The optional parameter can be used to change the filename and path (e.g. "local_storage_dir:InitData_"). A time stamp and the file extension will be added automatically. The default value is "local_storage_dir:InitData_".
Parameters
workerPointer to a Worker object.
nameName of the command.
parameterParameter for the command. Value will be ignored, if no parameters are expected by the command.
callbackCallback function, which will be called inside vlWorker_ProcessCallbacks after the command was processed.
clientDataThe callback function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, if the command was enqueue successfully; false otherwise.
Deprecated:
Please use vlWorker_PushJsonCommand instead.

◆ vlWorker_PushJsonAndBinaryCommand()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_PushJsonAndBinaryCommand ( vlWorker_t worker,
const char  jsonString[],
const char  data[],
unsigned int  size,
vlCallbackJsonAndBinaryString  callback,
void *  clientData 
)

Enqueues a json command along with binary data for the visionLib.

The command gets processed asynchronously by the tracking thread and a callback will called once after the processing has finished.

Currently this command is used internally and will be documented in future versions. Thus it is considered as BETA!

Parameters
workerPointer to a Worker object.
jsonStringCommand as zero terminated JSON string.
dataBinary data pointer. The lifetime of the memory should be maintaned until the answer has been received. (might be 0)
sizeThe size of the content passed.
callbackCallback function, which will be called inside vlWorker_ProcessCallbacks after the command was processed.
clientDataThe callback function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, if the command was enqueue successfully; false otherwise.

◆ vlWorker_PushJsonCommand()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_PushJsonCommand ( vlWorker_t worker,
const char  jsonString[],
vlCallbackJsonString  callback,
void *  clientData 
)

Enqueues a command for the tracking thread as zero terminated JSON string.

The command gets processed asynchronously by the tracking thread and a callback will called once after the processing has finished.

The following tracking independent commands exist:

  • Create a tracker from a vl-file
    {
    "name": "createTracker",
    "param": "<trackingFile>"
    }
    The callback issued by creating a tracker passes an error and a parameter string. If the error string is NULL, then no error occurred during the initialization. Otherwise the error will contain a zero terminated JSON string, such as:
    {
    "message":"some human readable message",
    "issues":[{"error":"someString",errorCode:1,level:2}]
    }
    If something happens, that will allow the tracking to take place, but does harm the users experience no error will be returned. In this case the parameter string will NOT be NULL and will contain a zero terminated JSON string, such as:
    {
    "issues":[{"error":"someString",errorCode:1}]
    }
    The error code will always describe the same type of error. A very
    common error is for example "2", which describes a not
    found / uncalibrated camera device, which could lead to unreliable
    tracking behaviour. The developer should handle this gracefully e.g.
    by offering to calibrate the camera. The device identifier that could
    not be found is set to the error string then.
    The described behaviour is true for all commands that create a
    tracker.
    * Create a new tracker from a vl-string
    \code{.json}
    {
    "name": "createTrackerFromString",
    "param": {
    "str": "<trackingConfigurationString>",
    "fakeFilename": "<fakeFilename>"
    }
    }
  • Create a new line tracker from a tracking configuration file
    {
    "name": "createLineTracker",
    "param": "<trackingFile>"
    }
  • Create a new line tracker from a tracking configuration string
    {
    "name": "createLineTrackerFromString",
    "param": {
    "str": "<trackingConfigurationString>",
    "fakeFilename": "<fakeFilename>"
    }
    }
  • Create a new poster tracker from a tracking configuration file
    {
    "name": "createPosterTracker",
    "param": "<trackingFile>"
    }
  • Create a new poster tracker from a tracking configuration string
    {
    "name": "createPosterTrackerFromString",
    "param": {
    "str": "<trackingConfigurationString>",
    "fakeFilename": "<fakeFilename>"
    }
    }
    * Start tracking
    \code{.json}
    {
    "name": "runTracking"
    }
  • Stop tracking
    {
    "name": "pauseTracking"
    }
  • Run the tracking once
    {
    "name": "runTrackingOnce"
    }
  • Set target number of frames per seconds of the tracking thread
    {
    "name": "setTargetFPS",
    "param": <fps>
    }
  • Get the current value of a certain attribute
    {
    "name": "getAttribute",
    "param": "<attribute name>"
    }
  • Set the value of a certain attribute
    {
    "name": "setAttribute",
    "param": {
    "att": "<attribute name>",
    "val": "<attribute value>"
    }
    }

The following commands exist for the model tracker:

  • Reset the tracking
    {
    "name": "resetSoft"
    }
  • Reset the tracking and all keyframes
    {
    "name": "resetHard"
    }
  • Get the initial pose
    {
    "name": "getInitPose"
    }
  • Set the initial pose
    {
    "name": "setInitPose",
    "param": {
    "t": [x, y, z],
    "q": [x, y, z, w]
    }
    }
  • Write the captured initialization data as file to disk.
    {
    "name": "writeInitData",
    "param": "<filenamePrefix>"
    }
    "param" is optional. You can use it to change the filename and path (e.g. "param": "local_storage_dir:InitData_"). A time stamp and the file extension will be added automatically. The default value is "local_storage_dir:InitData_".
Parameters
workerPointer to a Worker object.
jsonStringCommand as zero terminated JSON string.
callbackCallback function, which will be called inside vlWorker_ProcessCallbacks after the command was processed.
clientDataThe callback function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, if the command was enqueue successfully; false otherwise.

◆ vlWorker_RemoveAnchorToWorldTransformListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveAnchorToWorldTransformListener ( vlWorker_t worker,
const char  anchorName[],
vlCallbackExtrinsicDataWrapper  listener,
void *  clientData 
)

Unregister a listener from anchor to world transform events (ExtrinsicData events) produced by a certain anchor.

Parameters
workerPointer to a Worker object.
anchorNameName of the anchor to be addressed.
listenerListener function which should be unregistered.
clientDataThe listener function will be called with the given pointer value as parameter. This can be used to invoke a member function.
Returns
true, on success; false otherwise.

◆ vlWorker_RemoveExtrinsicDataListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveExtrinsicDataListener ( vlWorker_t worker,
vlCallbackExtrinsicDataWrapper  listener,
void *  clientData 
)

Unregisters a listener from ExtrinsicData events.

Parameters
workerPointer to a Worker object.
listenerListener function which should be unregistered.
clientDataPointer value used as parameter during the registration of the listener.
Returns
true, on success; false otherwise.

◆ vlWorker_RemoveImageListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveImageListener ( vlWorker_t worker,
vlCallbackImageWrapper  listener,
void *  clientData 
)

Unregisters a listener from image events.

Parameters
workerPointer to a Worker object.
listenerListener function which should be unregistered.
clientDataPointer value used as parameter during the registration of the listener.
Returns
true, on success; false otherwise.

◆ vlWorker_RemoveIntrinsicDataListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveIntrinsicDataListener ( vlWorker_t worker,
vlCallbackIntrinsicDataWrapper  listener,
void *  clientData 
)

Unregisters a listener from IntrinsicData events.

Parameters
workerPointer to a Worker object.
listenerListener function which should be unregistered.
clientDataPointer value used as parameter during the registration of the listener.
Returns
true, on success; false otherwise.

◆ vlWorker_RemoveNamedExtrinsicDataListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveNamedExtrinsicDataListener ( vlWorker_t worker,
const char  key[],
vlCallbackExtrinsicDataWrapper  listener,
void *  clientData 
)

Unregisters a listener from named ExtrinsicData events events.

Parameters
workerPointer to a Worker object.
keyKey of the requested ExtrinsicData.
listenerListener function which should be unregistered.
clientDataPointer value used as parameter during the registration of the listener.
Returns
true, on success; false otherwise.

◆ vlWorker_RemoveNamedImageListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveNamedImageListener ( vlWorker_t worker,
const char  key[],
vlCallbackImageWrapper  listener,
void *  clientData 
)

Unregisters a listener from named image events events.

Parameters
workerPointer to a Worker object.
keyKey of the requested image.
listenerListener function which should be unregistered.
clientDataPointer value used as parameter during the registration of the listener.
Returns
true, on success; false otherwise.

◆ vlWorker_RemoveNamedIntrinsicDataListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveNamedIntrinsicDataListener ( vlWorker_t worker,
const char  key[],
vlCallbackIntrinsicDataWrapper  listener,
void *  clientData 
)

Unregisters a listener from named IntrinsicData events events.

Parameters
workerPointer to a Worker object.
keyKey of the requested IntrinsicData.
listenerListener function which should be unregistered.
clientDataPointer value used as parameter during the registration of the listener.
Returns
true, on success; false otherwise.

◆ vlWorker_RemovePerformanceInfoListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemovePerformanceInfoListener ( vlWorker_t worker,
vlCallbackZString  listener,
void *  clientData 
)

Unregisters a listener from performance info events.

Parameters
workerPointer to a Worker object.
listenerListener function which should be unregistered.
clientDataPointer value used as parameter during the registration of the listener.
Returns
true, on success; false otherwise.

◆ vlWorker_RemoveTrackingStateListener()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RemoveTrackingStateListener ( vlWorker_t worker,
vlCallbackZString  listener,
void *  clientData 
)

Unregisters a listener from tracking state events.

Parameters
workerPointer to a Worker object.
listenerListener function which should be unregistered.
clientDataPointer value used as parameter during the registration of the listener.
Returns
true, on success; false otherwise.

◆ vlWorker_RunOnceSync()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_RunOnceSync ( vlWorker_t worker)

Processes the enqueued commands and the tracking once.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker). The target number of FPS will get ignored. After calling this function you should call vlWorker_ProcessEvents and vlWorker_PollEvents to invoke callbacks and registered listeners.

Parameters
workerPointer to a Worker object.
Returns
true, on success; false, otherwise.

◆ vlWorker_SetNodeExtrinsicDataSync()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_SetNodeExtrinsicDataSync ( vlWorker_t worker,
vlExtrinsicDataWrapper_t extrinsicData,
const char  node[],
const char  key[] 
)

Sets the given extrinsicData in the given input of the given node.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker).

NOTICE: This function is experimental and might get removed in future.

Parameters
workerPointer to a Worker object.
extrinsicDataPointer to an ExtrinsicData object.
nodeThe name of the node.
keyThe name of the ExtrinsicData to set.
Returns
true, on success; false, otherwise.

◆ vlWorker_SetNodeImageSync()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_SetNodeImageSync ( vlWorker_t worker,
vlImageWrapper_t image,
const char  node[],
const char  key[] 
)

Sets the given image in the given input of the given node.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker).

NOTICE: This function is experimental and might get removed in future.

Parameters
workerPointer to a Worker object.
imagePointer to an Image object
nodename of the node
keyName of the image to set
Returns
true, on success; false, otherwise.

◆ vlWorker_SetNodeIntrinsicDataSync()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_SetNodeIntrinsicDataSync ( vlWorker_t worker,
vlIntrinsicDataWrapper_t intrinsicData,
const char  node[],
const char  key[] 
)

Sets the given IntrinsicData in the given input of the given node.

This function only works, if the Worker was created as synchronous instance (vlNew_SyncWorker).

NOTICE: This function is experimental and might get removed in future.

Parameters
workerPointer to a Worker object.
intrinsicDataPointer to an IntrinsicData object
nodeThe name of the node.
keyThe name of the IntrinsicData to set.
Returns
true, on success; false, otherwise.

◆ vlWorker_Start()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_Start ( vlWorker_t worker)

Starts the tracking thread.

Parameters
workerPointer to a Worker object.
Returns
true, on success; false otherwise.

◆ vlWorker_Stop()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_Stop ( vlWorker_t worker)

Stops the tracking thread.

Parameters
workerPointer to a Worker object.
Returns
true, on success; false otherwise.

◆ vlWorker_Unlock()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_Unlock ( vlWorker_t worker)

For testing purposed. Don't use!

◆ vlWorker_WaitEvents()

VL_SDK_API bool VL_CALLINGCONVENTION vlWorker_WaitEvents ( vlWorker_t worker,
unsigned int  timeout 
)

Waits for enqueued events and calls the registered listeners.

Listeners aren't called immediately from the tracking thread in order to avoid synchronisation problems. Instead this method should be called regularly from the main thread.

Parameters
workerPointer to a Worker object.
timeoutNumber of milliseconds before stopping to wait. Under normal circumstances this shouldn't happen, but in case something went wrong, we don't want to wait indefinitely.
Returns
true, on success or false, if there was an error while waiting for events. false is also returned, if the tracking is enabled, but timeout elapsed without an event arriving.