# bytesizedrobotics/autonomous-navigation architecture

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

- Interactive diagram: https://gitdiagram.com/bytesizedrobotics/autonomous-navigation
- Repository: https://github.com/bytesizedrobotics/autonomous-navigation

## Overview

##### Main Components
- SENSORS & DATA SOURCES:
– Lidar Sensors: Leveraged via the packages “rplidar_ros”, “lidar_testing”, and the Lidar-related configurations in “obstacle_detection”.
– Camera: Managed by the “csi_camera_stream” package for capturing and streaming video, with additional inference (using a best.pt model) capabilities.
– GPS/Navigation: Provided by the “nmea_navsat_driver-ros2” package which parses NMEA data from various drivers (serial, socket, TCP-client).
– Additional: “pothole_detection” for surface condition monitoring and “wave_rover_serial_control” for controlling the robotic platform via serial commands.

##### Components by Function
- SENSOR INTERFACE LAYER:
– All packages that directly interface with hardware (rplidar_ros, csi_camera_stream, nmea_navsat_driver-ros2) fall into this layer.

- PERCEPTION & PROCESSING LAYER:
– “obstacle_detection” processes Lidar inputs to detect obstacles.
– “lidar_testing” can be seen as a verification component to check sensor outputs.
– “pothole_detection” leverages image or sensor data (note the presence of a model file and testing scripts) for detecting road surface issues.

- CONTROL & ACTUATION LAYER:
– “wave_rover_serial_control” handles the drive commands and possibly other actuation signals based on the processed data.
– Although future plans include path planning (per the roadmap), the current focus is on sensing and basic obstacle detection.

- INFRASTRUCTURE:
– ROS2 launch files across multiple packages manage node initialization and topic setup.
– Shared configuration files (e.g., YAML files in “config”) ensure consistency across nodes.

##### Relationships and Data Flow
- Processed data (such as detected obstacles) then flows to the control layer, which instructs the rover’s movement via the serial control node.
- External dependencies, such as physical sensors and the ROS2 message passing system, that integrate all these components.

##### Architectural Patterns and Design Principles
- MODULAR DESIGN: Each ROS2 package is self-contained – note the structure with dedicated src, launch, config, and test directories, which promotes reusability and independence.
- SEPARATION OF CONCERNS: Sensors, processing, and control logic are separated in different packages.
- EXTENSIBILITY: The roadmap shows plans for additional functionalities (path planning) indicating the system is designed to evolve by adding new modules.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Orchestration Layer
    subgraph "Orchestration"
        E["Orchestration / Entry Point (batch_run.py)"]:::entry
    end

    %% Sensor Interface Layer
    subgraph "Sensor Interface Layer"
        L["Lidar Sensor Node (rplidar_ros)"]:::sensor
        C["Camera Streamer (csi_camera_stream)"]:::sensor
        G["GPS Driver Node (nmea_navsat_driver-ros2)"]:::sensor
    end

    %% Perception & Processing Layer
    subgraph "Perception & Processing Layer"
        O["Obstacle Detection Processing (obstacle_detection)"]:::processing
        LT["Lidar Testing & Verification (lidar_testing)"]:::processing
        P["Pothole Detection (pothole_detection)"]:::processing
    end

    %% Control & Actuation Layer
    subgraph "Control & Actuation Layer"
        R["Rover Control Node (wave_rover_serial_control)"]:::control
    end

    %% Infrastructure
    subgraph "Infrastructure"
        RI["ROS2 Messaging / Launch System"]:::infra
    end

    %% Orchestration arrows (entry launches all nodes)
    E --> L
    E --> C
    E --> G
    E --> O
    E --> LT
    E --> P
    E --> R

    %% Sensor data flows to processing
    L -->|"sends_data"| O
    L -->|"sends_data"| LT
    C -->|"sends_video"| P
    G -->|"sends_location"| O

    %% Processing outputs command Control
    O -->|"commands"| R
    LT -->|"verifies"| R
    P -->|"alerts"| R

    %% Infrastructure communicates with all nodes (dashed arrows)
    RI -.-> L
    RI -.-> C
    RI -.-> G
    RI -.-> O
    RI -.-> LT
    RI -.-> P
    RI -.-> R

    %% Class Styles
    classDef sensor fill:#A3E4D7,stroke:#1ABC9C,stroke-width:2px;
    classDef processing fill:#F9E79F,stroke:#F1C40F,stroke-width:2px;
    classDef control fill:#F5B7B1,stroke:#E74C3C,stroke-width:2px;
    classDef entry fill:#D6EAF8,stroke:#3498DB,stroke-width:2px;
    classDef infra fill:#D2B4DE,stroke:#8E44AD,stroke-width:2px;

    %% Click Events
    click L "https://github.com/bytesizedrobotics/autonomous-navigation/tree/main/rplidar_ros"
    click LT "https://github.com/bytesizedrobotics/autonomous-navigation/tree/main/lidar_testing"
    click O "https://github.com/bytesizedrobotics/autonomous-navigation/tree/main/obstacle_detection"
    click C "https://github.com/bytesizedrobotics/autonomous-navigation/tree/main/csi_camera_stream"
    click G "https://github.com/bytesizedrobotics/autonomous-navigation/tree/main/nmea_navsat_driver-ros2"
    click P "https://github.com/bytesizedrobotics/autonomous-navigation/tree/main/pothole_detection"
    click R "https://github.com/bytesizedrobotics/autonomous-navigation/tree/main/wave_rover_serial_control"
    click E "https://github.com/bytesizedrobotics/autonomous-navigation/blob/main/batch_run.py"
```
