# 6-robot/robocon25_proof architecture

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

- Interactive diagram: https://gitdiagram.com/6-robot/robocon25_proof
- Repository: https://github.com/6-robot/robocon25_proof

## Overview

##### Main Components
- Simulation Environment ("robocon25_sim"):
- Contains the simulated world, robot model, and field configuration.
- Key files include the CMakeLists.txt, package.xml, and world files located under the worlds folder.
- This module is likely integrated with Gazebo or a similar simulator (common in ROS) based on the file organization (models, worlds, simulation settings).

- Localization Module ("robocon_localization"):
- Implements various localization algorithms and calibration routines.
- Contains separate nodes and launch files for routines such as calibration (calibrate_dist.launch), HSV adjustments (hsv_adjust.launch), side-line detection (loc_sidelines.launch), and re-localization (test_relocalization.launch).
- The source (src) and include directories show a clear separation between interface headers and implementation of key algorithms like distance lookup, lines mapping, and matching.
- Configuration files (dist_table.txt) and various launch files indicate different operational modes/testing setups for the localization process.

- External Tools & ROS Ecosystem:
- ROS middleware is the backbone of communication. The project uses ROS Noetic on Ubuntu 20.04.
- Additional ROS tools such as rqt_robot_steering (mentioned in the README) are used to manually steer or interface with the simulated robot.
- The README includes links to demonstration videos and tutorials which indicate that the project leverages standard ROS practices in deploying nodes, topics, and services.

##### Relationships and Interactions
- The simulation package (robocon25_sim) acts as the “world” or environment provider, running the simulated scene (field, robot models, and dynamic entities) and publishing sensor data.
- The localization package (robocon_localization) runs as a separate ROS node or set of nodes that subscribe to sensor data or simulation topics to perform calibration and localization tasks. In a typical setup, these nodes would interact via ROS topics, services, or actions.
- The launch system is used to wire these components together, specifying which nodes should run and how they interact.

##### Important Architectural Patterns and Design Principles
- Modularity & Separation of Concerns: The simulation and localization functionalities are isolated in their own packages. This separation should be highlighted by grouping them as distinct components.
- ROS-Centric Pattern: Use of launch files, package.xml, and CMakeLists.txt indicate adherence to ROS best practices. Emphasize the middleware as the integration layer.

##### Technologies and Frameworks
- ROS Noetic: All nodes communicate over ROS topics.
- Gazebo (implied): Given the simulation assets and world descriptions, it is likely that a simulation engine like Gazebo is used.
- C++ for node implementations (as seen in the “src” directory for localization).
- Additional visualization/control tools (rqt_robot_steering).

- “World Configuration” (world files, models, materials).
- “Launch Configurations” (balls.launch, field.launch).
- “Configuration & Calibration” (configuration files, calibrate_dist.launch).
- “Vision & Data Processing” (hsv_adjust.launch, localization.cpp, and related files).
f. Optionally, add blocks for additional tools (e.g., “rqt_robot_steering”) and annotate how they interact with the system.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "ROS Middleware"
        subgraph "Simulation Environment (robocon25_sim)"
            sim_world["World Configuration"]:::sim
            sim_assets["Models & Assets"]:::sim
            sim_launch["Launch Configurations"]:::sim
            sim_cmake["CMakeLists.txt"]:::sim
            sim_pkg_xml["package.xml"]:::sim
        end
        subgraph "Localization Module (robocon_localization)"
            loc_config["Configuration & Calibration"]:::loc
            loc_vision["Vision & Data Processing"]:::loc
            loc_interface["Interface & Headers"]:::loc
            loc_src["Source Code (src)"]:::loc
            loc_utility["Utility Code (src/utility)"]:::loc
            loc_cmake["CMakeLists.txt"]:::loc
            loc_pkg_xml["package.xml"]:::loc
        end
    end

    rqt["rqt_robot_steering"]:::external
    gazebo["Gazebo Simulator"]:::external

    %% Connections within Simulation Environment
    sim_launch -->|"initializes"| sim_world
    %% Data flow from Simulation to Localization
    sim_world -->|"publishesSensorData"| loc_vision
    %% Localization internal interactions
    loc_config -->|"configures"| loc_vision
    loc_src -->|"implements"| loc_vision
    loc_interface -->|"interfaces"| loc_src
    loc_utility -->|"supports"| loc_src
    %% Feedback loop from Localization back to Simulation
    loc_vision -->|"feedback"| sim_world

    %% External Tools interactions
    rqt -->|"commands"| sim_world
    gazebo -->|"renders"| sim_assets

    %% Styling Classes
    classDef sim fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef loc fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef ros fill:#FFFFE0,stroke:#000,stroke-width:2px;
    classDef external fill:#FFD700,stroke:#000,stroke-width:2px;

    %% Click Events for Simulation Environment
    click sim_world "https://github.com/6-robot/robocon25_proof/blob/main/robocon25_sim/worlds/robocon25.world"
    click sim_assets "https://github.com/6-robot/robocon25_proof/tree/main/robocon25_sim/models"
    click sim_launch "https://github.com/6-robot/robocon25_proof/tree/main/robocon25_sim/launch"
    click sim_cmake "https://github.com/6-robot/robocon25_proof/blob/main/robocon25_sim/CMakeLists.txt"
    click sim_pkg_xml "https://github.com/6-robot/robocon25_proof/blob/main/robocon25_sim/package.xml"

    %% Click Events for Localization Module
    click loc_config "https://github.com/6-robot/robocon25_proof/tree/main/robocon_localization/config"
    click loc_vision "https://github.com/6-robot/robocon25_proof/tree/main/robocon_localization/src"
    click loc_interface "https://github.com/6-robot/robocon25_proof/tree/main/robocon_localization/include"
    click loc_src "https://github.com/6-robot/robocon25_proof/tree/main/robocon_localization/src"
    click loc_utility "https://github.com/6-robot/robocon25_proof/tree/main/robocon_localization/src/utility"
    click loc_cmake "https://github.com/6-robot/robocon25_proof/blob/main/robocon_localization/CMakeLists.txt"
    click loc_pkg_xml "https://github.com/6-robot/robocon25_proof/blob/main/robocon_localization/package.xml"
```
