Introduction
OpenTrack provides a flexible plugin system that allows developers to extend functionality through three main plugin types:- Trackers: Capture head pose data from hardware devices or computer vision
- Protocols: Output tracking data to games and applications
- Filters: Process and smooth raw tracking data
Plugin Types
Tracker Plugins
Tracker plugins implement theITracker interface to provide pose data from various sources:
- Computer vision trackers (face tracking, point tracking)
- Hardware devices (VR headsets, sensor hats, joysticks)
- Network-based trackers (UDP, proprietary protocols)
- Initialize and configure tracking hardware/algorithms
- Continuously provide 6DOF pose data (X, Y, Z, Yaw, Pitch, Roll)
- Handle centering/reset operations
Protocol Plugins
Protocol plugins implement theIProtocol interface to transmit tracking data to games:
- Game-specific protocols (FreeTrack, TrackIR, FlightGear)
- Generic protocols (UDP, shared memory)
- Virtual device emulation
- Receive pose data at 250Hz
- Transform and transmit data to target applications
- Report connected game name
Filter Plugins
Filter plugins implement theIFilter interface to process tracking data:
- Smoothing filters (EWMA, Kalman)
- Motion filters (acceleration-based)
- Custom transformation pipelines
- Filter input pose data to reduce jitter
- Apply deadzone and smoothing algorithms
- Handle centering events
Core Data Types
Pose Representation
Module Status
Plugin Registration
Each plugin must implement three components:- Implementation class: Implements the interface (
ITracker,IProtocol, orIFilter) - Dialog class: Provides UI for configuration
- Metadata class: Provides name and icon
Registration Macros
Plugins are registered using macros that export the required factory functions:Metadata Interface
Dialog Base Class
ITrackerDialog, IProtocolDialog, or IFilterDialog, which extend BaseDialog.
Threading Model
Tracker Thread Safety
start_tracker(): Called from UI threaddata(): Called at ~250Hz from pipeline threadcenter(): Called from UI thread
Protocol Thread Safety
initialize(): Called from UI threadpose(): Called at 250Hz from pipeline threadgame_name(): Called from UI thread
Filter Thread Safety
initialize(): Called from UI threadfilter(): Called at 250Hz from pipeline threadcenter(): Called from UI thread
Best Practices
Performance Guidelines
Performance Guidelines
- Keep
data(),pose(), andfilter()methods fast (called at 250Hz) - Use separate threads for expensive computations
- Avoid blocking operations in data path
- Pre-allocate buffers where possible
Error Handling
Error Handling
- Return descriptive error messages from
initialize() - Use
module_status::error()for initialization failures - Log errors using
qDebug()for runtime issues - Validate all user inputs in dialog classes
Resource Management
Resource Management
- Initialize resources in
initialize()orstart_tracker() - Clean up in destructor
- Use RAII for automatic cleanup
- Release hardware devices properly
Settings Management
Settings Management
- Use
options::optsbase class for settings - Use
options::value<T>for individual settings - Connect to
bundle_::savingandbundle_::reloadingsignals - Apply settings atomically with mutex protection
Build System Integration
Plugins are built as shared libraries and must:- Link against
opentrack-apito avoid vtable errors - Export symbols using
OTR_PLUGIN_EXPORT - Be placed in the appropriate directory at runtime
Next Steps
Tracker Interface
Complete ITracker API reference
Protocol Interface
Complete IProtocol API reference
Filter Interface
Complete IFilter API reference