# tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot architecture

> Architecture diagram of the GitHub repository tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot
- Repository: https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot

## Overview

##### Main Components
- Simulation & Modeling Environment:
– MATLAB/Simulink components (folders for ASMC, Fuzzy, Neural Network, PID, SMC) where control algorithms are modeled and simulated.
- Embedded Controller:
– ESP32-based microcontroller firmware (the Embedded_code folder with .ino files that implement the various control strategies and sensor/actuator interactions, including code for controllers and trajectory tracking).
- Communication Interface:
– Python GUI (GUI_CAR.py) acting as the remote interface that connects via WiFi to the ESP32.
– WiFi module on ESP32 to both receive commands and send data (SSID, password configuration instructions in the README).
- Mechanical & Hardware Design:
– Solidworks design files (both 2D and 3D, assembly, parts) that represent the physical structure of the robot.
- Documentation & Validation:
– Documentation under the docs directory providing further details (e.g., control system theory, performance analysis).

##### Relationships and Data Flow
- MATLAB/Simulink “Control Algorithm Development” as a starting block, which feeds into both simulation results and serves as a testing ground before hardware integration.
- From simulation, indicate a “Control Strategy Selection” component that branches into the different controllers (PID, SMC, Fuzzy, Neural Network).
- The physical robot hardware (actuators, sensors interfaced with the microcontroller).
- The WiFi network used for remote connectivity.
- Python GUI as an external client that communicates with the ESP32 over WiFi, providing real-time kontrol, monitoring, and feedback.
- Physical design component (Solidworks) to complete the loop, showing that the mechanical design is integrated with the electronic control and simulation models.

##### Architectural Patterns & Technologies
- Separation of Concerns:
– Simulation/modeling is clearly separated from embedded implementation and the physical system.
- Modular Control Strategies:
– Each control algorithm (PID, SMC, Fuzzy, Neural Network) is developed both in simulation (MATLAB subdirectories) and implemented in embedded C code (.ino files for Arduino/ESP32).
- Integration and Communication:
– The integration layer involves translating simulated results into real-world code, while the Python GUI manages remote connectivity through WiFi.
- Key Technologies:
– MATLAB/Simulink for modeling and simulation.
– Arduino IDE (with C for the ESP32) for the embedded controller.
– Python (for GUI and network-based remote control).
– Solidworks for hardware/mechanical designs.

##### Elements
- Labeled Components:
– Each block (e.g., MATLAB/Simulink, PID Controller, SMC Controller, Fuzzy Controller, Neural Network Controller, ESP32 Embedded Unit, Python GUI, Physical Robot Hardware, Solidworks Designs, WiFi interface) should be clearly labeled.
- From simulation to embedded controller (code transfer and validation).
- From the ESP32 to sensors/actuators and to the WiFi interface.
- Between the Python GUI and the ESP32 (bidirectional communication for control commands and telemetry).
- Blue for simulation/modeling tools.
- Red for embedded/hardware control.
- Yellow/orange for middleware (communication interface such as WiFi and Python GUI).

##### Additional Detail
- Role of each control algorithm and highlight that the chosen approach in simulation is ultimately validated in practice.
- Optionally, include a “Testing & Validation” stage where simulation results and experimental data (perhaps documented in “docs”) are compared.
- Remember to denote configuration dependencies (such as the requirement to adjust WiFi SSID/password and IP address in the ESP32 code and Python script).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Simulation & Modeling Environment
    subgraph "Simulation & Modeling Environment"
        simASMC["ASMC Simulation"]:::simulation
        simFuzzy["Fuzzy Simulation"]:::simulation
        simNN["Neural Network Simulation"]:::simulation
        simPID["PID Simulation"]:::simulation
        simSMC["SMC Simulation"]:::simulation
        selection["Control Strategy Selection"]:::simulation
        codeExtract["Code Generation/Extraction"]:::simulation
    end

    %% Embedded Controller
    subgraph "Embedded Controller"
        embedded["ESP32 Embedded Unit"]:::embedded
    end

    %% Physical & Communication Interface
    subgraph "Physical & Communication Interface"
        hardware["Robot Hardware (Sensors/Actuators)"]:::hardware
        wifi["WiFi Interface"]:::communication
        gui["Python GUI"]:::communication
        solidworks["Solidworks Designs (Mechanical)"]:::hardware
        docs["Documentation & Validation"]:::docs
    end

    %% Data Flow Connections
    simASMC --> selection
    simFuzzy --> selection
    simNN   --> selection
    simPID  --> selection
    simSMC  --> selection

    selection --> codeExtract
    codeExtract --> embedded
    codeExtract --> docs

    embedded --> hardware
    embedded --> wifi

    wifi --> gui
    gui --> embedded

    hardware --> solidworks

    %% Click Events for Mapped Components
    click simASMC "https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot/tree/master/MATLAB/ASMC"
    click simFuzzy "https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot/tree/master/MATLAB/Fuzzy"
    click simNN "https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot/tree/master/MATLAB/NeuralNetwork"
    click simPID "https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot/tree/master/MATLAB/PID"
    click simSMC "https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot/tree/master/MATLAB/SMC"
    click embedded "https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot/tree/master/Embedded_code"
    click gui "https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot/blob/master/Embedded_code/GUI_CAR.py"
    click solidworks "https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot/tree/master/Solidworks"
    click docs "https://github.com/tranphuongnam2912/trajectory-tracking-of-two-wheeled-mobile-robot/tree/master/docs"

    %% Class Definitions for Colour Coding
    classDef simulation fill:#add8e6,stroke:#000,stroke-width:1px;
    classDef embedded fill:#ffcccb,stroke:#000,stroke-width:1px;
    classDef communication fill:#ffff99,stroke:#000,stroke-width:1px;
    classDef hardware fill:#90ee90,stroke:#000,stroke-width:1px;
    classDef docs fill:#d3d3d3,stroke:#000,stroke-width:1px;
```
