# opentrack/opentrack architecture

> Architecture diagram of the GitHub repository opentrack/opentrack, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/opentrack/opentrack
- Repository: https://github.com/opentrack/opentrack

## Overview

##### Main System Components

The system should be represented with these primary components:

a) Input Layer (Trackers):
- Hardware trackers (PS3Eye, Kinect, RealSense, etc.)
- Software trackers (Neural Network, Aruco)
- Network trackers (UDP, FreePIE)

b) Core Processing Layer:
- Data Pipeline
- Filter System
- Mapping/Translation System

c) Output Layer:
- Game Protocols (SimConnect, FreeTrack, etc.)
- Virtual Devices (Joystick)
- Network Output (UDP)

##### Architectural Patterns to Highlight

- Plugin Architecture: The system uses a modular design with separate tracker, filter, and protocol plugins
- Pipeline Pattern: For data flow from input through processing to output
- Observer Pattern: For UI updates and data monitoring

**[Input Devices] → [Input Plugins] → [Core Processing] → [Output Plugins] → [Games/Simulators]**
- ↕
- [UI System]

##### Important Details

a) Core Components:
- Plugin Management System
- Settings Management
- Data Processing Pipeline
- Filter Chain
- Coordinate System Transformation

b) Support Systems:
- Configuration Storage
- Language System (i18n)
- Camera Management
- Shared Memory Interface

##### Relationships

- Plugin loading/unloading flows
- Data transformation pipeline
- Settings persistence
- Inter-process communication
- UI feedback loops

##### Technical Implementation Details

- Qt Framework integration
- OpenCV usage for video processing
- Platform-specific implementations
- Inter-process communication mechanisms

Key Considerations:
##### Configuration and settings management flow

This will create a comprehensive visualization of opentrack's architecture while maintaining clarity and usefulness for development purposes.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        HW[Hardware Devices]
        PS3["PS3Eye Camera"]:::input
        KIN["Kinect Face"]:::input
        
        subgraph Trackers
            PT["Point Tracker"]:::input
            NN["Neural Network"]:::input
            AR["Aruco"]:::input
        end
    end
    
    subgraph Core
        PL["Main Pipeline"]:::core
        SM["Core State Management"]:::core
        WH["Work Handler"]:::core
        
        subgraph Filters
            FA["Accela Filter"]:::filter
            FE["EWMA Filter"]:::filter
            FH["Hamilton Filter"]:::filter
        end
    end
    
    subgraph Output
        FT["FreeTrack"]:::output
        FG["FlightGear"]:::output
        SC["SimConnect"]:::output
        UDP["UDP Protocol"]:::output
    end
    
    subgraph "Support Systems"
        VF["Video Framework"]:::support
        LS["Language System"]:::support
        CS["Configuration Storage"]:::support
        PV["Pose Visualization"]:::support
        CE["CSV Export"]:::support
    end
    
    subgraph "UI Layer"
        MW["Main Window"]:::ui
        OD["Options Dialog"]:::ui
        MD["Mapping Dialog"]:::ui
        SM2["Settings Management"]:::ui
    end
    
    HW --> PS3 & KIN
    PS3 & KIN --> Trackers
    PT & NN & AR --> PL
    PL --> SM --> WH
    WH --> Filters
    Filters --> Output
    FT & FG & SC & UDP --> Games[External Games/Simulators]:::external
    
    CS --> SM2
    SM2 --> MW
    MW --> OD & MD
    VF --> Trackers
    PV --> MW
    
    classDef input fill:#3498db
    classDef core fill:#2ecc71
    classDef output fill:#f1c40f
    classDef external fill:#95a5a6
    classDef ui fill:#9b59b6
    classDef filter fill:#e67e22
    classDef support fill:#34495e
    
    click PT "https://github.com/opentrack/opentrack/tree/master/tracker-pt"
    click NN "https://github.com/opentrack/opentrack/tree/master/tracker-neuralnet"
    click AR "https://github.com/opentrack/opentrack/tree/master/tracker-aruco"
    click PS3 "https://github.com/opentrack/opentrack/tree/master/video-ps3eye"
    click KIN "https://github.com/opentrack/opentrack/tree/master/tracker-kinect-face"
    click PL "https://github.com/opentrack/opentrack/blob/master/logic/pipeline.cpp"
    click SM "https://github.com/opentrack/opentrack/blob/master/logic/state.hpp"
    click WH "https://github.com/opentrack/opentrack/blob/master/logic/work.hpp"
    click FT "https://github.com/opentrack/opentrack/tree/master/proto-ft"
    click FG "https://github.com/opentrack/opentrack/tree/master/proto-flightgear"
    click SC "https://github.com/opentrack/opentrack/tree/master/proto-simconnect"
    click UDP "https://github.com/opentrack/opentrack/tree/master/proto-udp"
    click MW "https://github.com/opentrack/opentrack/blob/master/opentrack/main-window.cpp"
    click OD "https://github.com/opentrack/opentrack/blob/master/gui/options-dialog.cpp"
    click MD "https://github.com/opentrack/opentrack/blob/master/gui/mapping-dialog.cpp"
    click SM2 "https://github.com/opentrack/opentrack/blob/master/options/options.hpp"
    click VF "https://github.com/opentrack/opentrack/blob/master/video/camera.hpp"
    click LS "https://github.com/opentrack/opentrack/tree/master/api/lang"
    click CS "https://github.com/opentrack/opentrack/blob/master/options/bundle.hpp"
    click PV "https://github.com/opentrack/opentrack/blob/master/pose-widget/pose-widget.cpp"
    click CE "https://github.com/opentrack/opentrack/blob/master/csv/csv.cpp"
    click FA "https://github.com/opentrack/opentrack/tree/master/filter-accela"
    click FE "https://github.com/opentrack/opentrack/tree/master/filter-ewma2"
    click FH "https://github.com/opentrack/opentrack/tree/master/filter-hamilton"
```
