# gangheejo/fmtc_intern architecture

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

- Interactive diagram: https://gitdiagram.com/gangheejo/fmtc_intern
- Repository: https://github.com/gangheejo/fmtc_intern

## Overview

This repository is a ROS 2 stack for an S1 autonomous RC car. Camera and lidar nodes produce perception and motion inputs; `decision_auto` combines obstacle, stop-signal, and lane commands, while joystick control feeds the mode-selecting `cmd_mux`. Its output is serialized to the vehicle controller. Separate gap-follow and wall-follow nodes provide alternative lidar-driving behaviors. The README documents the principal topic flow and capabilities; lidar SDK internals are only partly sampled, so their internal edges are limited to visible references.

Main entry points: [`s1_stack/s1_stack/decision_auto.py`](https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/decision_auto.py) (Auto decision), [`s1_stack/s1_stack/cmd_mux.py`](https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/cmd_mux.py) (Mode command mux), [`sllidar_ros2/src/sllidar_node.cpp`](https://github.com/gangheejo/fmtc_intern/blob/main/sllidar_ros2/src/sllidar_node.cpp) (ROS lidar driver), [`lane_trace/lane_trace/lane_trace.py`](https://github.com/gangheejo/fmtc_intern/blob/main/lane_trace/lane_trace/lane_trace.py) (Lane tracing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vision["Camera perception"]
  node_lane["Lane tracing<br/>[lane_trace.py]"]
  node_sign["Sign detection<br/>[sign_detect.py]"]
end

subgraph group_lidar["Lidar sensing"]
  node_lidar_node["ROS lidar driver<br/>[sllidar_node.cpp]"]
end

subgraph group_planning["Driving behaviors"]
  node_obstacle["Obstacle evasion<br/>[obs_evade.py]"]
  node_gap["Gap following<br/>[gap_follow.py]"]
  node_wall["Wall following<br/>[wall_follow.py]"]
  node_decision["Auto decision<br/>[decision_auto.py]"]
end

subgraph group_control["Vehicle control"]
  node_joy_mapper["Manual command<br/>[joy_to_twist.py]"]
  node_mux["Mode command mux<br/>[cmd_mux.py]"]
  node_sender["Serial sender<br/>[serial_sender.py]"]
end

subgraph group_sdk["Lidar SDK"]
  node_sdk_driver["SDK driver"]
  node_unpacker["Scan unpacking<br/>[dataunpacker.cpp]"]
end

node_camera(("Camera topics"))
node_lidar_device(("RPLidar device"))
node_scan(("Laser scan topic"))
node_joystick(("Joystick"))
node_vehicle(("Arduino controller"))

node_camera -->|"publishes images"| node_lane
node_camera -->|"publishes images"| node_sign
node_lane -->|"publishes lane command"| node_decision
node_sign -->|"publishes stop flags"| node_decision
node_lidar_device -->|"sends measurements"| node_lidar_node
node_lidar_node -->|"uses SDK API"| node_sdk_driver
node_sdk_driver -->|"uses unpacker"| node_unpacker
node_lidar_node -->|"publishes scan"| node_scan
node_scan -->|"feeds scan"| node_obstacle
node_scan -->|"feeds scan"| node_gap
node_scan -->|"feeds scan"| node_wall
node_obstacle -->|"publishes obstacle command"| node_decision
node_joystick -->|"publishes input"| node_joy_mapper
node_joy_mapper -->|"publishes manual command"| node_mux
node_joystick -->|"selects mode"| node_mux
node_decision -->|"publishes auto command"| node_mux
node_mux -->|"publishes output command"| node_sender
node_sender -->|"sends serial protocol"| node_vehicle
node_gap -->|"publishes auto command"| node_decision
node_wall -->|"publishes auto command"| node_decision

click node_lane "https://github.com/gangheejo/fmtc_intern/blob/main/lane_trace/lane_trace/lane_trace.py"
click node_sign "https://github.com/gangheejo/fmtc_intern/blob/main/sign_detect/sign_detect/sign_detect.py"
click node_lidar_node "https://github.com/gangheejo/fmtc_intern/blob/main/sllidar_ros2/src/sllidar_node.cpp"
click node_sdk_driver "https://github.com/gangheejo/fmtc_intern/blob/main/sllidar_ros2/sdk/src/sl_lidar_driver.cpp"
click node_unpacker "https://github.com/gangheejo/fmtc_intern/blob/main/sllidar_ros2/sdk/src/dataunpacker/dataunpacker.cpp"
click node_obstacle "https://github.com/gangheejo/fmtc_intern/blob/main/obs_evade/obs_evade/obs_evade.py"
click node_gap "https://github.com/gangheejo/fmtc_intern/blob/main/gap_follow/gap_follow/gap_follow.py"
click node_wall "https://github.com/gangheejo/fmtc_intern/blob/main/wall_follow/wall_follow/wall_follow.py"
click node_decision "https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/decision_auto.py"
click node_joy_mapper "https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/joy_to_twist.py"
click node_mux "https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/cmd_mux.py"
click node_sender "https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/serial_sender.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_lane,node_sign toneBlue
class node_lidar_node toneAmber
class node_obstacle,node_gap,node_wall,node_decision toneMint
class node_joy_mapper,node_mux,node_sender toneRose
class node_sdk_driver,node_unpacker,node_camera,node_lidar_device,node_scan,node_joystick,node_vehicle toneIndigo
```

## Components

### Camera perception

- [Lane tracing](https://github.com/gangheejo/fmtc_intern/blob/main/lane_trace/lane_trace/lane_trace.py): `lane_trace/lane_trace/lane_trace.py`
- [Sign detection](https://github.com/gangheejo/fmtc_intern/blob/main/sign_detect/sign_detect/sign_detect.py): `sign_detect/sign_detect/sign_detect.py`

### Lidar sensing

- [ROS lidar driver](https://github.com/gangheejo/fmtc_intern/blob/main/sllidar_ros2/src/sllidar_node.cpp): `sllidar_ros2/src/sllidar_node.cpp`

### Driving behaviors

- [Obstacle evasion](https://github.com/gangheejo/fmtc_intern/blob/main/obs_evade/obs_evade/obs_evade.py): `obs_evade/obs_evade/obs_evade.py`
- [Gap following](https://github.com/gangheejo/fmtc_intern/blob/main/gap_follow/gap_follow/gap_follow.py): `gap_follow/gap_follow/gap_follow.py`
- [Wall following](https://github.com/gangheejo/fmtc_intern/blob/main/wall_follow/wall_follow/wall_follow.py): `wall_follow/wall_follow/wall_follow.py`
- [Auto decision](https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/decision_auto.py): `s1_stack/s1_stack/decision_auto.py`

### Vehicle control

- [Manual command](https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/joy_to_twist.py): `s1_stack/s1_stack/joy_to_twist.py`
- [Mode command mux](https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/cmd_mux.py): `s1_stack/s1_stack/cmd_mux.py`
- [Serial sender](https://github.com/gangheejo/fmtc_intern/blob/main/s1_stack/s1_stack/serial_sender.py): `s1_stack/s1_stack/serial_sender.py`

### Lidar SDK

- [SDK driver](https://github.com/gangheejo/fmtc_intern/blob/main/sllidar_ros2/sdk/src/sl_lidar_driver.cpp): `sllidar_ros2/sdk/src/sl_lidar_driver.cpp`
- [Scan unpacking](https://github.com/gangheejo/fmtc_intern/blob/main/sllidar_ros2/sdk/src/dataunpacker/dataunpacker.cpp): `sllidar_ros2/sdk/src/dataunpacker/dataunpacker.cpp`

### Other components

- **Camera topics**
- **RPLidar device**
- **Laser scan topic**
- **Joystick**
- **Arduino controller**

## Connections

- Camera topics → Lane tracing: publishes images
- Camera topics → Sign detection: publishes images
- Lane tracing → Auto decision: publishes lane command
- Sign detection → Auto decision: publishes stop flags
- RPLidar device → ROS lidar driver: sends measurements
- ROS lidar driver → SDK driver: uses SDK API (evidence: `sllidar_ros2/src/sllidar_node.cpp`)
- SDK driver → Scan unpacking: uses unpacker (evidence: `sllidar_ros2/sdk/src/sl_lidar_driver.cpp`)
- ROS lidar driver → Laser scan topic: publishes scan
- Laser scan topic → Obstacle evasion: feeds scan
- Laser scan topic → Gap following: feeds scan
- Laser scan topic → Wall following: feeds scan
- Obstacle evasion → Auto decision: publishes obstacle command
- Joystick → Manual command: publishes input
- Manual command → Mode command mux: publishes manual command
- Joystick → Mode command mux: selects mode
- Auto decision → Mode command mux: publishes auto command
- Mode command mux → Serial sender: publishes output command
- Serial sender → Arduino controller: sends serial protocol
- Gap following → Auto decision: publishes auto command
- Wall following → Auto decision: publishes auto command
