# prbonn/kiss-icp architecture

> Architecture diagram of the GitHub repository prbonn/kiss-icp, 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/prbonn/kiss-icp
- Repository: https://github.com/prbonn/kiss-icp

## Overview

##### Main Components
- Core Processing Modules (C++):
- Core registration: Includes modules for preprocessing, registration, thresholding, voxel management (VoxelHashMap, VoxelUtils).
- Pipeline: The “pipeline” directory under cpp/kiss_icp encapsulates the high-level orchestration logic (e.g., KissICP.cpp and KissICP.hpp) that chains the core components.
- Metrics: Modules used to evaluate performance and quality of the registration (Metrics.cpp, Metrics.hpp).

- Python Layer:
- Python Package: Contains an equivalent implementation or binding for the C++ algorithms (in python/kiss_icp) – including configuration, various datasets (handling different LiDAR data formats such as KITTI, Apollo, etc.), and tools (e.g., visualization, progress bar).
- Pybind Module: The “pybind” subdirectory specifies the interface that binds the C++ code to Python.

- ROS Integration:
- ROS Package: Provides additional wrappers and launchers (launch files, ROS node source in ros/src) to integrate the reception of sensor data (OdometryServer.cpp) and visualization (rviz configuration).

- Configuration & Evaluation:
- Config: Contains YAML files and advanced/basic parameter configurations.
- Eval: Contains Jupyter notebooks and scripts to test and evaluate the performance of the registration pipeline on certain datasets.

- External Dependencies:
- Third-party libraries (located inside “cpp/kiss_icp/3rdparty”) such as Eigen for linear algebra, Sophus for Lie groups, TBB for parallel processing, and tsl_robin for hash table implementations.

##### Relationships and Data Flow
- Input Sources:
- LiDAR data (raw point clouds) and possibly dataset files coming from various sensors/repositories (handled by the Python datasets).
- Core Flow:
- The data flows into the preprocessing modules where initial cleaning and adjustment happens.
- The preprocessed data is passed to the registration module where the point-to-point ICP algorithm is executed.
- Intermediate results (such as voxel representations) are managed by the voxel modules.
- The pipeline component coordinates these operations and applies thresholding and metric evaluation.
- External Interfacing:
- Python bindings wrap the C++ core, exposing functionalities via a CLI (e.g., kiss_icp_pipeline) and potentially visualizing or saving results.
- ROS wrappers encapsulate the core functionalities for real-time applications in robotics, with launch files coordinating node startup and rviz configuration for visualization.
- Feedback Loop:
- Metrics are computed post-registration to validate and potentially iterate over the processing steps.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- The system is clearly modularized into core computational logic, dataset handling, bindings, and ROS integration.
- Abstraction via Bindings:
- The use of Pybind abstracts the underlying C++ code, allowing the system to be used seamlessly from Python.
- Reusability:
- The segregation into modules (core, pipeline, metrics) shows an emphasis on reusable components across different interfaces (command line, ROS, notebooks).
- Dependency Management:
- Third-party libraries and configuration files are separated to ensure clear paths for updates and management.

- Main Areas to Include:
- C++ Core Modules: “Core”, “Pipeline”, “Metrics” (with pointers to underlying libraries such as Eigen and Sophus).
- Python Package: “Configuration”, “Datasets”, “Tools”, and “Pybind”.
- ROS Integration: “ROS Node (OdometryServer)”, “Launch Files”, “RViz Config”.
- Evaluation/Testing: “Eval Scripts and Notebooks”.
- Configuration: “YAML Config Files” and “CMake Files” for specifying builds.
- Relationships and Data Flow:
- That Python and ROS layers interface with the core modules (via Pybind for Python, and via direct C++ integration for ROS).

## Diagram (Mermaid)

```mermaid
graph TD
    A["Raw LiDAR Data"]:::input
    subgraph "C++ Core Modules"
        B["Preprocessing, Registration, Thresholding & Voxel Management"]:::cpp
    end
    C["Pipeline Coordination (C++)"]:::cpp
    D["Metrics Evaluation (C++)"]:::cpp
    E["Third-party Libraries (Eigen, Sophus, TBB, tsl_robin)"]:::external

    subgraph "Python Layer"
        F["Python Package & Tools"]:::python
        G["Pybind Interface"]:::python
    end

    subgraph "ROS Integration"
        H["ROS Odometry Server"]:::ros
        I["ROS Launch & RViz"]:::ros
    end

    subgraph "Configuration & Evaluation"
        J["Global Config (YAML)"]:::config
        K["Python Config Module"]:::config
        L["Evaluation Notebooks"]:::config
        M["Evaluation Script"]:::config
    end

    %% Data flow
    A -->|"raw"| B
    B -->|"processed data"| C
    B -->|"uses"| E
    C -->|"evaluates"| D
    D -->|"feedback"| C

    %% Python integration
    F -->|"binds via"| G
    G -->|"interfaces with"| C
    K -->|"configures"| F

    %% ROS integration
    C -->|"publishes to"| H
    C -->|"triggers"| I

    %% Configuration and Evaluation influence
    J -->|"configures"| C
    C -->|"results to"| L
    C -->|"results to"| M

    %% Click Events
    click B "https://github.com/prbonn/kiss-icp/tree/main/cpp/kiss_icp/core"
    click C "https://github.com/prbonn/kiss-icp/tree/main/cpp/kiss_icp/pipeline"
    click D "https://github.com/prbonn/kiss-icp/tree/main/cpp/kiss_icp/metrics"
    click E "https://github.com/prbonn/kiss-icp/tree/main/cpp/kiss_icp/3rdparty"
    click F "https://github.com/prbonn/kiss-icp/tree/main/python/kiss_icp"
    click G "https://github.com/prbonn/kiss-icp/tree/main/python/kiss_icp/pybind"
    click H "https://github.com/prbonn/kiss-icp/blob/main/ros/src/OdometryServer.cpp"
    click I "https://github.com/prbonn/kiss-icp/blob/main/ros/launch/odometry.launch.py"
    click J "https://github.com/prbonn/kiss-icp/tree/main/config"
    click K "https://github.com/prbonn/kiss-icp/tree/main/python/kiss_icp/config"
    click L "https://github.com/prbonn/kiss-icp/tree/main/eval"
    click M "https://github.com/prbonn/kiss-icp/blob/main/eval/kiss_icp_eval.py"

    %% Styles
    classDef cpp fill:#ffd1dc,stroke:#d6336c,stroke-width:2px;
    classDef python fill:#cce5ff,stroke:#339af0,stroke-width:2px;
    classDef ros fill:#fff3bf,stroke:#f08c00,stroke-width:2px;
    classDef config fill:#d1f7c4,stroke:#28a745,stroke-width:2px;
    classDef external fill:#fef9c3,stroke:#fadb14,stroke-width:2px;
    classDef input fill:#d0ebff,stroke:#1c7ed6,stroke-width:2px;
```
