# malichao/slam architecture

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

- Interactive diagram: https://gitdiagram.com/malichao/slam
- Repository: https://github.com/malichao/slam

## Overview

##### Project Type & Purpose
- This is an open-source robotics “toolkit” / research monorepo, not a single web or mobile app.
- It bundles:
– Core algorithm libraries (GraphSearch, Smooth, KalmanFilter, PID, Vehicle dynamic model)
– Two Qt-based visualization GUIs (QSLAM, XV11_LIDAR_Visualizer)
– Standalone test / demo programs (SLAM console, PID simulator, KalmanFilter test)
– Documentation & data assets (maps, snapshots, CSV, docs).

##### Top-Level Components
- “Core Algorithms” (reusable libraries)
- GraphSearch (BFS, A*, Dynamic Programming, RRT)
- Smooth (path smoothing post-processor)
- KalmanFilter (portable C module for sensor fusion)
- PID Controller & Twiddle (1D/2D vehicle simulation)
- Vehicle Dynamic Model (used by RRT and PID sim)
- “Data Assets”
- Bitmaps (under Search/GraphSearch/test & QSLAM resources)
- Sensor logs (e.g. CSV in KalmanFilter, LIDAR raw logs)
- “Applications / GUIs”
- QSLAM Qt GUI (uses GraphSearch + Smooth + resource bitmaps)
- XV11_LIDAR_Visualizer Qt GUI (sensor acquisition + filtering, pure viz)
- SLAM console/demo (command-line GraphSearch and SLAM tests)
- PID Simulator (console / plot output)
- KalmanFilter test harness (test.c)
- “Hardware Interface” (only for LIDAR)
- XV-11 serial parser → raw point data → filter → GUI

##### Inter-Component Relationships
– From “Data Assets” → GraphSearch library (map bitmaps feed search algos)
– GraphSearch → Smooth (search output fed into smoother)
– GraphSearch & Smooth → QSLAM GUI (for visualization & animation)
– Vehicle Dynamic Model & PID → PID Simulator (1D/2D sim)
– Gyro + Accel sensor data → KalmanFilter → KalmanFilter test harness
– LIDAR Hardware Interface → Data Filter → LIDAR GUI
- “Core Algorithms” as a shared services layer beneath the apps that consume them.

##### Architectural Patterns & Principles
- Layered Architecture:
– Hardware / Data Input layer (sensors, map files)
– Core Algorithm layer (search, smoothing, filtering, control)
– Application layer (GUI, console demos)
- Modularization: each algorithm lives in its own directory and builds as a separate library or .o files.
- Qt-based MVC-ish for GUIs: .ui files define Views (mainwindow.ui, settingsdialog.ui), Controllers in *.cpp, Models in core algorithm calls.

##### Technologies & Frameworks
- C & C++ (GCC/Eclipse CDT for some, Qt/.pro for QSLAM and LIDAR)
- Qt Widgets (mainwindow.ui, signal/slot in console.cpp, renderarea.cpp)
- Makefiles / managed CDT project files for build
- No external servers or cloud services

## Diagram (Mermaid)

```mermaid
graph TB
    %% Data Assets Layer
    subgraph "Data Assets"
        direction TB
        MapBitmaps["Map Bitmaps"]:::data
        SensorLogs["Sensor Logs"]:::data
    end

    %% Hardware Interface Layer
    subgraph "Hardware Interface"
        direction TB
        SerialParser["Serial Parser"]:::hw
        DataFilter["Data Filter"]:::hw
    end

    %% Core Algorithms Layer
    subgraph "Core Algorithms"
        direction TB
        GS["GraphSearch Library"]:::core
        SM["Smooth (Path Smoothing)"]:::core
        KF["KalmanFilter Module"]:::core
        PCTRL["PID Controller"]:::core
        VMD["Vehicle Dynamic Model"]:::core
    end

    %% Application Layer
    subgraph "Applications / GUIs"
        direction TB
        QSLAM["QSLAM Qt GUI"]:::gui
        LIDARGUI["XV11_LIDAR_Visualizer"]:::gui
        SLAMC["SLAM Console/Demo"]:::gui
        PIDSIM["PID Simulator"]:::gui
        KFT["KalmanFilter Test Harness"]:::gui
    end

    %% Data Flows
    MapBitmaps -->|"map bitmap →"| GS
    SensorLogs -->|"sensor logs →"| KF

    SerialParser --> DataFilter
    DataFilter -->|"filtered LIDAR →"| LIDARGUI

    GS -->|"search output →"| SM
    GS -->|"search & smooth →"| QSLAM
    SM -->|"search & smooth →"| QSLAM

    VMD -->|"model →"| PIDSIM
    PCTRL -->|"control →"| PIDSIM

    KF -->|"fused sensor data →"| KFT

    GS -->|"search algos →"| SLAMC

    %% Click Events
    click GS "https://github.com/malichao/slam/tree/master/Search/GraphSearch"
    click SM "https://github.com/malichao/slam/blob/master/SLAM/Smooth.cpp"
    click KF "https://github.com/malichao/slam/blob/master/KalmanFilter/KalmanFilter.c"
    click KFT "https://github.com/malichao/slam/blob/master/KalmanFilter/test.c"
    click PCTRL "https://github.com/malichao/slam/blob/master/PID/src/pid.cpp"
    click VMD "https://github.com/malichao/slam/blob/master/PID/src/Vehicle.cpp"
    click PIDSIM "https://github.com/malichao/slam/blob/master/PID/src/test.cpp"
    click QSLAM "https://github.com/malichao/slam/tree/master/QSLAM/QSLAM"
    click LIDARGUI "https://github.com/malichao/slam/tree/master/LIDAR"
    click SLAMC "https://github.com/malichao/slam/blob/master/SLAM/Main.cpp"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef gui fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef hw fill:#FFA500,stroke:#333,stroke-width:1px
```
