Device Tracking API Overview

Vuforia Engine supports device tracking and six-degrees-of-freedom movements. Using the Device Pose Observer you can track your device in relation to the environment and at the same time support extended tracking for targets.

This article describes the device pose observer API and general practice for enabling device tracking in native. For information on enabling device tracking in Unity, refer to the Device Tracking in Unity article. 

Vuforia Fusion will ensure that the device tracking is adjusted to the platform technology used (ARKit/ARCore).

General Setup

Please see the Vuforia Engine Lifecycle for a general introduction to the Vuforia Engine lifecycle. The Engine is required for creating and using Observers. 

Create a Device Pose Observer

Only a single Device Pose Observer can be active at a time. When created, it is activated by default.

// Create a Device Pose config
VuDevicePoseConfig devicePoseConfig = vuDevicePoseConfigDefault();
devicePoseConfig.activate = VU_TRUE;

// Create a Device Pose Observer
VuObserver* devicePoseObserver = { NULL };
vuEngineCreateDevicePoseObserver(engine, &devicePoseObserver, devicePoseConfig, NULL);

Observations

The Device Pose Observer produces Observations that are collected in the State. Retrieve the device pose and the pose status from an observation list.

vuObservationListCreate(&observationList);
vuStateGetDevicePoseObservations(&state, observationList);

For more information on status and status info, please refer to Status Poses and Status Info. Additionally, read Vuforia AR Continued Experiences for more information on using Device Tracking to recover from interrupted or paused AR sessions.

Destroy Device Pose Observer

Stop and destroy objects and processes after usage to free up memory.

Destroy Observer

vuObserverDestroy(devicePoseObserver);

Device Pose Reset

You can reset world tracking which will re-initialize device tracking at runtime in scenarios where a session or instruction must be repeated. When reset is called, all pose observations are reset to _NO_POSE and extended tracking is lost on all targets. If you created Anchors during the session, they will also be destroyed.

vuEngineResetWorldTracking(mEngine);

Static Device Tracking

For stationary devices, you can set a static hint for the Device Pose Observer. The hint will set the Observer in a static mode that ensures that Extended Tracking is initiated even when the device is fixed to one position. The default value is VU_FALSE. Set it to VU_TRUE to enable static device tracking.

Setting the Device Pose Observer to staticMode will reset and re-initialize the device tracking. See vuDevicePoseObserverSetStaticMode for the detailed behavior.

devicePoseConfig.staticMode = VU_TRUE;
vuDevicePoseObserverSetStaticMode(devicePoseObserver, VuBool staticMode);

Combined Poses

In use cases where you are tracking the device’s pose and a target’s pose, you can retrieve all the pose statuses from the state, even if they are different Observer types, with a simple get call:

vuObservationGetPoseInfo(const VuObservation* observation, VuPoseInfo* poseInfo);

Can this page be better?
Share your feedback via our issue tracker