# chad9012/micro_mouse architecture

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

- Interactive diagram: https://gitdiagram.com/chad9012/micro_mouse
- Repository: https://github.com/chad9012/micro_mouse

## Overview

##### Project Type Analysis
This is a ROS2-based robotics simulation project consisting of multiple ROS2 packages that work together to create a maze-solving robot simulation environment.

##### Main Components

A. Core ROS2 Packages (represent as rectangular modules):
- maze_generator
- micro_mouse_bringup
- micro_mouse_controller
- micro_mouse_description
- micro_mouse_evaluator

B. Simulation Environment (represent as hexagons):
- Gazebo Simulator
- RViz Visualizer

C. Robot Components (represent as rounded rectangles):
- Sensors (Ultrasonic)
- Mobile Base
- Camera
- GPS

- Gazebo Simulator
- Robot Description (URDF/Xacro files)
- World Configuration

- Nodes
- Topics
- Services
- Launch Files

- Maze Generator
- Controller Logic
- Evaluator System

##### Key Relationships

- Data Flow (→): Show sensor data flow, control commands
- Dependencies (⇢): Package dependencies
- Launch Sequence (⇒): Startup flow

##### Specific Implementation Details

**┌─────────────────────┐**
- Component Name      │
- ┤
- Key Files         │
- Primary Function  │
- Interfaces        │
- ┘

##### Important Connections to Highlight

a. Maze Generation Flow:
maze_generator → maze.world.xml → Gazebo

b. Control Flow:
micro_mouse_controller → Robot Base → Sensors → Controller Logic

c. Evaluation Pipeline:
Robot Position → micro_mouse_evaluator → Performance Metrics

##### Additional Elements

- Version information and ROS2 dependency
- Configuration file relationships
- Primary data topics and their types

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#a8d1f0,stroke:#333
    classDef sim fill:#90EE90,stroke:#333
    classDef hardware fill:#FFE5B4,stroke:#333
    classDef control fill:#FFB6C1,stroke:#333
    classDef config fill:#D3D3D3,stroke:#333

    %% Hardware Simulation Layer
    subgraph SimLayer["Simulation Environment"]
        Gazebo["Gazebo Simulator"]
        RViz["RViz Visualizer"]
        World["World Configuration"]
    end

    %% Robot Components Layer
    subgraph RobotLayer["Robot Components"]
        RobotDesc["Robot Description"]
        Camera["Camera"]
        GPS["GPS"]
        MobileBase["Mobile Base"]
        Sensors["Ultrasonic Sensors"]
        GazeboBase["Gazebo Base Config"]
        CommonProps["Common Properties"]
    end

    %% ROS2 Core Components Layer
    subgraph CoreLayer["ROS2 Core Components"]
        LaunchConfig["Launch Configuration"]
        Nodes["ROS2 Nodes"]
        Topics["ROS2 Topics"]
        Services["ROS2 Services"]
    end

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        MazeGen["Maze Generator"]
        Controller["Controller System"]
        Evaluator["Evaluation System"]
    end

    %% Relationships
    MazeGen --> World
    World --> Gazebo
    Controller --> MobileBase
    Sensors --> Controller
    MobileBase --> Evaluator
    RobotDesc --> RViz
    LaunchConfig --> Gazebo
    LaunchConfig --> RViz
    Camera --> RobotDesc
    GPS --> RobotDesc
    MobileBase --> RobotDesc
    GazeboBase --> MobileBase
    CommonProps --> RobotDesc

    %% Click Events
    click MazeGen "https://github.com/chad9012/micro_mouse/blob/main/src/maze_generator/maze_generator/maze_to_xml_generator.py"
    click Controller "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_controller/micro_mouse_controller/maze_solver.py"
    click Evaluator "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_evaluator/micro_mouse_evaluator/evaluator.py"
    click RobotDesc "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_description/urdf/micro_mouse.urdf.xacro"
    click Camera "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_description/urdf/camera.xacro"
    click GPS "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_description/urdf/gps.xacro"
    click MobileBase "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_description/urdf/mobile_base.xacro"
    click World "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_bringup/worlds/maze.world.xml"
    click RViz "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_bringup/rviz/urdf_config.rviz"
    click LaunchConfig "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_bringup/launch/micro_mouse_gazebo.launch.py"
    click CommonProps "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_description/urdf/common_properties.xacro"
    click GazeboBase "https://github.com/chad9012/micro_mouse/blob/main/src/micro_mouse_description/urdf/mobile_base_gazebo.xacro"

    %% Style Applications
    class MazeGen,Controller,Evaluator control
    class Gazebo,RViz,World sim
    class RobotDesc,Camera,GPS,MobileBase,Sensors,GazeboBase,CommonProps hardware
    class LaunchConfig,Nodes,Topics,Services core
    
    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Simulation Components"]:::sim
        L3["Hardware Components"]:::hardware
        L4["Control Systems"]:::control
    end
```
