Overview
TheIFilter interface is the base class for all filter plugins. Filters process raw tracking data to reduce jitter, apply smoothing, implement deadzones, and perform other transformations before the data reaches the output protocol.
Interface Definition
Methods
initialize()
module_status
Returns
status_ok() on success, or error(message) on failure.- Called once when the filter is created
- Validate settings and parameters
- Initialize internal state, buffers, or data structures
- Usually just returns
status_ok()
filter()
const double*
Input pose array:
[TX, TY, TZ, Yaw, Pitch, Roll] in cm/degreesdouble*
Output pose array to fill with filtered data in same format
- Called at 250Hz from tracking pipeline thread
- Read from
inputarray, write tooutputarray - Apply smoothing, deadzone, or other transformations
- Manage your own timing (dt) if needed
- Don’t block or perform heavy computation
input[TX]: X translation in centimetersinput[TY]: Y translation in centimetersinput[TZ]: Z translation in centimetersinput[Yaw]: Yaw rotation in degrees (-180 to 180)input[Pitch]: Pitch rotation in degrees (-90 to 90)input[Roll]: Roll rotation in degrees (-180 to 180)
center()
- Called from UI thread when center hotkey pressed
- Reset internal filter state if needed
- Clear history buffers
- Default implementation does nothing
Dialog Interface
register_filter()
IFilter*
Pointer to the running filter instance
- Called from UI thread when filter starts
- Store pointer for runtime interaction (optional)
- Usually implemented as empty function
unregister_filter()
Complete Example
Common Filter Patterns
Low-Pass Filter (Smoothing)
Low-Pass Filter (Smoothing)
Reduces high-frequency jitter using exponential moving average.
Deadzone Filter
Deadzone Filter
Ignores small movements to reduce micro-jitter.
Acceleration-Based Filter
Acceleration-Based Filter
Applies more smoothing when moving slowly, less when moving fast.
Kalman Filter
Kalman Filter
Optimal estimator combining measurements with predictions.
Handling Rotation Wrap-Around
Problem: Rotation values jump from 179° to -179° when crossing the boundary. Solution: Detect and handle wrap-around when computing deltas.Time Management
Filters often need accurate time measurement for velocity-based algorithms:Performance Tips
Avoid Dynamic Allocations
Avoid Dynamic Allocations
Use Efficient Math
Use Efficient Math
Minimize Conditionals
Minimize Conditionals
See Also
- Tracker Interface - Capture tracking data
- Protocol Interface - Output tracking data
- Metadata - Plugin metadata requirements