# roboloco-5338/roboloco_2024 architecture

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

- Interactive diagram: https://gitdiagram.com/roboloco-5338/roboloco_2024
- Repository: https://github.com/roboloco-5338/roboloco_2024

## Overview

##### Identify the Project Type and Purpose
- **Project Type:** This is a robotics software project, specifically tailored for a competition robot (likely within the First Robotics Competition framework).
- **Purpose:** The software controls various subsystems of the robot, including autonomous path planning, vision-based operations, swerve drive mechanics, arm shooter functionality, ground intake, and climbing mechanisms.

##### Analyze the File Structure
- **Top-Level Directories:**
- `.Glass`, `.SysId`, `.pathplanner`, `.vscode`, `.wpilib`, `src`, `vendordeps`: Indicate configurations, deployment scripts, vendor dependencies, and source code management.
- **Source Code Organization:**
- `src/main/java/frc/robot`: Contains the main robot code with subdirectories for commands and subsystems, reflecting the command-based programming model.
- `src/main/deploy`: Houses deployment scripts and path planning configurations using Choreo and Pathplanner.
- **Build and Configuration Files:**
- `build.gradle`, `gradlew`, `settings.gradle`: Utilize Gradle as the build system.
- `vendordeps`: Manages external library dependencies crucial for robot functionality.
- **Configuration Files:**
- `.wpilib/wpilib_preferences.json`, `.pathplanner/settings.json`: Store preferences and settings for WPILib and Pathplanner respectively.

##### Examine the README for Additional Insights
- **Features Highlighted:**
- Pathplanner-based autonomous operations.
- Vision-based turning mechanisms.
- Swerve drive for movement.
- Arm shooter with ground intake for game piece handling.
- Climbing hook mechanism.

###### a. **Identify the Main Components of the System**
- **Frontend (Not applicable):** As this is primarily a robot control system, frontend components are minimal or non-existent.
- **Backend Components:**
- **Subsystems:**
- **DriveSubsystem:** Manages swerve drive mechanics.
- **ArmSubsystem:** Controls the arm shooter mechanism.
- **IntakeSubsystem:** Handles ground intake operations.
- **ShooterSubsystem:** Manages the shooting functionality.
- **VisionSubsystem:** Processes vision data for turning and targeting.
- **AutoAimSubsystem:** Automates aiming based on vision inputs.
- **ClimbSubsystem (Hook for Climb):** Manages the climbing mechanism.
- **Commands:**
- **DriveCommands, ArmCommands, IntakeCommands, ShooterCommands, AutoCommands, AutoAimCommands:** Define actions for respective subsystems.
- **Deployment Components:**
- **Choreo Scripts:** Path and trajectory definitions.
- **Pathplanner Configurations:** Autonomous path planning settings.
- **External Services:**
- **Vendor Libraries:** ChoreoLib, NavX, PathplannerLib, Phoenix6, REVLib, WPILibNewCommands, PhotonLib.

###### b. **Determine the Relationships and Interactions Between Components**
- **Subsystems interact with Commands:** Commands invoke actions on subsystems to perform tasks.
- **VisionSubsystem provides data to AutoAimSubsystem:** Vision data is used to automate aiming.
- **Pathplanner and Choreo scripts define autonomous paths accessed by AutoCommands.**
- **External Libraries integrate with subsystems to provide necessary functionalities (e.g., NavX for navigation, Phoenix6 for motor controllers).**
- **Deployment scripts interact with Pathplanner and Choreo for deploying autonomous paths.**

###### c. **Highlight Important Architectural Patterns or Design Principles**
- **Command-Based Programming Model:** Separates actions (commands) from the components that perform them (subsystems), promoting modularity and reusability.
- **Modular Subsystems:** Each subsystem encapsulates specific robot functionalities, allowing for isolated development and testing.
- **Autonomous Path Planning Integration:** Utilizes Pathplanner and Choreo for defining and deploying autonomous trajectories.

###### d. **Include Relevant Technologies, Frameworks, or Libraries**
- **WPILib:** Core library for FRC robot programming.
- **Pathplanner:** Facilitates autonomous path planning.
- **Choreo:** Manages choreography scripts for complex sequences.
- **NavX:** Provides navigation and orientation data.
- **Phoenix6, REVLib, PhotonLib:** Manage motor controllers, sensors, and vision processing respectively.
- **Gradle:** Build system for managing project dependencies and build processes.

##### Elements
- **Clear Labels:** Each subsystem, command, external library, and deployment script should be distinctly labeled.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Subsystems
    subgraph "Subsystems"
        DS["DriveSubsystem"]:::subsystem
        AS["ArmSubsystem"]:::subsystem
        IS["IntakeSubsystem"]:::subsystem
        SS["ShooterSubsystem"]:::subsystem
        VS["VisionSubsystem"]:::subsystem
        AAS["AutoAimSubsystem"]:::subsystem
        CLS["ClimbSubsystem"]:::subsystem
    end

    %% Commands
    subgraph "Commands"
        DC["DriveCommands"]:::command
        AC["ArmCommands"]:::command
        IC["IntakeCommands"]:::command
        SC["ShooterCommands"]:::command
        AUTOC["AutoCommands"]:::command
        AAC["AutoAimCommands"]:::command
    end

    %% External Libraries
    subgraph "External Libraries"
        CL["ChoreoLib"]:::library
        NX["NavX"]:::library
        PL["PathplannerLib"]:::library
        PHX["Phoenix6"]:::library
        RL["REVLib"]:::library
        WPNC["WPILibNewCommands"]:::library
        PHL["PhotonLib"]:::library
    end

    %% Deployment Components
    subgraph "Deployment Components"
        CS["Choreo Scripts"]:::deployment
        PCS["Pathplanner Configurations"]:::deployment
    end

    %% Connections
    DC -->|"invokes"| DS
    AC -->|"invokes"| AS
    IC -->|"invokes"| IS
    SC -->|"invokes"| SS
    AUTOC -->|"uses"| CS
    AUTOC -->|"uses"| PCS
    AAC -->|"uses data from"| VS
    VS -->|"provides data to"| AAS

    CL -->|"used by"| CS
    NX -->|"integrates with"| DS
    PL -->|"used by"| AUTOC
    PHX -->|"integrates with"| DS
    RL -->|"integrates with"| SS
    WPNC -->|"integrates with"| DS
    PHL -->|"integrates with"| VS

    CS -->|"interacts with"| PL
    PCS -->|"interacts with"| CL

    %% Click Events
    click DS "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/subsystems/DriveSubsystem.java"
    click AS "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/subsystems/ArmSubsystem.java"
    click IS "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/subsystems/IntakeSubsystem.java"
    click SS "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/subsystems/ShooterSubsystem.java"
    click VS "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/subsystems/Vision.java"
    click AAS "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/subsystems/AutoAimSubsystem.java"
    click DC "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/commands/DriveCommands.java"
    click AC "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/commands/ArmCommands.java"
    click IC "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/commands/IntakeCommands.java"
    click SC "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/commands/ShooterCommands.java"
    click AUTOC "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/commands/AutoCommands.java"
    click AAC "https://github.com/roboloco-5338/roboloco_2024/blob/main/src/main/java/frc/robot/commands/AutoAimCommands.java"
    click CS "https://github.com/roboloco-5338/roboloco_2024/tree/main/src/main/deploy/choreo/"
    click PCS "https://github.com/roboloco-5338/roboloco_2024/tree/main/src/main/deploy/pathplanner/"
    click CL "https://github.com/roboloco-5338/roboloco_2024/blob/main/vendordeps/ChoreoLib.json"
    click NX "https://github.com/roboloco-5338/roboloco_2024/blob/main/vendordeps/NavX.json"
    click PL "https://github.com/roboloco-5338/roboloco_2024/blob/main/vendordeps/PathplannerLib.json"
    click PHX "https://github.com/roboloco-5338/roboloco_2024/blob/main/vendordeps/Phoenix6.json"
    click RL "https://github.com/roboloco-5338/roboloco_2024/blob/main/vendordeps/REVLib.json"
    click WPNC "https://github.com/roboloco-5338/roboloco_2024/blob/main/vendordeps/WPILibNewCommands.json"
    click PHL "https://github.com/roboloco-5338/roboloco_2024/blob/main/vendordeps/photonlib.json"

    %% Styles
    classDef subsystem fill:#85C1E9,stroke:#333,stroke-width:1px
    classDef command fill:#82E0AA,stroke:#333,stroke-width:1px
    classDef library fill:#F5B041,stroke:#333,stroke-width:1px
    classDef deployment fill:#A569BD,stroke:#333,stroke-width:1px

    %% Legend
    subgraph "Legend"
        S["■ Subsystems"]:::subsystem
        C["■ Commands"]:::command
        L["■ External Libraries"]:::library
        D["■ Deployment Components"]:::deployment
    end
```
