C++ Java Unity
C++ Reference
StateUpdater Class Referenceabstract

Detailed Description

Provides State instances on-demand.

Use the StateUpdater instance provided at TrackerManager::getStateUpdater() to request the latest available data for all configured trackers, decoupled from the update rate of the camera. (For comparison, the UpdateCallback mechanism is synchronous with the update rate of the camera.)

Typically, if you call updateState() multiple times during a single camera frame, the TrackableResult instances available on the returned State objects will not change.

However, some Tracker types implement predictive tracking and/or use data that does not come from the camera (such as a DeviceTracker that tracks a VR headset's position and orientation at high frequency). If you have configured any such trackers, the State instances provided by updateState() may include updated TrackableResult instances reflecting updated predictions or non-camera tracking data that are newer than the camera frame.

Inheritance diagram for StateUpdater:
NonCopyable

Public Member Functions

virtual State updateState ()=0
 Get a State instance that reflects the newest available tracking data. More...
 
virtual State getLatestState () const =0
 Get the State as it was the last time updateState() was called. More...
 
virtual double getCurrentTimeStamp () const =0
 Get the current time stamp. More...
 

Member Function Documentation

virtual State updateState ( )
pure virtual

Get a State instance that reflects the newest available tracking data.

The returned State includes results from all configured Tracker instances.

It may contain TrackableResults that are newer than the latest camera frame for

  • trackers that do not rely on camera frames (typically DeviceTracker instances such as VR headset pose trackers), or
  • trackers that use predictive models.

This can be useful when the required update rate is higher than the camera frame acquisition rate, such as VR applications or AR on see-through eyewear devices, where visuals must be tightly synchronized to the user's movement, rather than to a rendered video background.

Returns
A State instance that reflects the newest available tracking data.
virtual State getLatestState ( ) const
pure virtual

Get the State as it was the last time updateState() was called.

When updateState() is called, the State instance is cached. getLatestState() provides access to this cached State. If updateState() has not yet been called, this method will return an empty State.

Note that updateState() is called internally when you call Renderer::begin(const RenderData*), which may cause getLatestState() to unexpectedly return different results. To prevent this from happening, obtain a State yourself and call Renderer::begin(State, const RenderData*) instead.

Returns
A State instance that references that same tracking results as the last State instance returned by updateState().
virtual double getCurrentTimeStamp ( ) const
pure virtual

Get the current time stamp.

Returns
The current time stamp, in the units and frame of reference for the returned time stamp are the same as for the TrackableResult and Frame instances that can be obtained from a State instance.