# nonenpc/smartcar architecture

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

- Interactive diagram: https://gitdiagram.com/nonenpc/smartcar
- Repository: https://github.com/nonenpc/smartcar

## Overview

Origincar is a ROS 2 autonomous-navigation application for a mobile robot. Its principal workflow is sensor input and localization, navigation/control, then fixed-path following; separate vision and operator-display capabilities complement the driving system. The sampled sources show the LiDAR driver’s packet and scan responsibilities, path publisher’s FollowPath client, and display subscriber. Navigation, QR, and language-model implementations were not sampled, so those subsystems are represented at their documented package level; their internal connections are not inferred.

Main entry points: [`tools/race.launch.py`](https://github.com/nonenpc/smartcar/blob/main/tools/race.launch.py) (Race launch), [`LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lslidar_driver.cc`](https://github.com/nonenpc/smartcar/blob/main/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lslidar_driver.cc) (LiDAR driver), [`origincar_nav`](https://github.com/nonenpc/smartcar/tree/main/origincar_nav) (SLAM localization), [`display_info/display_info/display_info.py`](https://github.com/nonenpc/smartcar/blob/main/display_info/display_info/display_info.py) (Information display)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["System orchestration"]
  node_race_launch["Race launch<br/>[race.launch.py]"]
  node_robot_base["Origincar base"]
end

subgraph group_sensing["Sensing and perception"]
  node_lidar_device["LiDAR device"]
  node_lidar_node["LiDAR driver<br/>[lslidar_driver.cc]"]
  node_packet_input["Packet input<br/>[input.cc]"]
  node_serial_io["Serial I/O<br/>[lsiosr.cpp]"]
end

subgraph group_navigation["Navigation and control"]
  node_slam_localization["SLAM localization"]
  node_nav_control["Nav2 control"]
  node_path_publisher["Fixed-path publisher<br/>[pub_plan.cpp]"]
  node_path_recorder["Path recording"]
end

subgraph group_vision["Vision tasks"]
  node_qr_recognition["QR recognition"]
  node_yolo_segmentation["YOLO segmentation"]
  node_image_understanding["Image understanding"]
end

subgraph group_operator["Operator output"]
  node_display_node["Information display<br/>[display_info.py]"]
  node_display_panel["Display panel"]
end

node_operator_user(("Robot operator"))

node_operator_user -->|"starts system"| node_race_launch
node_race_launch -.->|"starts"| node_robot_base
node_race_launch -->|"includes navigation"| node_slam_localization
node_race_launch -->|"includes path launch"| node_path_publisher
node_race_launch -->|"includes QR launch"| node_qr_recognition
node_race_launch -->|"includes display launch"| node_display_node
node_lidar_device -.->|"sends packets"| node_lidar_node
node_lidar_node -.->|"reads packets"| node_packet_input
node_lidar_node -.->|"uses serial I/O"| node_serial_io
node_lidar_node -.->|"provides scan data"| node_slam_localization
node_slam_localization -.->|"provides pose"| node_nav_control
node_nav_control -.->|"controls motion"| node_robot_base
node_path_publisher -->|"sends FollowPath goal"| node_nav_control
node_operator_user -.->|"records routes"| node_path_recorder
node_lidar_device -.->|"provides image input"| node_yolo_segmentation
node_qr_recognition -.->|"reports recognition"| node_operator_user
node_image_understanding -.->|"returns interpretation"| node_operator_user
node_operator_user -.->|"publishes display text"| node_display_node
node_display_node -.->|"renders text"| node_display_panel

click node_race_launch "https://github.com/nonenpc/smartcar/blob/main/tools/race.launch.py"
click node_lidar_node "https://github.com/nonenpc/smartcar/blob/main/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lslidar_driver.cc"
click node_packet_input "https://github.com/nonenpc/smartcar/blob/main/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/input.cc"
click node_serial_io "https://github.com/nonenpc/smartcar/blob/main/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lsiosr.cpp"
click node_slam_localization "https://github.com/nonenpc/smartcar/tree/main/origincar_nav"
click node_nav_control "https://github.com/nonenpc/smartcar/tree/main/origincar_nav"
click node_path_publisher "https://github.com/nonenpc/smartcar/blob/main/pub_plan/src/pub_plan.cpp"
click node_path_recorder "https://github.com/nonenpc/smartcar/tree/main/tools/record_path"
click node_qr_recognition "https://github.com/nonenpc/smartcar/blob/main/qr_code_recognition/src/qr_code_recognition.cpp"
click node_yolo_segmentation "https://github.com/nonenpc/smartcar/blob/main/image_cut/src/yolov11_detector.cpp"
click node_image_understanding "https://github.com/nonenpc/smartcar/blob/main/ollama_image_understanding/ollama_image_understanding/ollama_understanding.py"
click node_display_node "https://github.com/nonenpc/smartcar/blob/main/display_info/display_info/display_info.py"

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_race_launch,node_robot_base toneBlue
class node_lidar_device,node_lidar_node,node_packet_input,node_serial_io toneAmber
class node_slam_localization,node_nav_control,node_path_publisher,node_path_recorder toneMint
class node_qr_recognition,node_yolo_segmentation,node_image_understanding toneRose
class node_display_node,node_display_panel,node_operator_user toneIndigo
```

## Components

### System orchestration

- [Race launch](https://github.com/nonenpc/smartcar/blob/main/tools/race.launch.py): `tools/race.launch.py`
- **Origincar base**

### Sensing and perception

- **LiDAR device**
- [LiDAR driver](https://github.com/nonenpc/smartcar/blob/main/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lslidar_driver.cc): `LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lslidar_driver.cc`
- [Packet input](https://github.com/nonenpc/smartcar/blob/main/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/input.cc): `LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/input.cc`
- [Serial I/O](https://github.com/nonenpc/smartcar/blob/main/LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lsiosr.cpp): `LSLIDAR_X_ROS2-20240228/src/lslidar_driver/src/lsiosr.cpp`

### Navigation and control

- [SLAM localization](https://github.com/nonenpc/smartcar/tree/main/origincar_nav): `origincar_nav`
- [Nav2 control](https://github.com/nonenpc/smartcar/tree/main/origincar_nav): `origincar_nav`
- [Fixed-path publisher](https://github.com/nonenpc/smartcar/blob/main/pub_plan/src/pub_plan.cpp): `pub_plan/src/pub_plan.cpp`
- [Path recording](https://github.com/nonenpc/smartcar/tree/main/tools/record_path): `tools/record_path`

### Vision tasks

- [QR recognition](https://github.com/nonenpc/smartcar/blob/main/qr_code_recognition/src/qr_code_recognition.cpp): `qr_code_recognition/src/qr_code_recognition.cpp`
- [YOLO segmentation](https://github.com/nonenpc/smartcar/blob/main/image_cut/src/yolov11_detector.cpp): `image_cut/src/yolov11_detector.cpp`
- [Image understanding](https://github.com/nonenpc/smartcar/blob/main/ollama_image_understanding/ollama_image_understanding/ollama_understanding.py): `ollama_image_understanding/ollama_image_understanding/ollama_understanding.py`

### Operator output

- [Information display](https://github.com/nonenpc/smartcar/blob/main/display_info/display_info/display_info.py): `display_info/display_info/display_info.py`
- **Display panel**

### Other components

- **Robot operator**

## Connections

- Robot operator → Race launch: starts system
- Race launch → Origincar base: starts
- Race launch → SLAM localization: includes navigation (evidence: `tools/race.launch.py`)
- Race launch → Fixed-path publisher: includes path launch (evidence: `tools/race.launch.py`)
- Race launch → QR recognition: includes QR launch (evidence: `tools/race.launch.py`)
- Race launch → Information display: includes display launch (evidence: `tools/race.launch.py`)
- LiDAR device → LiDAR driver: sends packets
- LiDAR driver → Packet input: reads packets
- LiDAR driver → Serial I/O: uses serial I/O
- LiDAR driver → SLAM localization: provides scan data
- SLAM localization → Nav2 control: provides pose
- Nav2 control → Origincar base: controls motion
- Fixed-path publisher → Nav2 control: sends FollowPath goal (evidence: `pub_plan/src/pub_plan.cpp`)
- Robot operator → Path recording: records routes
- LiDAR device → YOLO segmentation: provides image input
- QR recognition → Robot operator: reports recognition
- Image understanding → Robot operator: returns interpretation
- Robot operator → Information display: publishes display text
- Information display → Display panel: renders text (evidence: `display_info/display_info/display_info.py`)
