# cybercoyotes/frc-examples architecture

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

- Interactive diagram: https://gitdiagram.com/cybercoyotes/frc-examples
- Repository: https://github.com/cybercoyotes/frc-examples

## Overview

##### High-Level Architecture Overview

a. Robot Framework Layer
- WPILib Command-based framework as the foundation
- WPILibNewCommands dependency (noted in vendordeps)

b. Core Robot Components Layer
- Main Robot class
- RobotContainer class (command scheduler and binding)
- Constants class

c. Subsystems Layer
- Similar subsystems across examples:
- Drive subsystems (DriveSubsystem)
- Manipulation subsystems (HatchSubsystem, ArmSubsystem, etc.)
- Sensor/Control subsystems (Elevator, Wrist, etc.)

d. Commands Layer
- Autonomous commands
- Teleop commands
- Complex command groups

##### Specific Implementation Details

a. ArmBot
- Arm and drive subsystem interaction

b. GearsBot
- Complex subsystem interaction between Claw, Drivetrain, Elevator, and Wrist
- Command sequencing for operations like Pickup and Place

c. HatchBot (Both Traditional and Inline versions)
- Demonstrate different command implementation approaches
- Command grouping for complex autonomous routines

d. RapidReactBot
- Game-specific subsystems (Intake, Shooter, Storage)
- Competition-specific command flows

##### Elements
- Command scheduler flow
- Subsystem state management
- Button binding and trigger system
- Autonomous routine composition
- Teleop control flow

##### Notes for Implementation
- Use standard UML notation where applicable
- Periodic update loops
- Default commands
- Required subsystem dependencies
- Command scheduling flow

- Command-based architecture patterns
- Subsystem independence and reusability
- Clear control flow during different robot modes
- Integration with WPILib framework
- Hardware abstraction layers

Keep the abstraction level appropriate for a principal software engineer while maintaining enough detail to understand the robot control system's architecture. Focus on showing how the command-based pattern is implemented across different robot designs while maintaining consistent architectural principles.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef framework fill:#b3d1ff,stroke:#333
    classDef core fill:#99ccff,stroke:#333
    classDef subsystem fill:#90EE90,stroke:#333
    classDef command fill:#FFE5B4,stroke:#333
    classDef config fill:#E6E6E6,stroke:#333
    classDef critical fill:#FFB6C1,stroke:#333

    %% Framework Layer
    WPILib["WPILib Command Framework"]:::framework
    click WPILib "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/vendordeps/WPILibNewCommands.json"

    %% Core Components Layer
    subgraph CoreComponents
        Robot["Main Robot Class"]:::core
        RobotContainer["Robot Container"]:::core
        Constants["Constants"]:::config
    end
    click Robot "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/Robot.java"
    click RobotContainer "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/RobotContainer.java"
    click Constants "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/Constants.java"

    %% Subsystems Layer
    subgraph GearsBot
        direction TB
        Claw["Claw Subsystem"]:::subsystem
        Drivetrain["Drivetrain Subsystem"]:::subsystem
        Elevator["Elevator Subsystem"]:::subsystem
        Wrist["Wrist Subsystem"]:::subsystem
    end
    click Claw "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/subsystems/Claw.java"
    click Drivetrain "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/subsystems/Drivetrain.java"
    click Elevator "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/subsystems/Elevator.java"
    click Wrist "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/subsystems/Wrist.java"

    subgraph RapidReact
        direction TB
        Drive["Drive Subsystem"]:::subsystem
        Intake["Intake Subsystem"]:::subsystem
        Shooter["Shooter Subsystem"]:::subsystem
        Storage["Storage Subsystem"]:::subsystem
    end
    click Drive "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-RapidReactCommandBot/src/main/java/frc/robot/subsystems/Drive.java"
    click Intake "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-RapidReactCommandBot/src/main/java/frc/robot/subsystems/Intake.java"
    click Shooter "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-RapidReactCommandBot/src/main/java/frc/robot/subsystems/Shooter.java"
    click Storage "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-RapidReactCommandBot/src/main/java/frc/robot/subsystems/Storage.java"

    %% Commands Layer
    subgraph ComplexCommands
        direction TB
        Auto["Autonomous Commands"]:::command
        ComplexAuto["Complex Auto"]:::command
        Pickup["Pickup Sequence"]:::command
        Place["Place Sequence"]:::command
    end
    click Auto "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/commands/Autonomous.java"
    click ComplexAuto "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-TradionalHatchbot/src/main/java/frc/robot/commands/ComplexAuto.java"
    click Pickup "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/commands/Pickup.java"
    click Place "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/commands/Place.java"

    subgraph DriveCommands
        direction TB
        TankDrive["Tank Drive"]:::command
        DriveStraight["Drive Straight"]:::command
        DefaultDrive["Default Drive"]:::command
    end
    click TankDrive "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/commands/TankDrive.java"
    click DriveStraight "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-GearsBot/src/main/java/frc/robot/commands/DriveStraight.java"
    click DefaultDrive "https://github.com/CyberCoyotes/FRC-Examples/blob/main/2023-TradionalHatchbot/src/main/java/frc/robot/commands/DefaultDrive.java"

    %% Relationships
    WPILib --> CoreComponents
    Robot --> RobotContainer
    RobotContainer --> Constants
    RobotContainer --> GearsBot
    RobotContainer --> RapidReact
    RobotContainer --> ComplexCommands
    RobotContainer --> DriveCommands
    
    ComplexCommands -.-> GearsBot
    DriveCommands -.-> Drivetrain
    DriveCommands -.-> Drive

    %% Legend
    subgraph Legend
        L1["Framework Component"]:::framework
        L2["Core Component"]:::core
        L3["Subsystem"]:::subsystem
        L4["Command"]:::command
        L5["Configuration"]:::config
    end
```
