# karlavec1k/starpilot architecture

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

- Interactive diagram: https://gitdiagram.com/karlavec1k/starpilot
- Repository: https://github.com/karlavec1k/starpilot

## Overview

StarPilot is a custom openpilot driver-assistance fork. Its core workflow is vehicle-specific: interpret vehicle and CAN data, produce steering and longitudinal commands, then rely on panda safety controls to gate vehicle-bus output. The README also documents navigation, speed and curve controls, driver monitoring, device management, and other vehicle integrations. The graph combines those documented capabilities with relationships visible in the sampled source and SOURCE INDEX; unsampled feature wiring is not asserted.

Main entry points: [`opendbc_repo/opendbc/car/interfaces.py`](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/interfaces.py) (Car Interfaces), [`opendbc_repo/opendbc/can/packer.py`](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/can/packer.py) (CAN Encoding), [`opendbc_repo/opendbc/car/gm/carcontroller.py`](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/gm/carcontroller.py) (Vehicle Control), [`starpilot/navigation/route_engine.py`](https://github.com/karlavec1k/starpilot/blob/StarPilot/starpilot/navigation/route_engine.py) (Navigation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vehicle["Vehicle Integration"]
  node_car_iface["Car Interfaces<br/>[interfaces.py]"]
  node_car_state["Vehicle State<br/>[interfaces.py]"]
  node_car_control["Vehicle Control<br/>[carcontroller.py]"]
  node_hyundai_control["Hyundai Control<br/>[carcontroller.py]"]
  node_toyota_control["Toyota Control<br/>[carcontroller.py]"]
  node_can_codec["CAN Encoding<br/>[packer.py]"]
  node_safety["CAN Safety<br/>[safety.h]"]
end

subgraph group_driving["Driving Features"]
  node_model["Driving Model<br/>[modeld.py]"]
  node_speed_limit["Speed Limits"]
  node_curve_speed["Curve Speed"]
  node_navigation["Navigation<br/>[route_engine.py]"]
  node_adjacent_monitor["Blind-Spot Monitor"]
  node_route_service["Route Service"]
end

subgraph group_platform["Device Platform"]
  node_panda["Panda Firmware<br/>[main.c]"]
  node_manager["Process Manager<br/>[manager.py]"]
  node_messages["Message Schemas<br/>[__init__.py]"]
end

subgraph group_services["Device Services"]
  node_network["Wi-Fi Manager<br/>[wifi_manager.py]"]
  node_bluetooth["Bluetooth Manager"]
  node_portal["Galaxy Portal<br/>[athenad.py]"]
  node_settings_ui["Settings UI"]
  node_ui["Driving UI<br/>[main.py]"]
end

node_driver(("Driver"))

node_driver -.->|"selects vehicle"| node_car_iface
node_car_iface -->|"creates state"| node_car_state
node_car_iface -->|"creates controller"| node_car_control
node_car_control -->|"packs CAN"| node_can_codec
node_hyundai_control -->|"packs CAN"| node_can_codec
node_toyota_control -->|"packs CAN"| node_can_codec
node_panda -->|"configures safety"| node_safety
node_driver -.->|"drives with"| node_model
node_driver -.->|"requests routes"| node_navigation
node_navigation -.->|"requests directions"| node_route_service
node_driver -.->|"uses speed control"| node_speed_limit
node_driver -.->|"uses curve control"| node_curve_speed
node_driver -.->|"uses monitoring"| node_adjacent_monitor
node_manager -->|"uses schemas"| node_messages
node_driver -.->|"configures connectivity"| node_network
node_driver -.->|"connects accessories"| node_bluetooth
node_driver -.->|"manages device"| node_portal
node_driver -.->|"changes settings"| node_settings_ui
node_driver -.->|"views driving"| node_ui

click node_car_iface "https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/interfaces.py"
click node_car_state "https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/interfaces.py"
click node_car_control "https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/gm/carcontroller.py"
click node_hyundai_control "https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/hyundai/carcontroller.py"
click node_toyota_control "https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/toyota/carcontroller.py"
click node_can_codec "https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/can/packer.py"
click node_safety "https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/safety/safety.h"
click node_panda "https://github.com/karlavec1k/starpilot/blob/StarPilot/panda/board/main.c"
click node_model "https://github.com/karlavec1k/starpilot/blob/StarPilot/selfdrive/modeld/modeld.py"
click node_speed_limit "https://github.com/karlavec1k/starpilot/blob/StarPilot/starpilot/controls/lib/speed_limit_controller.py"
click node_curve_speed "https://github.com/karlavec1k/starpilot/blob/StarPilot/starpilot/controls/lib/curve_speed_controller.py"
click node_navigation "https://github.com/karlavec1k/starpilot/blob/StarPilot/starpilot/navigation/route_engine.py"
click node_adjacent_monitor "https://github.com/karlavec1k/starpilot/blob/StarPilot/starpilot/system/adj_spot_monitor_vision_inference.py"
click node_manager "https://github.com/karlavec1k/starpilot/blob/StarPilot/system/manager/manager.py"
click node_messages "https://github.com/karlavec1k/starpilot/blob/StarPilot/cereal/__init__.py"
click node_network "https://github.com/karlavec1k/starpilot/blob/StarPilot/system/ui/lib/wifi_manager.py"
click node_bluetooth "https://github.com/karlavec1k/starpilot/blob/StarPilot/system/ui/lib/bluetooth_manager.py"
click node_portal "https://github.com/karlavec1k/starpilot/blob/StarPilot/system/athena/athenad.py"
click node_settings_ui "https://github.com/karlavec1k/starpilot/blob/StarPilot/selfdrive/ui/layouts/settings/starpilot/simple_download_manager.py"
click node_ui "https://github.com/karlavec1k/starpilot/blob/StarPilot/selfdrive/ui/layouts/main.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_car_iface,node_car_state,node_car_control,node_hyundai_control,node_toyota_control,node_can_codec,node_safety toneBlue
class node_model,node_speed_limit,node_curve_speed,node_navigation,node_adjacent_monitor,node_route_service toneAmber
class node_panda,node_manager,node_messages toneMint
class node_network,node_bluetooth,node_portal,node_settings_ui,node_ui toneRose
class node_driver toneIndigo
```

## Components

### Vehicle Integration

- [Car Interfaces](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/interfaces.py): `opendbc_repo/opendbc/car/interfaces.py`
- [Vehicle State](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/interfaces.py): `opendbc_repo/opendbc/car/interfaces.py`
- [Vehicle Control](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/gm/carcontroller.py): `opendbc_repo/opendbc/car/gm/carcontroller.py`
- [Hyundai Control](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/hyundai/carcontroller.py): `opendbc_repo/opendbc/car/hyundai/carcontroller.py`
- [Toyota Control](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/car/toyota/carcontroller.py): `opendbc_repo/opendbc/car/toyota/carcontroller.py`
- [CAN Encoding](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/can/packer.py): `opendbc_repo/opendbc/can/packer.py`
- [CAN Safety](https://github.com/karlavec1k/starpilot/blob/StarPilot/opendbc_repo/opendbc/safety/safety.h): `opendbc_repo/opendbc/safety/safety.h`

### Driving Features

- [Driving Model](https://github.com/karlavec1k/starpilot/blob/StarPilot/selfdrive/modeld/modeld.py): `selfdrive/modeld/modeld.py`
- [Speed Limits](https://github.com/karlavec1k/starpilot/blob/StarPilot/starpilot/controls/lib/speed_limit_controller.py): `starpilot/controls/lib/speed_limit_controller.py`
- [Curve Speed](https://github.com/karlavec1k/starpilot/blob/StarPilot/starpilot/controls/lib/curve_speed_controller.py): `starpilot/controls/lib/curve_speed_controller.py`
- [Navigation](https://github.com/karlavec1k/starpilot/blob/StarPilot/starpilot/navigation/route_engine.py): `starpilot/navigation/route_engine.py`
- [Blind-Spot Monitor](https://github.com/karlavec1k/starpilot/blob/StarPilot/starpilot/system/adj_spot_monitor_vision_inference.py): `starpilot/system/adj_spot_monitor_vision_inference.py`
- **Route Service**

### Device Platform

- [Panda Firmware](https://github.com/karlavec1k/starpilot/blob/StarPilot/panda/board/main.c): `panda/board/main.c`
- [Process Manager](https://github.com/karlavec1k/starpilot/blob/StarPilot/system/manager/manager.py): `system/manager/manager.py`
- [Message Schemas](https://github.com/karlavec1k/starpilot/blob/StarPilot/cereal/__init__.py): `cereal/__init__.py`

### Device Services

- [Wi-Fi Manager](https://github.com/karlavec1k/starpilot/blob/StarPilot/system/ui/lib/wifi_manager.py): `system/ui/lib/wifi_manager.py`
- [Bluetooth Manager](https://github.com/karlavec1k/starpilot/blob/StarPilot/system/ui/lib/bluetooth_manager.py): `system/ui/lib/bluetooth_manager.py`
- [Galaxy Portal](https://github.com/karlavec1k/starpilot/blob/StarPilot/system/athena/athenad.py): `system/athena/athenad.py`
- [Settings UI](https://github.com/karlavec1k/starpilot/blob/StarPilot/selfdrive/ui/layouts/settings/starpilot/simple_download_manager.py): `selfdrive/ui/layouts/settings/starpilot/simple_download_manager.py`
- [Driving UI](https://github.com/karlavec1k/starpilot/blob/StarPilot/selfdrive/ui/layouts/main.py): `selfdrive/ui/layouts/main.py`

### Other components

- **Driver**

## Connections

- Driver → Car Interfaces: selects vehicle
- Car Interfaces → Vehicle State: creates state (evidence: `opendbc_repo/opendbc/car/interfaces.py`)
- Car Interfaces → Vehicle Control: creates controller (evidence: `opendbc_repo/opendbc/car/interfaces.py`)
- Vehicle Control → CAN Encoding: packs CAN (evidence: `opendbc_repo/opendbc/car/gm/carcontroller.py`)
- Hyundai Control → CAN Encoding: packs CAN (evidence: `opendbc_repo/opendbc/car/hyundai/carcontroller.py`)
- Toyota Control → CAN Encoding: packs CAN (evidence: `opendbc_repo/opendbc/car/toyota/carcontroller.py`)
- Panda Firmware → CAN Safety: configures safety (evidence: `panda/board/main.c`)
- Driver → Driving Model: drives with
- Driver → Navigation: requests routes
- Navigation → Route Service: requests directions
- Driver → Speed Limits: uses speed control
- Driver → Curve Speed: uses curve control
- Driver → Blind-Spot Monitor: uses monitoring
- Process Manager → Message Schemas: uses schemas (evidence: `system/manager/manager.py`)
- Driver → Wi-Fi Manager: configures connectivity
- Driver → Bluetooth Manager: connects accessories
- Driver → Galaxy Portal: manages device
- Driver → Settings UI: changes settings
- Driver → Driving UI: views driving
