C++ Java Unity
Java Reference
StateUpdater Class Reference

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.

Public Member Functions

boolean equals (Object obj)
State updateState ()
 Get a State instance that reflects the newest available tracking data. More...
State getLatestState ()
 Get the State as it was the last time updateState() was called. More...
double getCurrentTimeStamp ()
 Get the current time stamp. More...

Member Function Documentation

boolean equals ( Object  obj)
State updateState ( )

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.

A State instance that reflects the newest available tracking data.
State getLatestState ( )

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.

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

Get the current time stamp.

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.