# bkairat/lar architecture

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

- Interactive diagram: https://gitdiagram.com/bkairat/lar
- Repository: https://github.com/bkairat/lar

## Overview

LAR is a TurtleBot garage-finding and parking project. The documented offline workflow analyzes an image, builds a map, finds a route and displays it; the robot workflow adds camera-based alignment, route execution and parking. The graph also includes the angle model and dataset utilities that support image interpretation. Relationships are based on the shown excerpts, SOURCE INDEX references, or README; unsampled implementation details are omitted.

Main entry points: [`image_analysis.py`](https://github.com/bkairat/lar/blob/main/image_analysis.py) (Image analysis), [`porobeno.py`](https://github.com/bkairat/lar/blob/main/porobeno.py) (Robot mission), [`dataset.py`](https://github.com/bkairat/lar/blob/main/dataset.py) (Dataset utilities), [`geometry.py`](https://github.com/bkairat/lar/blob/main/geometry.py) (Geometry helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_vision["Image interpretation"]
  node_analysis["Image analysis<br/>[image_analysis.py]"]
  node_distance["Distance estimation<br/>[distance.py]"]
  node_geometry["Geometry helpers<br/>[geometry.py]"]
end

subgraph group_planning["Map and planning"]
  node_main["Image demo<br/>[main.py]"]
  node_map["Map and route search<br/>[map.py]"]
end

subgraph group_robot["Robot operation"]
  node_robot_app["Robot mission<br/>[porobeno.py]"]
  node_motion["Motion commands<br/>[move_cmd.py]"]
  node_parking["Centering and parking<br/>[parking_cmd.py]"]
end

subgraph group_model["Angle model and data"]
  node_angles["Angle prediction<br/>[angles.py]"]
  node_dataset["Dataset utilities<br/>[dataset.py]"]
  node_least_squares["Curve fitting<br/>[least_squares.py]"]
  node_neuron_web["Dataset consumer<br/>[neuron_web.py]"]
end

node_user(("Operator"))
node_turtlebot["TurtleBot"]

node_user -->|"runs demo"| node_main
node_main -->|"analyzes image"| node_analysis
node_main -->|"builds map"| node_map
node_analysis -->|"predicts angle"| node_angles
node_analysis -->|"estimates distance"| node_distance
node_analysis -->|"uses geometry"| node_geometry
node_map -->|"uses geometry"| node_geometry
node_robot_app -->|"reads sensors"| node_turtlebot
node_robot_app -->|"analyzes camera"| node_analysis
node_robot_app -->|"plans route"| node_map
node_robot_app -->|"executes route"| node_motion
node_robot_app -->|"starts parking"| node_parking
node_motion -->|"sends velocity"| node_turtlebot
node_parking -->|"reads depth and drives"| node_turtlebot
node_parking -->|"checks alignment"| node_analysis
node_parking -->|"rotates robot"| node_motion
node_angles -->|"loads training data"| node_dataset
node_angles -->|"measures segments"| node_geometry
node_dataset -->|"computes ratios"| node_geometry
node_distance -->|"creates distance data"| node_dataset
node_distance -->|"uses measurements"| node_geometry
node_least_squares -->|"loads distance data"| node_dataset
node_neuron_web -->|"uses dataset utilities"| node_dataset

click node_main "https://github.com/bkairat/lar/blob/main/main.py"
click node_analysis "https://github.com/bkairat/lar/blob/main/image_analysis.py"
click node_angles "https://github.com/bkairat/lar/blob/main/angles.py"
click node_distance "https://github.com/bkairat/lar/blob/main/distance.py"
click node_geometry "https://github.com/bkairat/lar/blob/main/geometry.py"
click node_map "https://github.com/bkairat/lar/blob/main/map.py"
click node_robot_app "https://github.com/bkairat/lar/blob/main/porobeno.py"
click node_motion "https://github.com/bkairat/lar/blob/main/move_cmd.py"
click node_parking "https://github.com/bkairat/lar/blob/main/parking_cmd.py"
click node_dataset "https://github.com/bkairat/lar/blob/main/dataset.py"
click node_least_squares "https://github.com/bkairat/lar/blob/main/least_squares.py"
click node_neuron_web "https://github.com/bkairat/lar/blob/main/neuron_web.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_analysis,node_distance,node_geometry toneBlue
class node_main,node_map toneAmber
class node_robot_app,node_motion,node_parking toneMint
class node_angles,node_dataset,node_least_squares,node_neuron_web toneRose
class node_user,node_turtlebot toneIndigo
```

## Components

### Image interpretation

- [Image analysis](https://github.com/bkairat/lar/blob/main/image_analysis.py): `image_analysis.py`
- [Distance estimation](https://github.com/bkairat/lar/blob/main/distance.py): `distance.py`
- [Geometry helpers](https://github.com/bkairat/lar/blob/main/geometry.py): `geometry.py`

### Map and planning

- [Image demo](https://github.com/bkairat/lar/blob/main/main.py): `main.py`
- [Map and route search](https://github.com/bkairat/lar/blob/main/map.py): `map.py`

### Robot operation

- [Robot mission](https://github.com/bkairat/lar/blob/main/porobeno.py): `porobeno.py`
- [Motion commands](https://github.com/bkairat/lar/blob/main/move_cmd.py): `move_cmd.py`
- [Centering and parking](https://github.com/bkairat/lar/blob/main/parking_cmd.py): `parking_cmd.py`

### Angle model and data

- [Angle prediction](https://github.com/bkairat/lar/blob/main/angles.py): `angles.py`
- [Dataset utilities](https://github.com/bkairat/lar/blob/main/dataset.py): `dataset.py`
- [Curve fitting](https://github.com/bkairat/lar/blob/main/least_squares.py): `least_squares.py`
- [Dataset consumer](https://github.com/bkairat/lar/blob/main/neuron_web.py): `neuron_web.py`

### Other components

- **Operator**
- **TurtleBot**

## Connections

- Operator → Image demo: runs demo (evidence: `README.md`)
- Image demo → Image analysis: analyzes image (evidence: `main.py`)
- Image demo → Map and route search: builds map (evidence: `main.py`)
- Image analysis → Angle prediction: predicts angle (evidence: `image_analysis.py`)
- Image analysis → Distance estimation: estimates distance (evidence: `image_analysis.py`)
- Image analysis → Geometry helpers: uses geometry (evidence: `image_analysis.py`)
- Map and route search → Geometry helpers: uses geometry (evidence: `map.py`)
- Robot mission → TurtleBot: reads sensors (evidence: `porobeno.py`)
- Robot mission → Image analysis: analyzes camera (evidence: `porobeno.py`)
- Robot mission → Map and route search: plans route (evidence: `porobeno.py`)
- Robot mission → Motion commands: executes route (evidence: `porobeno.py`)
- Robot mission → Centering and parking: starts parking (evidence: `porobeno.py`)
- Motion commands → TurtleBot: sends velocity (evidence: `move_cmd.py`)
- Centering and parking → TurtleBot: reads depth and drives (evidence: `parking_cmd.py`)
- Centering and parking → Image analysis: checks alignment (evidence: `parking_cmd.py`)
- Centering and parking → Motion commands: rotates robot (evidence: `parking_cmd.py`)
- Angle prediction → Dataset utilities: loads training data (evidence: `angles.py`)
- Angle prediction → Geometry helpers: measures segments (evidence: `angles.py`)
- Dataset utilities → Geometry helpers: computes ratios (evidence: `dataset.py`)
- Distance estimation → Dataset utilities: creates distance data (evidence: `distance.py`)
- Distance estimation → Geometry helpers: uses measurements (evidence: `distance.py`)
- Curve fitting → Dataset utilities: loads distance data (evidence: `least_squares.py`)
- Dataset consumer → Dataset utilities: uses dataset utilities (evidence: `neuron_web.py`)
