# mushibo/micro-wheeled_leg-robot architecture

> Architecture diagram of the GitHub repository mushibo/micro-wheeled_leg-robot, 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/mushibo/micro-wheeled_leg-robot
- Repository: https://github.com/mushibo/micro-wheeled_leg-robot

## Overview

##### And Separate the Main Components
- Mechanical Structure: Represent the overall robot body. This includes:
- The original robot CAD model (OriginalRobotModel.stp).
- The produced parts (divided into 3D printed components, CNC-machined parts, and carbon fiber panels under "1.RobotModel/Parts-Manufactured").
- Purchased components (listed under "1.RobotModel/Parts-Purchased").

- PCB and Hardware Modules: Map out each major PCB and electronics component:
- Control Board: Main controller based on ESP32.
- Encoder Board: Featuring the AS5600 encoder.
- IMU Board: Using the MPU6050 module.
- Servo Debug Board.
- Details such as associated schematic files, Gerber files, and BOM information under "2.Hardware".

- Embedded Software:
- The firmware running on the ESP32 based on Arduino IDE.
- Motor control firmware using simpleFOC for driving the brushless motors.
- The web server and WebSocket communication; note the dual WiFi modes (AP and STA) and remote control interface details.
- Even if the "3.Software" directory isn’t fully visible in the file tree provided, mention where libraries such as WebSocket are referenced.

- Documentation and Visual References:

##### Relationships and Data Flows
- The Mechanical Assembly (robot chassis and manufactured parts).
- The Electronics subsystem (with its sub-blocks for each PCB module).
- The Software module (firmware, motor control, WiFi communication, web interface).

- Data and power flow between the ESP32 and each PCB (communication over I2C for both the encoder and IMU, serial communication for the servo debug board, etc.).
- Control signals from the integrated software (executing motor control using simpleFOC) interacting with the hardware.
- User input coming from the web-based remote control interface that communicates with the ESP32 over WiFi/WebSocket.

##### Architectural Patterns and Design Choices
- Integration of hardware and embedded software:
- Modular design of the PCB components (controller, encoder, IMU, servo debug) with dedicated source and schematic files.
- Use of off-the-shelf libraries and tools (Arduino IDE, simpleFOC, WebSocket library).

- Design’s distributed aspects: the separation between the physical (mechanical and electronic) components and the software control layers.

- Mention notable design principles such as modularity (mechanical parts segregated into manufactured and purchased), and layered communication (physical sensor data, processing on the ESP32, and remote control via a web interface).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Mechanical Assembly"
        MR["Original Robot CAD Model"]:::mechanical
        MP["Manufactured Parts"]:::mechanical
        PC["Purchased Components"]:::mechanical
    end

    subgraph "Electronics Subsystem"
        CB["Control Board (ESP32-based)"]:::pcb
        EB["Encoder Board (AS5600)"]:::pcb
        IB["IMU Board (MPU6050)"]:::pcb
        SB["Servo Debug Board"]:::pcb
    end

    subgraph "Embedded Software"
        FW["Firmware (Arduino & simpleFOC Motor Control)"]:::software
        WS["Web Interface & WiFi Communication(AP/STA & WebSocket)"]:::software
    end

    subgraph "Documentation & Visual References"
        DOC["Docs & README"]:::docs
    end

    WS -->|"controls"| FW
    FW -->|"commands"| CB
    CB -->|"I2C"| EB
    CB -->|"I2C"| IB
    CB -->|"serial"| SB
    DOC --- MR
    DOC --- MP
    DOC --- PC

    click MR "https://github.com/mushibo/micro-wheeled_leg-robot/blob/master/1.RobotModel/OriginalRobotModel.stp"
    click MP "https://github.com/mushibo/micro-wheeled_leg-robot/tree/master/1.RobotModel/Parts-Manufactured"
    click PC "https://github.com/mushibo/micro-wheeled_leg-robot/blob/master/1.RobotModel/Parts-Purchased/BOM.xlsx"
    click CB "https://github.com/mushibo/micro-wheeled_leg-robot/blob/master/2.Hardware/1.ControllerPCB"
    click EB "https://github.com/mushibo/micro-wheeled_leg-robot/blob/master/2.Hardware/2.EncoderPCB"
    click IB "https://github.com/mushibo/micro-wheeled_leg-robot/blob/master/2.Hardware/3.IMUPCB"
    click SB "https://github.com/mushibo/micro-wheeled_leg-robot/blob/master/2.Hardware/4.ServoDebugPCB"
    click DOC "https://github.com/mushibo/micro-wheeled_leg-robot/blob/master/4.Docs"

    classDef mechanical fill:#f9f,stroke:#333,stroke-width:2px;
    classDef pcb fill:#ccf,stroke:#333,stroke-width:2px;
    classDef software fill:#cfc,stroke:#333,stroke-width:2px;
    classDef docs fill:#fc9,stroke:#333,stroke-width:2px;
```
