# canyon-robotics-the-misfits/lib15442c architecture

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

- Interactive diagram: https://gitdiagram.com/canyon-robotics-the-misfits/lib15442c
- Repository: https://github.com/canyon-robotics-the-misfits/lib15442c

## Overview

##### Main Component Layers (Top to Bottom)

a. Application Layer (Top)
- How external VEX robot applications would interface with the library
- Entry points through the main API headers

b. Core Library Components (Middle)
- Into distinct functional modules:
- Chassis Control Module
- Motion Control Module
- Device Management Module
- Math Utilities Module
- Trajectory Planning Module
- Sensor Integration Module

c. Hardware Abstraction Layer (Bottom)
- PROS Framework Integration
- VEX Hardware Interface

##### Component Details and Relationships

a. Chassis Control Module (lib15442c/chasis)
- Drive Controller
- Tank Drive Implementation
- Odometry Systems (Multiple implementations)
- Monte Carlo Localization
- To Motion Control Module

b. Motion Control Module (lib15442c/motion)
- PID Controllers
- RAMSETE Controller
- Drive-to Behaviors
- Motion Primitives
- To Trajectory Module

c. Device Management Module (lib15442c/device)
- Motor Abstractions
- Pneumatic Control
- Sensor Management
- To Hardware Layer

d. Math Utilities Module (lib15442c/math)
- Angle Management
- Vector Operations
- Pose Calculations
- Used by all other modules

e. Trajectory Module (lib15442c/trajectory)
- Trajectory Generation
- Path Planning
- Cubic Hermite Splines
- To Motion Control

##### Important Details

a. Three main odometry implementations:
- Tracking wheels
- GPS sensor
- Monte Carlo localization

b. Motion control hierarchy:
- High-level trajectory planning
- Mid-level motion algorithms
- Low-level motor control

c. Math utilities as a shared resource

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef api fill:#9370DB,stroke:#333,stroke-width:2px
    classDef core fill:#4682B4,stroke:#333,stroke-width:2px
    classDef utility fill:#98FB98,stroke:#333,stroke-width:2px
    classDef hardware fill:#FFD700,stroke:#333,stroke-width:2px
    classDef external fill:#FFA500,stroke:#333,stroke-width:2px

    %% Application Layer
    API[API Entry Point]:::api
    click API "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/api.hpp"
    Logger[Logger System]:::utility
    click Logger "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/logger.hpp"

    %% Core Modules
    subgraph CoreModules[Core Library Components]
        ChassisControl[Chassis Control Module]:::core
        click ChassisControl "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/tree/main/include/lib15442c/chasis/"
        MotionControl[Motion Control Module]:::core
        click MotionControl "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/tree/main/include/lib15442c/motion/"
        DeviceManagement[Device Management Module]:::core
        click DeviceManagement "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/tree/main/include/lib15442c/device/"
        TrajectoryModule[Trajectory Module]:::core
        click TrajectoryModule "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/tree/main/include/lib15442c/trajectory/"
    end

    %% Chassis Control Components
    subgraph ChassisComponents[Chassis Components]
        DriveController[Drive Controller]:::core
        click DriveController "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/chasis/drive_controller.hpp"
        TankDrive[Tank Drive]:::core
        click TankDrive "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/chasis/tank_drive.hpp"
        Odometry[Odometry Systems]:::core
        click Odometry "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/chasis/odometry.hpp"
        MonteCarlo[Monte Carlo Localization]:::core
        click MonteCarlo "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/src/lib15442c/chasis/monte_carlo.cpp"
    end

    %% Motion Control Components
    subgraph MotionComponents[Motion Components]
        PIDController[PID Controller]:::core
        click PIDController "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/controller/pid.hpp"
        RAMSETE[RAMSETE Controller]:::core
        click RAMSETE "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/motion/ramsete.hpp"
        DriveTo[Drive-to Behaviors]:::core
        click DriveTo "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/motion/drive_to.hpp"
        MotionPrimitives[Motion Primitives]:::core
        click MotionPrimitives "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/motion/motion.hpp"
    end

    %% Math Utilities
    subgraph MathUtils[Math Utilities]
        AngleManagement[Angle Management]:::utility
        click AngleManagement "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/math/angle.hpp"
        VectorOps[Vector Operations]:::utility
        click VectorOps "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/math/vector.hpp"
        PoseCalc[Pose Calculations]:::utility
        click PoseCalc "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/math/pose.hpp"
    end

    %% Hardware Layer
    subgraph HardwareLayer[Hardware Abstraction Layer]
        PROS[PROS Framework]:::external
        VEXHardware[VEX Hardware Interface]:::hardware
        Motors[Motor Control]:::hardware
        click Motors "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/device/motor.hpp"
        Pneumatics[Pneumatic Control]:::hardware
        click Pneumatics "https://github.com/Canyon-Robotics-The-Misfits/lib15442c/blob/main/include/lib15442c/device/pneumatic.hpp"
    end

    %% Relationships
    API --> ChassisControl
    API --> MotionControl
    API --> DeviceManagement
    API --> TrajectoryModule
    
    ChassisControl --> ChassisComponents
    MotionControl --> MotionComponents
    
    ChassisControl --> MotionControl
    MotionControl --> TrajectoryModule
    DeviceManagement --> HardwareLayer
    
    MathUtils --> ChassisControl
    MathUtils --> MotionControl
    MathUtils --> TrajectoryModule
    
    Logger --> ChassisControl
    Logger --> MotionControl
    Logger --> DeviceManagement
    
    PROS --> VEXHardware
    VEXHardware --> Motors
    VEXHardware --> Pneumatics

    %% Legend
    subgraph Legend
        L1[API Components]:::api
        L2[Core Components]:::core
        L3[Utility Components]:::utility
        L4[Hardware Components]:::hardware
        L5[External Systems]:::external
    end
```
