# 3367816945-cell/k3-riscv-perception-lab architecture

> Architecture diagram of the GitHub repository 3367816945-cell/k3-riscv-perception-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/3367816945-cell/k3-riscv-perception-lab
- Repository: https://github.com/3367816945-cell/k3-riscv-perception-lab

## Overview

This repository is a RISC-V perception research and validation workbench for Livox Mid-360 data on SpacemiT K1/K3—not a production SLAM stack. Its principal workflow captures timestamped LiDAR and IMU streams, prepares point clouds, runs VGICP replay, and produces pose/map and performance evidence; ROS 2 probes exercise point-cloud transport. Separate validation branches cover platform/HMP/RVV capabilities and a PCL pipeline. The README documents the algorithm stages and product boundaries; sampled source confirms selected record, deskew, VGICP, and ROS probe behavior, but not every stage’s implementation wiring.

Main entry points: [`src/vgicp_probe.cpp`](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/vgicp_probe.cpp) (VGICP replay), [`src/livox_record_format.h`](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_record_format.h) (Record format), [`src/livox_record.cpp`](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_record.cpp) (Livox recorder), [`src/livox_offline_deskew.cpp`](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_offline_deskew.cpp) (Offline deskew)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Sensor data"]
  node_recorder["Livox recorder<br/>[livox_record.cpp]"]
  node_recordformat["Record format"]
  node_capturetool["Capture utility<br/>[mid360_capture.cpp]"]
  node_recordinspect["Record inspection<br/>[livox_inspect.cpp]"]
end

subgraph group_perception["Perception pipeline"]
  node_deskew["Offline deskew"]
  node_vgicp["VGICP replay<br/>[vgicp_probe.cpp]"]
  node_pointcloud["PCL pipeline"]
  node_pointcore["Point-cloud core"]
  node_obstacles["Obstacle segmentation"]
end

subgraph group_interfaces["Output interfaces"]
  node_contract["Perception contract"]
  node_ros_pub["Cloud publisher"]
  node_ros_sub["Cloud subscriber"]
end

subgraph group_validation["Platform validation"]
  node_platformprobe["Platform probe<br/>[platform_probe.cpp]"]
  node_hmp["K3 HMP probe<br/>[k3_hmp_probe.cpp]"]
  node_rvv["RVV throughput"]
  node_opencl["OpenCL probe<br/>[opencl_probe.cpp]"]
  node_clock["Clock probe<br/>[clock_probe.cpp]"]
end

node_operator(("Operator"))
node_mid360(("Livox Mid-360"))
node_imu(("IMU"))
node_middleware["ROS 2 middleware"]

node_operator -->|"starts capture"| node_recorder
node_mid360 -->|"sends packets"| node_recorder
node_imu -->|"supplies samples"| node_recorder
node_recorder -->|"writes records"| node_recordformat
node_recordformat -->|"decodes stream"| node_deskew
node_recordformat -->|"decodes stream"| node_vgicp
node_recordformat -->|"validates stream"| node_recordinspect
node_operator -->|"runs replay"| node_deskew
node_operator -->|"runs replay"| node_vgicp
node_deskew -.->|"prepares clouds"| node_vgicp
node_vgicp -.->|"exports perception"| node_ros_pub
node_ros_pub -->|"publishes topic"| node_middleware
node_middleware -->|"delivers topic"| node_ros_sub
node_operator -->|"runs capture"| node_capturetool
node_operator -->|"runs benchmark"| node_pointcloud
node_operator -.->|"runs validation"| node_pointcore
node_operator -.->|"runs segmentation"| node_obstacles
node_operator -->|"checks platform"| node_platformprobe
node_operator -->|"checks scheduling"| node_hmp
node_operator -->|"measures vectors"| node_rvv
node_operator -.->|"checks compute"| node_opencl
node_operator -.->|"checks timing"| node_clock
node_contract -.->|"defines outputs"| node_vgicp

click node_recorder "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_record.cpp"
click node_recordformat "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_record_format.h"
click node_capturetool "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/mid360_capture.cpp"
click node_recordinspect "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_inspect.cpp"
click node_deskew "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_offline_deskew.cpp"
click node_vgicp "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/vgicp_probe.cpp"
click node_pointcloud "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/pointcloud_pipeline.cpp"
click node_pointcore "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/pointcloud_core.cpp"
click node_obstacles "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/obstacle_segmenter.cpp"
click node_contract "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/config/perception_contract.json"
click node_ros_pub "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/ros2_ws/src/k3_sensor_probe/src/cloud_publisher.cpp"
click node_ros_sub "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/ros2_ws/src/k3_sensor_probe/src/cloud_subscriber.cpp"
click node_platformprobe "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/platform_probe.cpp"
click node_hmp "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/tools/k3_hmp_probe.cpp"
click node_rvv "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/tools/k3_vector_throughput.cpp"
click node_opencl "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/tools/opencl_probe.cpp"
click node_clock "https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/tools/clock_probe.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_recorder,node_recordformat,node_capturetool,node_recordinspect toneBlue
class node_deskew,node_vgicp,node_pointcloud,node_pointcore,node_obstacles toneAmber
class node_contract,node_ros_pub,node_ros_sub toneMint
class node_platformprobe,node_hmp,node_rvv,node_opencl,node_clock toneRose
class node_operator,node_mid360,node_imu,node_middleware toneIndigo
```

## Components

### Sensor data

- [Livox recorder](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_record.cpp): `src/livox_record.cpp`
- [Record format](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_record_format.h): `src/livox_record_format.h`
- [Capture utility](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/mid360_capture.cpp): `src/mid360_capture.cpp`
- [Record inspection](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_inspect.cpp): `src/livox_inspect.cpp`

### Perception pipeline

- [Offline deskew](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/livox_offline_deskew.cpp): `src/livox_offline_deskew.cpp`
- [VGICP replay](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/vgicp_probe.cpp): `src/vgicp_probe.cpp`
- [PCL pipeline](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/pointcloud_pipeline.cpp): `src/pointcloud_pipeline.cpp`
- [Point-cloud core](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/pointcloud_core.cpp): `src/pointcloud_core.cpp`
- [Obstacle segmentation](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/obstacle_segmenter.cpp): `src/obstacle_segmenter.cpp`

### Output interfaces

- [Perception contract](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/config/perception_contract.json): `config/perception_contract.json`
- [Cloud publisher](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/ros2_ws/src/k3_sensor_probe/src/cloud_publisher.cpp): `ros2_ws/src/k3_sensor_probe/src/cloud_publisher.cpp`
- [Cloud subscriber](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/ros2_ws/src/k3_sensor_probe/src/cloud_subscriber.cpp): `ros2_ws/src/k3_sensor_probe/src/cloud_subscriber.cpp`

### Platform validation

- [Platform probe](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/src/platform_probe.cpp): `src/platform_probe.cpp`
- [K3 HMP probe](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/tools/k3_hmp_probe.cpp): `tools/k3_hmp_probe.cpp`
- [RVV throughput](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/tools/k3_vector_throughput.cpp): `tools/k3_vector_throughput.cpp`
- [OpenCL probe](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/tools/opencl_probe.cpp): `tools/opencl_probe.cpp`
- [Clock probe](https://github.com/3367816945-cell/k3-riscv-perception-lab/blob/main/tools/clock_probe.cpp): `tools/clock_probe.cpp`

### Other components

- **Operator**
- **Livox Mid-360**
- **IMU**
- **ROS 2 middleware**

## Connections

- Operator → Livox recorder: starts capture (evidence: `README.md`)
- Livox Mid-360 → Livox recorder: sends packets (evidence: `README.md`)
- IMU → Livox recorder: supplies samples (evidence: `README.md`)
- Livox recorder → Record format: writes records (evidence: `src/livox_record.cpp`)
- Record format → Offline deskew: decodes stream (evidence: `src/livox_offline_deskew.cpp`)
- Record format → VGICP replay: decodes stream (evidence: `src/vgicp_probe.cpp`)
- Record format → Record inspection: validates stream (evidence: `src/livox_inspect.cpp`)
- Operator → Offline deskew: runs replay (evidence: `README.md`)
- Operator → VGICP replay: runs replay (evidence: `README.md`)
- Offline deskew → VGICP replay: prepares clouds
- VGICP replay → Cloud publisher: exports perception
- Cloud publisher → ROS 2 middleware: publishes topic (evidence: `ros2_ws/src/k3_sensor_probe/src/cloud_publisher.cpp`)
- ROS 2 middleware → Cloud subscriber: delivers topic (evidence: `ros2_ws/src/k3_sensor_probe/src/cloud_subscriber.cpp`)
- Operator → Capture utility: runs capture (evidence: `README.md`)
- Operator → PCL pipeline: runs benchmark (evidence: `README.md`)
- Operator → Point-cloud core: runs validation
- Operator → Obstacle segmentation: runs segmentation
- Operator → Platform probe: checks platform (evidence: `README.md`)
- Operator → K3 HMP probe: checks scheduling (evidence: `README.md`)
- Operator → RVV throughput: measures vectors (evidence: `README.md`)
- Operator → OpenCL probe: checks compute
- Operator → Clock probe: checks timing
- Perception contract → VGICP replay: defines outputs
