# ayaancdry/agribot architecture

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

- Interactive diagram: https://gitdiagram.com/ayaancdry/agribot
- Repository: https://github.com/ayaancdry/agribot

## Overview

##### Project type and purpose
- This is a ROS-based robotics workstation (“Agribot”): a full-stack robotics software stack combining simulation (Gazebo/ROS), perception (YOLO object detection), and control (pot follower).
- The top-level “src” hosts multiple ROS2 packages:
- sim_bot (robot simulation),
- sim_lobby_classic (environment/world),
- yolo_msgs (custom ROS message definitions),
- yolo_ros & yolo_bringup (YOLO inference nodes & launch),
- pot_follower (control node reacting to detections).

##### File structure
- src/… directories correspond to ROS2 packages, each with package.xml, setup.py, and Python/CMake code under src.
- build/ and install/ are Colcon workspaces artifacts.
- custom_yolo_models/ holds ML weights.
- runs/ and train_pot_detector.py for offline training.
- ROS launch files in each package’s launch/ or share/…/launch define how to spin up nodes and Gazebo worlds.
- yolo_msgs defines the message schema for detection data shared across nodes.

##### README
- Minimal description indicates this is the “Agribot” workstation. We infer the stack runs end-to-end: simulated sensors → YOLO detection → control logic → simulated actuation.

##### Elements
- “Gazebo Simulator” (with Camera & Robot model plugins).
- “sim_lobby_classic” world loader.
- YOLO Processing Nodes (yolo_node, detect_3d_node, tracking_node).
- “yolo_msgs” interface block.
- “pot_follower_node”.
- “custom_yolo_models” weights.
- Image → YOLO Nodes.
- DetectionArray → pot_follower.
- Twist → Gazebo for robot motion.
- Green for simulation components.
- Blue for perception components.
- Orange for control components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Simulation Environment
    subgraph "Simulation Environment"
        SimModel["sim_bot package"]:::sim
        SimWorld["lobby_classic.launch.py"]:::sim
        WorldFile["lobby_with_pots.world"]:::sim
        Gazebo["Gazebo Simulator<br/>(Camera & Robot Plugins)"]:::sim
    end

    %% Perception Stack
    subgraph "Perception Stack"
        subgraph "YOLO Inference Nodes"
            YN1["yolo_node"]:::percep
            YN2["detect_3d_node"]:::percep
            YN3["tracking_node"]:::percep
            YN4["debug_node"]:::percep
        end
        subgraph "Perception Bringup"
            Bringup["yolo_bringup Launch"]:::percep
        end
    end

    yoloMsgs["yolo_msgs<br/>(Detection Interfaces)"]:::msg

    %% Control Stack
    subgraph "Control Stack"
        PotFollow["pot_follower_node"]:::control
    end

    %% External Assets
    Model["flower_pot_detector.pt"]:::cloud
    Train["train_pot_detector.py"]:::training
    Runs["runs/detect/flower_pot_detector/"]:::training

    %% Data Flows
    Gazebo -->|"sensor_msgs/Image"| YN1
    Bringup --> YN1
    Bringup --> YN2
    Bringup --> YN3
    Bringup --> YN4
    Model --> YN1
    YN1 -->|"yolo_msgs/DetectionArray"| yoloMsgs
    yoloMsgs -->|"yolo_msgs/DetectionArray"| PotFollow
    PotFollow -->|"geometry_msgs/Twist"| Gazebo
    SimModel --> Gazebo
    SimWorld --> Gazebo
    WorldFile --> SimWorld

    %% Click Events
    click SimModel "https://github.com/ayaancdry/agribot/tree/main/src/sim_bot"
    click SimWorld "https://github.com/ayaancdry/agribot/blob/main/src/sim_lobby_classic/launch/lobby_classic.launch.py"
    click WorldFile "https://github.com/ayaancdry/agribot/blob/main/src/sim_lobby_classic/worlds/lobby_with_pots.world"
    click YN1 "https://github.com/ayaancdry/agribot/blob/main/src/yolo_ros/yolo_ros/yolo_node.py"
    click YN2 "https://github.com/ayaancdry/agribot/blob/main/src/yolo_ros/yolo_ros/detect_3d_node.py"
    click YN3 "https://github.com/ayaancdry/agribot/blob/main/src/yolo_ros/yolo_ros/tracking_node.py"
    click YN4 "https://github.com/ayaancdry/agribot/blob/main/src/yolo_ros/yolo_ros/debug_node.py"
    click Bringup "https://github.com/ayaancdry/agribot/tree/main/build/yolo_bringup/share/yolo_bringup/launch"
    click yoloMsgs "https://github.com/ayaancdry/agribot/tree/main/build/yolo_msgs/rosidl_adapter/yolo_msgs/msg"
    click PotFollow "https://github.com/ayaancdry/agribot/blob/main/src/pot_follower/pot_follower/pot_follower_node.py"
    click Train "https://github.com/ayaancdry/agribot/blob/main/train_pot_detector.py"
    click Model "https://github.com/ayaancdry/agribot/blob/main/custom_yolo_models/flower_pot_detector.pt"
    click Runs "https://github.com/ayaancdry/agribot/tree/main/runs/detect/flower_pot_detector/"

    %% Styles
    classDef sim fill:#e0f7e9,stroke:#0f0;
    classDef percep fill:#e0e7ff,stroke:#00f;
    classDef control fill:#ffe7d7,stroke:#f60;
    classDef msg fill:#cccccc,stroke:#666;
    classDef cloud fill:#eeeeee,stroke:#aaa;
    classDef training fill:#f0f0f0,stroke:#888;
```
