Head Tracker

This module calculates the predicted head's pose for a given timestamp.

Summary

It takes data from accelerometer and gyroscope sensors and uses a Kalman filter to generate the output value. The head's pose is returned as a quaternion. To have control of the usage of the sensors, this module also includes pause and resume functions.

Functions

CardboardHeadTracker_create()
Creates a new head tracker object.
CardboardHeadTracker_destroy(CardboardHeadTracker *head_tracker)
void
Destroys and releases memory used by the provided head tracker object.
CardboardHeadTracker_getPose(CardboardHeadTracker *head_tracker, int64_t timestamp_ns, float *position, float *orientation)
void
Gets the predicted head pose for a given timestamp.
CardboardHeadTracker_pause(CardboardHeadTracker *head_tracker)
void
Pauses head tracker and underlying device sensors.
CardboardHeadTracker_resume(CardboardHeadTracker *head_tracker)
void
Resumes head tracker and underlying device sensors.

Functions

CardboardHeadTracker_create

CardboardHeadTracker * CardboardHeadTracker_create()

Creates a new head tracker object.

Details
Returns
head tracker object pointer

CardboardHeadTracker_destroy

void CardboardHeadTracker_destroy(
  CardboardHeadTracker *head_tracker
)

Destroys and releases memory used by the provided head tracker object.

head_tracker Must not be null. When it is unmet, a call to this function results in a no-op.

Details
Parameters
head_tracker
Head tracker object pointer.

CardboardHeadTracker_getPose

void CardboardHeadTracker_getPose(
  CardboardHeadTracker *head_tracker,
  int64_t timestamp_ns,
  float *position,
  float *orientation
)

Gets the predicted head pose for a given timestamp.

head_tracker Must not be null. position Must not be null. orientation Must not be null. When it is unmet, a call to this function results in a no-op and default values are returned (zero values and identity quaternion, respectively).

Details
Parameters
head_tracker
Head tracker object pointer.
timestamp_ns
The timestamp for the pose in nanoseconds in system monotonic clock.
position
3 floats for (x, y, z).
orientation
4 floats for quaternion

CardboardHeadTracker_pause

void CardboardHeadTracker_pause(
  CardboardHeadTracker *head_tracker
)

Pauses head tracker and underlying device sensors.

head_tracker Must not be null. When it is unmet, a call to this function results in a no-op.

Details
Parameters
head_tracker
Head tracker object pointer.

CardboardHeadTracker_resume

void CardboardHeadTracker_resume(
  CardboardHeadTracker *head_tracker
)

Resumes head tracker and underlying device sensors.

head_tracker Must not be null. When it is unmet, a call to this function results in a no-op.

Details
Parameters
head_tracker
Head tracker object pointer.