Skip to main content

Overview

The ITracker interface is the base class for all tracker plugins. Trackers are responsible for capturing head pose data from various sources including cameras, hardware devices, and network sources.

Interface Definition

Methods

start_tracker()

Initializes the tracker and optionally sets up video preview display.
QFrame*
Qt frame widget for displaying video preview. Can be nullptr if no preview needed.
module_status
Returns status_ok() on success, or error(message) on failure.
Description:
  • Called once when tracking is started
  • Initialize hardware, open cameras, start threads
  • Set up video preview widget if frame is provided
  • Return error status if initialization fails
Example implementation:

data()

Provides current head pose data to the tracking pipeline.
double*
Output array of 6 doubles: [TX, TY, TZ, Yaw, Pitch, Roll]. Must be filled by implementation.
This method is called approximately 250 times per second. Keep it fast and non-blocking.
Description:
  • Called at ~250Hz from the tracking pipeline thread
  • Fill the data array with current pose
  • Use mutex protection for thread-safe access
  • Don’t perform heavy computation here
  • Use a background thread for processing
Coordinate system:
  • TX (data[0]): X translation in centimeters (left: negative, right: positive)
  • TY (data[1]): Y translation in centimeters (down: negative, up: positive)
  • TZ (data[2]): Z translation in centimeters (backward: negative, forward: positive)
  • Yaw (data[3]): Rotation around Y axis in degrees (left: negative, right: positive)
  • Pitch (data[4]): Rotation around X axis in degrees (down: negative, up: positive)
  • Roll (data[5]): Rotation around Z axis in degrees (left: negative, right: positive)
Example implementation:

center()

Called when the user requests to center/reset tracking.
bool
  • true: Use current pose as center (identity transform)
  • false: Use default center behavior (current pose as offset)
Description:
  • Called from UI thread when user presses center hotkey
  • Store current pose as center reference
  • Return false to use default centering (recommended)
  • Return true to make identity the center pose
Example implementation:

status_ok() and error()

Helper methods to create module status objects.
const QString&
Error message to display to user
Example:

Dialog Interface

register_tracker()

Receives a pointer to the active tracker instance.
ITracker*
Pointer to the running tracker instance. Can be nullptr.
Description:
  • Called from UI thread when tracker starts
  • Store pointer for runtime interaction (if needed)
  • Can query tracker state or update preview
  • Default implementation does nothing
Example:

unregister_tracker()

Called when tracker is about to be destroyed. Description:
  • Clear any stored tracker pointers
  • Stop accessing tracker data
  • Default implementation does nothing
Example:

Complete Example

Threading Best Practices

See Also