# john2zy/imu-position-tracking architecture

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

- Interactive diagram: https://gitdiagram.com/john2zy/imu-position-tracking
- Repository: https://github.com/john2zy/imu-position-tracking

## Overview

##### Main Components
- Data Acquisition:
- External mobile device running the HyperIMU app as the data source.
- “data_receiver.py” module as the network interface to receive uncalibrated IMU data.

- Signal Processing & Filtering:
- Although currently not used for real-time processing, include “butter.py” (the Butterworth filter module) to illustrate a filtering option in the architecture. This shows potential flow or alternate data processing paths.

- Core Algorithm – Extended Kalman Filter (EKF):
- Use of matrix calculations and helper functions by linking in “mathlib.py”. This module is essential for the mathematical underpinnings of the EKF.

- Visualization & Prototyping:

- Documentation & External References:

##### Relationships and Data Flow
- Lastly, show the output from the EKF (position and orientation estimates) flowing into “plotlib.py” and “main.ipynb” for visualization and prototyping.

##### Architectural Patterns and Design Choices
- Modularity: Each Python module (data_receiver, main EKF, mathlib, and plotlib) represents a separable step in the processing pipeline.
- Potential for extension: Although the Butterworth filter isn’t currently in active use, its existence shows an intention to possibly integrate real-time digital filtering.
- Separation of concerns: Data acquisition, processing (filtering + EKF), mathematical computation, and visualization are clearly separated in the file structure.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Data Acquisition Group
    subgraph "Data Acquisition"
        A["HyperIMU Data Source"]:::external
        B["Data Receiver (data_receiver.py)"]:::processing
    end

    %% Processing Group
    subgraph "Processing"
        C["Optional Filter (butter.py)"]:::filtering
        D["EKF Core (main.py)"]:::algorithm
        E["Math Operations (mathlib.py)"]:::mathlib
    end

    %% Visualization Group
    subgraph "Visualization"
        F["Visualization Module (plotlib.py)"]:::visualization
        G["Prototyping Interface (main.ipynb)"]:::visualization
    end

    %% Documentation & External References Group
    subgraph "Documentation/References"
        H["Documentation (Doc)"]:::docs
        I["External References (Ref)"]:::docs
    end

    %% Connections
    A -->|"TCP_Data_Stream"| B
    B -->|"IMU_Data_Processing"| D
    B -->|"Optional_Filtering"| C
    C -->|"Filtered_Data"| D
    D -->|"Matrix_Ops"| E
    D -->|"Visual_Output"| F
    D -->|"Visual_Output"| G
    D -->|"Docs_Info"| H
    D -->|"Refs_Info"| I

    %% Click Events
    click B "https://github.com/john2zy/imu-position-tracking/blob/master/data_receiver.py"
    click C "https://github.com/john2zy/imu-position-tracking/blob/master/butter.py"
    click D "https://github.com/john2zy/imu-position-tracking/blob/master/main.py"
    click E "https://github.com/john2zy/imu-position-tracking/blob/master/mathlib.py"
    click F "https://github.com/john2zy/imu-position-tracking/blob/master/plotlib.py"
    click G "https://github.com/john2zy/imu-position-tracking/blob/master/main.ipynb"
    click H "https://github.com/john2zy/imu-position-tracking/tree/master/Doc"
    click I "https://github.com/john2zy/imu-position-tracking/tree/master/Ref"

    %% Styles
    classDef external fill:#ffd966,stroke:#333,stroke-width:2px;
    classDef processing fill:#c9daf8,stroke:#333,stroke-width:2px;
    classDef filtering fill:#f9cb9c,stroke:#333,stroke-width:2px;
    classDef algorithm fill:#d9ead3,stroke:#333,stroke-width:2px;
    classDef mathlib fill:#cfe2f3,stroke:#333,stroke-width:2px;
    classDef visualization fill:#ead1dc,stroke:#333,stroke-width:2px;
    classDef docs fill:#fff2cc,stroke:#333,stroke-width:2px;
```
