# yunsu0210/autopilot architecture

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

## Overview

This is a ROS-based Jetson car-autopilot workspace for a Traxxas vehicle. Its principal workflow consumes keyboard commands, LDS-01 laser scans, camera frames, and object-detection bounding boxes; the listener combines these inputs into steering and speed commands sent through a PCA9685 controller. The tree also documents standalone image-processing and lidar-subscriber exercises, and includes earlier listener variants. The README confirms the hardware, but provides little behavioral detail; relationships for unsampled scripts and integrations are therefore limited to documented or excerpted evidence.

Main entry points: [`src/ros_cpp_test/src/listener.cpp`](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener.cpp) (ROS listener), [`src/ros_cpp_test/src/JHPWMPCA9685.cpp`](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/JHPWMPCA9685.cpp) (PCA9685 driver), [`src/ros_cpp_test/src/backup`](https://github.com/yunsu0210/autopilot/tree/master/src/ros_cpp_test/src/backup) (Earlier controllers), [`src/ros_cpp_test/src/listener_yh.cpp`](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener_yh.cpp) (Alternate listener)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ros["ROS Vehicle Control"]
  node_listener["ROS listener<br/>[listener.cpp]"]
  node_scanlogic["Scan navigation<br/>[listener.cpp]"]
  node_signlogic["Detection handling<br/>[listener.cpp]"]
  node_priorlisteners["Earlier controllers"]
  node_listeneryh["Alternate listener<br/>[listener_yh.cpp]"]
end

subgraph group_vision["Vision Processing"]
  node_imagecallback["Camera callback<br/>[listener.cpp]"]
  node_opencv["OpenCV helpers<br/>[OpenCV.cpp]"]
end

subgraph group_hardware["Vehicle Hardware"]
  node_pca["PCA9685 driver<br/>[JHPWMPCA9685.cpp]"]
  node_pcaheader["PCA9685 interface<br/>[JHPWMPCA9685.h]"]
end

subgraph group_exercises["ROS Exercises"]
  node_imageexercise["Image exercise"]
  node_pythonimage["Python image exercise"]
  node_deltaprocess["Delta image exercise"]
  node_keypublisher["Key publisher<br/>[key_publisher.py]"]
  node_keystwist["Keys to twist<br/>[keys_to_twist.py]"]
  node_lidarsubscriber["Lidar subscriber"]
end

node_operator(("Operator"))
node_lidar(("LDS-01 lidar"))
node_camera(("Webcam"))
node_detector(("Object detector"))
node_car(("Traxxas car"))

node_operator -->|"publishes keys"| node_listener
node_lidar -->|"publishes scan"| node_listener
node_detector -->|"publishes boxes"| node_listener
node_camera -->|"publishes images"| node_listener
node_listener -->|"dispatches scan"| node_scanlogic
node_listener -->|"dispatches detections"| node_signlogic
node_listener -->|"dispatches images"| node_imagecallback
node_imagecallback -.->|"uses helpers"| node_opencv
node_listener -->|"sets PWM"| node_pca
node_pca -.->|"drives actuators"| node_car
node_priorlisteners -->|"uses interface"| node_pca
node_listeneryh -->|"uses interface"| node_pca
node_imageexercise -.->|"processes imagery"| node_camera
node_pythonimage -.->|"processes imagery"| node_camera
node_deltaprocess -.->|"processes imagery"| node_camera
node_keypublisher -.->|"captures keys"| node_operator
node_keystwist -.->|"maps commands"| node_listener
node_lidarsubscriber -.->|"subscribes scans"| node_lidar
node_pcaheader -.->|"declares interface"| node_pca

click node_listener "https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener.cpp"
click node_scanlogic "https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener.cpp"
click node_signlogic "https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener.cpp"
click node_imagecallback "https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener.cpp"
click node_opencv "https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/OpenCV.cpp"
click node_pca "https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/JHPWMPCA9685.cpp"
click node_priorlisteners "https://github.com/yunsu0210/autopilot/tree/master/src/ros_cpp_test/src/backup"
click node_listeneryh "https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener_yh.cpp"
click node_imageexercise "https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/image_processing.cpp"
click node_pythonimage "https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/image_processing.py"
click node_deltaprocess "https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/image_processing_delta.cpp"
click node_keypublisher "https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/key_publisher.py"
click node_keystwist "https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/keys_to_twist.py"
click node_lidarsubscriber "https://github.com/yunsu0210/autopilot/blob/master/src/test_lidar/src/hlds_laser_subscribe.py"
click node_pcaheader "https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/JHPWMPCA9685.h"

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_listener,node_scanlogic,node_signlogic,node_priorlisteners,node_listeneryh toneBlue
class node_imagecallback,node_opencv toneAmber
class node_pca,node_pcaheader toneMint
class node_imageexercise,node_pythonimage,node_deltaprocess,node_keypublisher,node_keystwist,node_lidarsubscriber toneRose
class node_operator,node_lidar,node_camera,node_detector,node_car toneIndigo
```

## Components

### ROS Vehicle Control

- [ROS listener](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener.cpp): `src/ros_cpp_test/src/listener.cpp`
- [Scan navigation](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener.cpp): `src/ros_cpp_test/src/listener.cpp`
- [Detection handling](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener.cpp): `src/ros_cpp_test/src/listener.cpp`
- [Earlier controllers](https://github.com/yunsu0210/autopilot/tree/master/src/ros_cpp_test/src/backup): `src/ros_cpp_test/src/backup`
- [Alternate listener](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener_yh.cpp): `src/ros_cpp_test/src/listener_yh.cpp`

### Vision Processing

- [Camera callback](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/listener.cpp): `src/ros_cpp_test/src/listener.cpp`
- [OpenCV helpers](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/OpenCV.cpp): `src/ros_cpp_test/src/OpenCV.cpp`

### Vehicle Hardware

- [PCA9685 driver](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/JHPWMPCA9685.cpp): `src/ros_cpp_test/src/JHPWMPCA9685.cpp`
- [PCA9685 interface](https://github.com/yunsu0210/autopilot/blob/master/src/ros_cpp_test/src/JHPWMPCA9685.h): `src/ros_cpp_test/src/JHPWMPCA9685.h`

### ROS Exercises

- [Image exercise](https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/image_processing.cpp): `src/basics/scripts/image_processing.cpp`
- [Python image exercise](https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/image_processing.py): `src/basics/scripts/image_processing.py`
- [Delta image exercise](https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/image_processing_delta.cpp): `src/basics/scripts/image_processing_delta.cpp`
- [Key publisher](https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/key_publisher.py): `src/basics/scripts/key_publisher.py`
- [Keys to twist](https://github.com/yunsu0210/autopilot/blob/master/src/basics/scripts/keys_to_twist.py): `src/basics/scripts/keys_to_twist.py`
- [Lidar subscriber](https://github.com/yunsu0210/autopilot/blob/master/src/test_lidar/src/hlds_laser_subscribe.py): `src/test_lidar/src/hlds_laser_subscribe.py`

### Other components

- **Operator**
- **LDS-01 lidar**
- **Webcam**
- **Object detector**
- **Traxxas car**

## Connections

- Operator → ROS listener: publishes keys (evidence: `src/ros_cpp_test/src/listener.cpp`)
- LDS-01 lidar → ROS listener: publishes scan (evidence: `src/ros_cpp_test/src/listener.cpp`)
- Object detector → ROS listener: publishes boxes (evidence: `src/ros_cpp_test/src/listener.cpp`)
- Webcam → ROS listener: publishes images (evidence: `src/ros_cpp_test/src/listener.cpp`)
- ROS listener → Scan navigation: dispatches scan (evidence: `src/ros_cpp_test/src/listener.cpp`)
- ROS listener → Detection handling: dispatches detections (evidence: `src/ros_cpp_test/src/listener.cpp`)
- ROS listener → Camera callback: dispatches images (evidence: `src/ros_cpp_test/src/listener.cpp`)
- Camera callback → OpenCV helpers: uses helpers
- ROS listener → PCA9685 driver: sets PWM (evidence: `src/ros_cpp_test/src/listener.cpp`)
- PCA9685 driver → Traxxas car: drives actuators (evidence: `README.md`)
- Earlier controllers → PCA9685 driver: uses interface (evidence: `src/ros_cpp_test/src/backup/listener.cpp`)
- Alternate listener → PCA9685 driver: uses interface (evidence: `src/ros_cpp_test/src/listener_yh.cpp`)
- Image exercise → Webcam: processes imagery
- Python image exercise → Webcam: processes imagery
- Delta image exercise → Webcam: processes imagery
- Key publisher → Operator: captures keys
- Keys to twist → ROS listener: maps commands
- Lidar subscriber → LDS-01 lidar: subscribes scans
- PCA9685 interface → PCA9685 driver: declares interface
