# walkerwolf/xuan architecture

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

- Interactive diagram: https://gitdiagram.com/walkerwolf/xuan
- Repository: https://github.com/walkerwolf/xuan

## Overview

##### Project type and purpose
- XUAN-Bike is a custom, hardware-centric autonomous bicycle project combining:
- Electronics: a control unit based on an ESP32 MCU, an Ascend A200 AI module, IMU sensor, and motor-driver CAN network
- Mechanical structure: Fusion360 designs for stator/rotor assemblies and servo mounts
- Goal: drive and stabilize a bicycle autonomously via sensor feedback and FOC-enabled motor controllers.

##### File structure
- Top-level:
- 1.Hardware – contains PCB designs and schematics for controller modules
- 2.Structure – Fusion360 3D models (.3dm) for all structural parts
- README.md – high-level description of hardware, structure and forthcoming software
- Hardware hierarchy:
- Atlas-Pi – Ascend A200 carrier PCB reference design
- ControlUnit – ESP32 + MPU6050 board with CAN interface to FOC drivers
- Structure hierarchy:
- 2.Manufacture – subfolders for each 3D part: momentum-drive rotor/stator, rear-drive rotor/stator, servo bracket

##### README for additional insights
- Ascend A200 + ESP32 + MPU6050 over CAN bus to proprietary FOC drive
- Mechanical designs exported from Fusion360; recommend opening the native F360 project
- Software (FOC coupling) is proprietary; a simplified DC-motor version will be open-sourced soon

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Project Overview
    README["Project Overview (README.md)"]:::doc

    %% Compute & Sensing Layer
    subgraph "Compute & Sensing"
        ESP32["ESP32 MCU + MPU6050"]:::compute
        A200["Ascend A200 Carrier (Atlas-Pi)"]:::compute
    end

    %% Power & Distribution Layer
    subgraph "Power & Distribution"
        Battery["Battery Pack"]:::power
        PDB["Power Distribution PCB"]:::power
        Regs["Voltage Regulators"]:::power
    end

    %% Drive & Actuation Layer
    subgraph "Drive & Actuation"
        CAN["CAN Bus"]:::bus
        FOCF["FOC Driver Front"]:::actuator
        FOCR["FOC Driver Rear"]:::actuator
        Servo["Steering Servo (PWM)"]:::actuator
    end

    %% Mechanical Assemblies
    subgraph "Mechanical Assemblies"
        FRot["Front Momentum Drive Rotor"]:::mech
        FStat["Front Momentum Drive Stator"]:::mech
        RRot["Rear Wheel Drive Rotor"]:::mech
        RStat["Rear Wheel Drive Stator"]:::mech
        SBracket["Servo Steering Bracket"]:::mech
    end

    %% Power Flow
    Battery --> PDB
    PDB --> Regs
    Regs --> ESP32
    Regs --> A200
    PDB -->|Motor_voltage| FOCF
    PDB -->|Motor_voltage| FOCR
    PDB -->|Motor_voltage| Servo

    %% Data & Control Flow
    ESP32 -->|"CAN"| CAN
    CAN -->|"CAN"| FOCF
    CAN -->|"CAN"| FOCR
    ESP32 -->|"PWM"| Servo
    ESP32 -->|"UART/PCIe"| A200

    %% Actuator to Mechanical
    FOCF --> FRot
    FOCF --> FStat
    FOCR --> RRot
    FOCR --> RStat
    Servo --> SBracket

    %% Documentation Link
    README --- ESP32

    %% Click Events
    click A200 "https://github.com/walkerwolf/xuan/blob/main/1.Hardware/Atlas-Pi/Atlas-Pi.PcbDoc"
    click ESP32 "https://github.com/walkerwolf/xuan/blob/main/1.Hardware/ControlUnit/ControlUnit.PcbDoc"
    click README "https://github.com/walkerwolf/xuan/blob/main/README.md"
    click FRot "https://github.com/walkerwolf/xuan/blob/main/2.Structure/2.Manufacture/动量驱动动子/动量驱动动子.3dm"
    click FStat "https://github.com/walkerwolf/xuan/blob/main/2.Structure/2.Manufacture/动量驱动定子/动量驱动定子.3dm"
    click RRot "https://github.com/walkerwolf/xuan/blob/main/2.Structure/2.Manufacture/后轮驱动动子/后轮驱动动子.3dm"
    click RStat "https://github.com/walkerwolf/xuan/tree/main/2.Structure/2.Manufacture/后轮驱动定子"
    click SBracket "https://github.com/walkerwolf/xuan/blob/main/2.Structure/2.Manufacture/舵机支架/舵机支架.3dm"

    %% Styles
    classDef compute fill:#E0F7FA,stroke:#00796B,color:#004D40
    classDef power fill:#E8F5E9,stroke:#388E3C,color:#1B5E20
    classDef actuator fill:#FFF3E0,stroke:#F57C00,color:#E65100
    classDef mech fill:#ECEFF1,stroke:#546E7A,color:#37474F
    classDef bus fill:#F3E5F5,stroke:#8E24AA,color:#4A148C
    classDef doc fill:#FFFDE7,stroke:#FBC02D,color:#F57F17
```
