# ghm0819/erpot architecture

> Architecture diagram of the GitHub repository ghm0819/erpot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ghm0819/erpot
- Repository: https://github.com/ghm0819/erpot

## Overview

ERPoT is a ROS-based mobile-robot localization system built around compact polygon maps. Its main workflow converts LiDAR point clouds into obstacle scans, tracks pose against a prepared polygon map, and publishes results for visualization. A separate map-building workflow creates a grid map from scans and poses, then converts that grid into polygons. The graph includes these documented product stages and the sampled map-association and optimization layers; some runtime wiring is documented only at a high level, so uncertain connections are omitted.

Main entry points: [`feature_association/feature_association.cpp`](https://github.com/ghm0819/erpot/blob/main/feature_association/feature_association.cpp) (Feature association), [`src/entrance_tracking.cpp`](https://github.com/ghm0819/erpot/blob/main/src/entrance_tracking.cpp) (Tracking entry), [`slam_karto/slam_karto.cpp`](https://github.com/ghm0819/erpot/blob/main/slam_karto/slam_karto.cpp) (Karto SLAM), [`feature_association/map.cpp`](https://github.com/ghm0819/erpot/blob/main/feature_association/map.cpp) (Polygon map model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_perception["LiDAR perception"]
  node_obstacle_node["Obstacle node"]
  node_ground_seg["Ground segmentation"]
  node_obstacle_scan["Obstacle scan<br/>[scan_point.h]"]
end

subgraph group_mapping["Map construction"]
  node_grid_map[("Grid map")]
  node_polygon_entry["Polygon-map generator"]
  node_polygon_map[("Polygon map")]
end

subgraph group_tracking["Pose tracking"]
  node_tracking_entry["Tracking entry"]
  node_map_model["Polygon map model<br/>[map.cpp]"]
  node_map_geometry["Map geometry<br/>[vertex.h]"]
  node_association["Feature association"]
  node_scan_factors["Scan factors<br/>[scan_factor.hpp]"]
  node_pose_result["Tracked pose"]
end

subgraph group_slam["Grid mapping"]
  node_grid_entry["Grid-map entry"]
  node_karto_runtime["Karto SLAM<br/>[slam_karto.cpp]"]
  node_karto_mapper["Scan mapper<br/>[Mapper.cpp]"]
  node_spa_solver["Pose graph solver<br/>[spa_solver.cpp]"]
end

node_robot(("Robot LiDAR"))
node_viewer(("RViz viewer"))
node_dataset_loader["KITTI loader<br/>[kitti_loader.cpp]"]

node_robot -->|"sends clouds"| node_obstacle_node
node_obstacle_node -->|"processes clouds"| node_ground_seg
node_ground_seg -->|"extracts obstacles"| node_obstacle_scan
node_robot -->|"provides scans"| node_grid_entry
node_grid_entry -->|"starts mapping"| node_karto_runtime
node_karto_runtime -->|"uses mapper"| node_karto_mapper
node_karto_mapper -->|"uses solver"| node_spa_solver
node_karto_runtime -.->|"builds grid"| node_grid_map
node_grid_map -->|"converts grid"| node_polygon_entry
node_polygon_entry -->|"writes polygons"| node_polygon_map
node_robot -->|"supplies LiDAR"| node_tracking_entry
node_tracking_entry -->|"runs tracking"| node_association
node_tracking_entry -.->|"loads map"| node_map_model
node_map_model -->|"builds associations"| node_map_geometry
node_association -->|"requests associations"| node_map_model
node_association -->|"uses residuals"| node_scan_factors
node_association -->|"estimates pose"| node_pose_result
node_pose_result -->|"visualizes pose"| node_viewer

click node_obstacle_node "https://github.com/ghm0819/erpot/blob/main/src/entrance_obstacle.cpp"
click node_ground_seg "https://github.com/ghm0819/erpot/blob/main/nearest_obstacle/nearest_obstacle.cpp"
click node_obstacle_scan "https://github.com/ghm0819/erpot/blob/main/nearest_obstacle/scan_point.h"
click node_grid_entry "https://github.com/ghm0819/erpot/blob/main/src/entrance_gridmap.cpp"
click node_karto_runtime "https://github.com/ghm0819/erpot/blob/main/slam_karto/slam_karto.cpp"
click node_karto_mapper "https://github.com/ghm0819/erpot/blob/main/slam_karto/Mapper.cpp"
click node_spa_solver "https://github.com/ghm0819/erpot/blob/main/slam_karto/spa_solver.cpp"
click node_grid_map "https://github.com/ghm0819/erpot/tree/main/map"
click node_polygon_entry "https://github.com/ghm0819/erpot/blob/main/src/entrance_polygon.cpp"
click node_polygon_map "https://github.com/ghm0819/erpot/tree/main/map"
click node_tracking_entry "https://github.com/ghm0819/erpot/blob/main/src/entrance_tracking.cpp"
click node_map_model "https://github.com/ghm0819/erpot/blob/main/feature_association/map.cpp"
click node_map_geometry "https://github.com/ghm0819/erpot/blob/main/feature_association/vertex.h"
click node_association "https://github.com/ghm0819/erpot/blob/main/feature_association/feature_association.cpp"
click node_scan_factors "https://github.com/ghm0819/erpot/blob/main/scan_factor/scan_factor.hpp"
click node_pose_result "https://github.com/ghm0819/erpot/blob/main/src/entrance_tracking.cpp"
click node_dataset_loader "https://github.com/ghm0819/erpot/blob/main/src/kitti_loader.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_obstacle_node,node_ground_seg,node_obstacle_scan,node_viewer toneBlue
class node_grid_map,node_polygon_entry,node_polygon_map toneAmber
class node_tracking_entry,node_map_model,node_map_geometry,node_association,node_scan_factors,node_pose_result toneMint
class node_grid_entry,node_karto_runtime,node_karto_mapper,node_spa_solver toneRose
class node_robot toneIndigo
class node_dataset_loader toneTeal
```

## Components

### LiDAR perception

- [Obstacle node](https://github.com/ghm0819/erpot/blob/main/src/entrance_obstacle.cpp): `src/entrance_obstacle.cpp`
- [Ground segmentation](https://github.com/ghm0819/erpot/blob/main/nearest_obstacle/nearest_obstacle.cpp): `nearest_obstacle/nearest_obstacle.cpp`
- [Obstacle scan](https://github.com/ghm0819/erpot/blob/main/nearest_obstacle/scan_point.h): `nearest_obstacle/scan_point.h`

### Map construction

- [Grid map](https://github.com/ghm0819/erpot/tree/main/map): `map`
- [Polygon-map generator](https://github.com/ghm0819/erpot/blob/main/src/entrance_polygon.cpp): `src/entrance_polygon.cpp`
- [Polygon map](https://github.com/ghm0819/erpot/tree/main/map): `map`

### Pose tracking

- [Tracking entry](https://github.com/ghm0819/erpot/blob/main/src/entrance_tracking.cpp): `src/entrance_tracking.cpp`
- [Polygon map model](https://github.com/ghm0819/erpot/blob/main/feature_association/map.cpp): `feature_association/map.cpp`
- [Map geometry](https://github.com/ghm0819/erpot/blob/main/feature_association/vertex.h): `feature_association/vertex.h`
- [Feature association](https://github.com/ghm0819/erpot/blob/main/feature_association/feature_association.cpp): `feature_association/feature_association.cpp`
- [Scan factors](https://github.com/ghm0819/erpot/blob/main/scan_factor/scan_factor.hpp): `scan_factor/scan_factor.hpp`
- [Tracked pose](https://github.com/ghm0819/erpot/blob/main/src/entrance_tracking.cpp): `src/entrance_tracking.cpp`

### Grid mapping

- [Grid-map entry](https://github.com/ghm0819/erpot/blob/main/src/entrance_gridmap.cpp): `src/entrance_gridmap.cpp`
- [Karto SLAM](https://github.com/ghm0819/erpot/blob/main/slam_karto/slam_karto.cpp): `slam_karto/slam_karto.cpp`
- [Scan mapper](https://github.com/ghm0819/erpot/blob/main/slam_karto/Mapper.cpp): `slam_karto/Mapper.cpp`
- [Pose graph solver](https://github.com/ghm0819/erpot/blob/main/slam_karto/spa_solver.cpp): `slam_karto/spa_solver.cpp`

### Other components

- **Robot LiDAR**
- **RViz viewer**
- [KITTI loader](https://github.com/ghm0819/erpot/blob/main/src/kitti_loader.cpp): `src/kitti_loader.cpp`

## Connections

- Robot LiDAR → Obstacle node: sends clouds (evidence: `README.md`)
- Obstacle node → Ground segmentation: processes clouds
- Ground segmentation → Obstacle scan: extracts obstacles (evidence: `nearest_obstacle/nearest_obstacle.cpp`)
- Robot LiDAR → Grid-map entry: provides scans (evidence: `README.md`)
- Grid-map entry → Karto SLAM: starts mapping (evidence: `src/entrance_gridmap.cpp`)
- Karto SLAM → Scan mapper: uses mapper
- Scan mapper → Pose graph solver: uses solver
- Karto SLAM → Grid map: builds grid
- Grid map → Polygon-map generator: converts grid (evidence: `README.md`)
- Polygon-map generator → Polygon map: writes polygons (evidence: `src/entrance_polygon.cpp`)
- Robot LiDAR → Tracking entry: supplies LiDAR (evidence: `README.md`)
- Tracking entry → Feature association: runs tracking
- Tracking entry → Polygon map model: loads map
- Polygon map model → Map geometry: builds associations
- Feature association → Polygon map model: requests associations
- Feature association → Scan factors: uses residuals
- Feature association → Tracked pose: estimates pose
- Tracked pose → RViz viewer: visualizes pose (evidence: `README.md`)
