# mikehammy/robo-car architecture

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

- Interactive diagram: https://gitdiagram.com/mikehammy/robo-car
- Repository: https://github.com/mikehammy/robo-car

## Overview

robo_drive is BeagleY-AI RC-car software with web and IR manual controls and an ultrasonic wall-avoiding mode. Users issue commands through a browser or remote; the main program starts the interfaces and control modules, while carControl applies requests, enforces safety and mode rules, and is the sole motor-driving authority. The graph preserves the sensor-sampling, autonomy, and hardware layers. Relationships are based on the README and shown source/index references; unsampled implementation details are not inferred.

Main entry points: [`app/src/main.c`](https://github.com/mikehammy/robo-car/blob/main/app/src/main.c) (Application startup), [`app/src/carControl.c`](https://github.com/mikehammy/robo-car/blob/main/app/src/carControl.c) (Car control), [`app/src/remoteController.c`](https://github.com/mikehammy/robo-car/blob/main/app/src/remoteController.c) (Remote controller), [`app/src/webServer.c`](https://github.com/mikehammy/robo-car/blob/main/app/src/webServer.c) (Web server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application lifecycle"]
  node_main["Application startup<br/>[main.c]"]
  node_shutdown["Shutdown handling<br/>[shutdown.c]"]
end

subgraph group_interfaces["User interfaces"]
  node_web["Web server<br/>[webServer.c]"]
  node_remote_controller["Remote controller<br/>[remoteController.c]"]
  node_ir_remote["IR command receiver<br/>[irRemote.c]"]
  node_ir_decoder["NEC frame decoder<br/>[irDecoder.c]"]
end

subgraph group_control["Driving and autonomy"]
  node_car_control["Car control<br/>[carControl.c]"]
  node_autonomy["Obstacle avoidance<br/>[autonomy.c]"]
  node_drive["Drive commands<br/>[drive.c]"]
end

subgraph group_sensing["Distance sensing"]
  node_distance_sampler["Distance sampler<br/>[distanceSampler.c]"]
  node_ultrasonic["HC-SR04 access<br/>[ultrasonic.c]"]
end

subgraph group_hardware["Hardware access"]
  node_gpio["GPIO wrapper<br/>[gpio.c]"]
  node_motors["Motor driver access<br/>[motors.c]"]
  node_receiver["IR receiver access<br/>[receiver.c]"]
  node_time_utils["Time utilities<br/>[timeUtils.c]"]
end

node_browser(("Browser"))
node_ir_user(("IR remote"))

node_browser -->|"sends requests"| node_web
node_ir_user -->|"sends buttons"| node_remote_controller
node_main -->|"initializes and waits"| node_shutdown
node_main -->|"initializes and cleans"| node_gpio
node_main -->|"initializes and cleans"| node_motors
node_main -->|"starts and stops"| node_distance_sampler
node_main -->|"starts and stops"| node_car_control
node_main -->|"starts and stops"| node_remote_controller
node_main -->|"starts and stops"| node_web
node_web -->|"requests actions"| node_car_control
node_web -->|"requests shutdown"| node_shutdown
node_remote_controller -->|"reads commands"| node_ir_remote
node_remote_controller -->|"requests actions"| node_car_control
node_remote_controller -->|"reads time"| node_time_utils
node_ir_remote -->|"decodes frames"| node_ir_decoder
node_ir_remote -->|"reads pulses"| node_receiver
node_car_control -->|"runs autonomy"| node_autonomy
node_car_control -->|"reads measurements"| node_distance_sampler
node_car_control -->|"executes commands"| node_drive
node_car_control -->|"checks timeouts"| node_time_utils
node_distance_sampler -->|"takes measurements"| node_ultrasonic
node_distance_sampler -->|"timestamps readings"| node_time_utils
node_drive -->|"sets directions"| node_motors
node_motors -->|"controls pins"| node_gpio
node_ultrasonic -->|"uses GPIO lines"| node_gpio

click node_main "https://github.com/mikehammy/robo-car/blob/main/app/src/main.c"
click node_shutdown "https://github.com/mikehammy/robo-car/blob/main/app/src/shutdown.c"
click node_web "https://github.com/mikehammy/robo-car/blob/main/app/src/webServer.c"
click node_remote_controller "https://github.com/mikehammy/robo-car/blob/main/app/src/remoteController.c"
click node_ir_remote "https://github.com/mikehammy/robo-car/blob/main/app/src/irRemote.c"
click node_ir_decoder "https://github.com/mikehammy/robo-car/blob/main/app/src/irDecoder.c"
click node_car_control "https://github.com/mikehammy/robo-car/blob/main/app/src/carControl.c"
click node_autonomy "https://github.com/mikehammy/robo-car/blob/main/app/src/autonomy.c"
click node_drive "https://github.com/mikehammy/robo-car/blob/main/app/src/drive.c"
click node_distance_sampler "https://github.com/mikehammy/robo-car/blob/main/app/src/distanceSampler.c"
click node_ultrasonic "https://github.com/mikehammy/robo-car/blob/main/hal/src/ultrasonic.c"
click node_gpio "https://github.com/mikehammy/robo-car/blob/main/hal/src/gpio.c"
click node_motors "https://github.com/mikehammy/robo-car/blob/main/hal/src/motors.c"
click node_receiver "https://github.com/mikehammy/robo-car/blob/main/hal/src/receiver.c"
click node_time_utils "https://github.com/mikehammy/robo-car/blob/main/hal/src/timeUtils.c"

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_main,node_shutdown,node_browser toneBlue
class node_web,node_remote_controller,node_ir_remote,node_ir_decoder toneAmber
class node_car_control,node_autonomy,node_drive toneMint
class node_distance_sampler,node_ultrasonic toneRose
class node_gpio,node_motors,node_receiver,node_time_utils,node_ir_user toneIndigo
```

## Components

### Application lifecycle

- [Application startup](https://github.com/mikehammy/robo-car/blob/main/app/src/main.c): `app/src/main.c`
- [Shutdown handling](https://github.com/mikehammy/robo-car/blob/main/app/src/shutdown.c): `app/src/shutdown.c`

### User interfaces

- [Web server](https://github.com/mikehammy/robo-car/blob/main/app/src/webServer.c): `app/src/webServer.c`
- [Remote controller](https://github.com/mikehammy/robo-car/blob/main/app/src/remoteController.c): `app/src/remoteController.c`
- [IR command receiver](https://github.com/mikehammy/robo-car/blob/main/app/src/irRemote.c): `app/src/irRemote.c`
- [NEC frame decoder](https://github.com/mikehammy/robo-car/blob/main/app/src/irDecoder.c): `app/src/irDecoder.c`

### Driving and autonomy

- [Car control](https://github.com/mikehammy/robo-car/blob/main/app/src/carControl.c): `app/src/carControl.c`
- [Obstacle avoidance](https://github.com/mikehammy/robo-car/blob/main/app/src/autonomy.c): `app/src/autonomy.c`
- [Drive commands](https://github.com/mikehammy/robo-car/blob/main/app/src/drive.c): `app/src/drive.c`

### Distance sensing

- [Distance sampler](https://github.com/mikehammy/robo-car/blob/main/app/src/distanceSampler.c): `app/src/distanceSampler.c`
- [HC-SR04 access](https://github.com/mikehammy/robo-car/blob/main/hal/src/ultrasonic.c): `hal/src/ultrasonic.c`

### Hardware access

- [GPIO wrapper](https://github.com/mikehammy/robo-car/blob/main/hal/src/gpio.c): `hal/src/gpio.c`
- [Motor driver access](https://github.com/mikehammy/robo-car/blob/main/hal/src/motors.c): `hal/src/motors.c`
- [IR receiver access](https://github.com/mikehammy/robo-car/blob/main/hal/src/receiver.c): `hal/src/receiver.c`
- [Time utilities](https://github.com/mikehammy/robo-car/blob/main/hal/src/timeUtils.c): `hal/src/timeUtils.c`

### Other components

- **Browser**
- **IR remote**

## Connections

- Browser → Web server: sends requests (evidence: `README.md`)
- IR remote → Remote controller: sends buttons (evidence: `README.md`)
- Application startup → Shutdown handling: initializes and waits (evidence: `app/src/main.c`)
- Application startup → GPIO wrapper: initializes and cleans (evidence: `app/src/main.c`)
- Application startup → Motor driver access: initializes and cleans (evidence: `app/src/main.c`)
- Application startup → Distance sampler: starts and stops (evidence: `app/src/main.c`)
- Application startup → Car control: starts and stops (evidence: `app/src/main.c`)
- Application startup → Remote controller: starts and stops (evidence: `app/src/main.c`)
- Application startup → Web server: starts and stops (evidence: `app/src/main.c`)
- Web server → Car control: requests actions (evidence: `README.md`)
- Web server → Shutdown handling: requests shutdown (evidence: `app/src/webServer.c`)
- Remote controller → IR command receiver: reads commands (evidence: `app/src/remoteController.c`)
- Remote controller → Car control: requests actions (evidence: `app/src/remoteController.c`)
- Remote controller → Time utilities: reads time (evidence: `app/src/remoteController.c`)
- IR command receiver → NEC frame decoder: decodes frames (evidence: `app/src/irRemote.c`)
- IR command receiver → IR receiver access: reads pulses (evidence: `app/src/irRemote.c`)
- Car control → Obstacle avoidance: runs autonomy (evidence: `README.md`)
- Car control → Distance sampler: reads measurements (evidence: `app/src/carControl.c`)
- Car control → Drive commands: executes commands (evidence: `app/src/carControl.c`)
- Car control → Time utilities: checks timeouts (evidence: `app/src/carControl.c`)
- Distance sampler → HC-SR04 access: takes measurements (evidence: `app/src/distanceSampler.c`)
- Distance sampler → Time utilities: timestamps readings (evidence: `app/src/distanceSampler.c`)
- Drive commands → Motor driver access: sets directions (evidence: `app/src/drive.c`)
- Motor driver access → GPIO wrapper: controls pins (evidence: `hal/src/motors.c`)
- HC-SR04 access → GPIO wrapper: uses GPIO lines (evidence: `hal/src/ultrasonic.c`)
