# hectoralonso18/lightninglib architecture

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

- Interactive diagram: https://gitdiagram.com/hectoralonso18/lightninglib
- Repository: https://github.com/hectoralonso18/lightninglib

## Overview

##### Main Components Identification

The system should be divided into these key components:

a) Core Library Components:
- Motion Control System
- Odometry System
- Task Management System
- Math Utilities
- Path Planning System

b) External Tools:
- Python Utilities (LightningPlanner)
- Documentation System

##### Component Relationships

**┌─────────────────────────────────────────────────────────┐**
- Application Layer                       │
- ┌─────────────┐  ┌─────────────┐   ┌──────────────┐   │
- Main Robot  │  │  Autonomous │   │   Teleop     │   │
- Application │  │  Routines   │   │  Operations  │   │
- ┘  └─────────────┘   └──────────────┘   │
- ┤
- Lightning Core                         │
- ┌──────────┐ ┌────────────┐ ┌────────────────────┐   │
- PID    │ │ Pure       │ │    Motion          │   │
- Control  │ │ Pursuit    │ │    Profiles        │   │
- ┘ └────────────┘ └────────────────────┘   │
- ┌──────────┐ ┌────────────┐ ┌────────────────────┐   │
- Odometry │ │ Path       │ │    Task            │   │
- Tracking │ │ Planning   │ │    Management      │   │
- ┘ └────────────┘ └────────────────────┘   │
- ┤
- Hardware Abstraction Layer              │
- ┌──────────┐ ┌────────────┐ ┌────────────────────┐   │
- Motors   │ │ Sensors    │ │    Display         │   │
- Control  │ │ Interface  │ │    Interface       │   │
- ┘ └────────────┘ └────────────────────┘   │
- ┘

##### External Tools Integration

**┌────────────────────┐      ┌─────────────────┐**
- LightningPlanner  │─────▶│  Main System    │
- (Python Utility)  │      │  Path Planning  │
- ┘      └─────────────────┘

##### Component Details

For each major component, include:
- Input/Output relationships
- Dependencies
- Key classes (from the include/lightninglib directory)
- Communication protocols

##### Implementation Notes

- Version numbers for major components
- Notes about multithreading capabilities

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef external fill:#2ecc71,stroke:#27ae60,color:white
    classDef hardware fill:#f1c40f,stroke:#f39c12,color:black
    classDef support fill:#95a5a6,stroke:#7f8c8d,color:white
    
    %% Application Layer
    subgraph Application
        MA[Main Robot Application]
        AR[Autonomous Routines]
        TO[Teleop Operations]
    end
    
    %% Lightning Core Layer
    subgraph Core
        %% Motion Control
        PID["PID Control"]:::core
        PP["Pure Pursuit"]:::core
        MP["Motion Profiles"]:::core
        FF["Feed Forward"]:::core
        
        %% Odometry & Planning
        OT["Odometry Tracking"]:::core
        PP2["Path Planning"]:::core
        
        %% Task Management
        TM["Task Management"]:::core
        
        %% Math & Utilities
        MU["Math Utilities"]:::core
        UT["Utilities"]:::core
        
        %% Core API
        API["Lightning API"]:::core
    end
    
    %% Hardware Layer
    subgraph Hardware
        MC["Motors Control"]:::hardware
        SI["Sensors Interface"]:::hardware
        DI["Display Interface"]:::hardware
        TC["Tank Chassis"]:::hardware
    end
    
    %% External Tools
    subgraph External
        LP["LightningPlanner"]:::external
        WS["Waypoints Storage"]:::external
    end
    
    %% Relationships
    MA --> API
    AR --> API
    TO --> API
    
    API --> PID
    API --> PP
    API --> MP
    API --> FF
    API --> OT
    API --> PP2
    API --> TM
    
    PID --> TC
    PP --> TC
    MP --> TC
    FF --> TC
    
    TC --> MC
    TC --> SI
    
    LP --> PP2
    LP --> WS
    
    %% Click events
    click PID "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/PID.hpp"
    click PP "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/PurePursuit.hpp"
    click MP "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/Trapezoidal.hpp"
    click FF "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/FeedForward.hpp"
    click OT "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/Odom_tracker.hpp"
    click PP2 "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/Path.hpp"
    click TM "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/TasksCreator.hpp"
    click MU "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/Math.h"
    click UT "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/util.hpp"
    click TC "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/TankChassis.hpp"
    click LP "https://github.com/HectorAlonso18/Lightninglib/blob/main/python_utilities/LightningPlanner/lightning_planner.py"
    click WS "https://github.com/HectorAlonso18/Lightninglib/tree/main/python_utilities/LightningPlanner/Lightning-waypoints"
    click API "https://github.com/HectorAlonso18/Lightninglib/blob/main/include/lightninglib/lightning_api.h"

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["External Tools"]:::external
        L3["Hardware Components"]:::hardware
        L4["Support Systems"]:::support
    end
```
