# jath-alison/jathlib architecture

> Architecture diagram of the GitHub repository jath-alison/jathlib, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jath-alison/jathlib
- Repository: https://github.com/jath-alison/jathlib

## Overview

##### Main Components

a) Core Library Components (Central Layer):
- Drive System Management
- Motion Control
- Sensor Integration
- Math Utilities

b) Drive System Types (Connected Modules):
- TankDrive
- XDrive (Mecanum)
- HDrive
- AsteriskDrive

c) Tracking/Odometry Layer:
- GPSTracker
- TTracker

d) Path Planning & Automation:
- Path Management
- Macro System
- PID Controllers
- To tracking and drive systems

##### Specific Implementation Details

Create sub-sections within components showing:
- Interface classes (Drive.h, Tracker.h)
- Concrete implementations (TankDrive.h, GPSTracker.h)
- Utility classes (Vector2.h, Point.h)

##### External Integration

Integration points with:
- VEX V5 Hardware
- XML Configuration (tinyxml2)
- Logging System (CSV output)

##### Design Patterns to Highlight

- Strategy Pattern: For different drive systems
- Observer Pattern: For sensor tracking
- Factory Pattern: For drive system creation
- Template Method: For drive system behaviors

##### Additional Elements

- Configuration Management (deviceConfig.h)
- Math Utilities (MathUtils.h)
- Custom Controller Interface
- Logging System

**[Hardware Integration Layer]**
- ↕
**[Core Library Layer]**
- ↕
**[Drive Systems Layer]**
- ↕
**[Tracking/Odometry Layer]**
- ↕
**[Motion Planning Layer]**
- ↕
**[Utility Layer]**

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#b3d1ff,stroke:#333
    classDef drive fill:#90EE90,stroke:#333
    classDef tracking fill:#FFE5B4,stroke:#333
    classDef motion fill:#FFA07A,stroke:#333
    classDef utility fill:#DDA0DD,stroke:#333
    classDef hardware fill:#A9A9A9,stroke:#333
    classDef config fill:#F0E68C,stroke:#333

    %% Hardware Layer
    subgraph Hardware
        VEX["VEX V5 Hardware"]:::hardware
        XML["XML Configuration"]:::hardware
    end

    %% Core Layer
    subgraph Core
        JathCore["JathLib Core"]:::core
        Drive["Drive System Management"]:::core
        SmartDrive["Smart Drive"]:::core
    end

    %% Drive Systems Layer
    subgraph DriveSystems
        Tank["TankDrive"]:::drive
        XDrive["XDrive (Mecanum)"]:::drive
        HDrive["HDrive"]:::drive
        Asterisk["AsteriskDrive"]:::drive
    end

    %% Tracking Layer
    subgraph Tracking
        Tracker["Tracker System"]:::tracking
        GPS["GPSTracker"]:::tracking
        TTrack["TTracker"]:::tracking
    end

    %% Motion Planning Layer
    subgraph MotionPlanning
        Path["Path Management"]:::motion
        Macro["Macro System"]:::motion
        PID["PID Controllers"]:::motion
        Auton["Autonomous System"]:::motion
    end

    %% Utilities Layer
    subgraph Utilities
        MathUtils["Math Utilities"]:::utility
        Vector["Vector2"]:::utility
        Point["Point"]:::utility
        DevConfig["Device Config"]:::config
        CustomCtrl["Custom Controller"]:::config
        CustomMtr["Custom Motor"]:::config
        Logging["Logging System"]:::utility
    end

    %% Relationships
    VEX --> JathCore
    XML --> DevConfig
    JathCore --> Drive
    Drive --> SmartDrive
    SmartDrive --> Tank & XDrive & HDrive & Asterisk
    Drive --> Tracker
    Tracker --> GPS & TTrack
    Tracker --> Path
    Path --> Macro
    Macro --> PID
    PID --> Auton
    MathUtils --> Vector
    Vector --> Point
    DevConfig --> CustomCtrl & CustomMtr
    Auton --> Logging

    %% Click Events
    click Drive "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/Drive.h"
    click SmartDrive "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/SmartDrive.h"
    click Tank "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/TankDrive.h"
    click XDrive "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/XDrive.h"
    click HDrive "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/HDrive.h"
    click Asterisk "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/AsteriskDrive.h"
    click Tracker "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/Tracker.h"
    click GPS "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/GPSTracker.h"
    click TTrack "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/TTracker.h"
    click Path "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/Path.h"
    click Macro "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/Macro.h"
    click PID "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/PID.h"
    click Auton "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/Auton.h"
    click MathUtils "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/MathUtils.h"
    click Vector "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/Vector2.h"
    click Point "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/Point.h"
    click DevConfig "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/deviceConfig.h"
    click CustomCtrl "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/CustomController.h"
    click CustomMtr "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/CustomMotor.h"
    click Logging "https://github.com/Jath-Alison/Jathlib/blob/main/JathLib/include/JathLib/logging.h"
    click XML "https://github.com/Jath-Alison/Jathlib/blob/main/PathPlanner/Auton.xml"
```
