# shisatoyano/autonomousvehiclecontrolbeginnersguide architecture

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

- Interactive diagram: https://gitdiagram.com/shisatoyano/autonomousvehiclecontrolbeginnersguide
- Repository: https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide

## Overview

1. This repository is a Python reference implementation of an autonomous-vehicle software stack. It is organized as a set of reusable algorithm modules plus many standalone simulation scripts that exercise them. There is no central runtime service; the system is a library-of-algorithms with scenario runners.

2. The core shared layer lives under `src/components/common`, `array`, `state`, `vehicle`, `obstacle`, `sensors`, and `visualization`. These packages provide the basic data models and math helpers that the higher-level algorithms depend on: vehicle geometry, tire/axle/body models, pose/state, obstacle containers, angle and matrix utilities, array helpers, and plotting/visualization support.

3. The vehicle model boundary is explicit: `src/components/vehicle` contains the kinematic/physical representation used by planners, controllers, and simulators. The main assembly appears to be the four-wheel vehicle abstraction, with a specification object and subparts such as chassis, axles, and tires.

4. Mapping is a separate subsystem under `src/components/mapping`. It includes binary occupancy grids, cost grids, NDT grids/maps, and potential-field maps. These modules transform sensed or synthetic obstacle information into spatial representations used by planners and map-construction simulations.

5. Localization lives under `src/components/localization` and is split by estimator family: Kalman-filter variants, particle filter, and related helpers. These modules consume vehicle/sensor/state data and produce pose estimates, typically for the localization simulations and for downstream control/path-tracking examples.

6. Planning is the largest subsystem, under `src/components/plan`. It contains both graph search and sampling-based planners: A*, bidirectional A*, hybrid A*, Dijkstra, D*, PRM, RRT, RRT*, bidirectional RRT*, informed RRT*, PSO, elastic bands, and gradient-based planning. In the architecture diagram, this layer sits between maps/obstacles and the tracker/controller layer, producing a path for execution.

7. Path tracking/control is under `src/components/control`. It includes Pure Pursuit, Adaptive Pure Pursuit, Rear Wheel Feedback, Stanley, LQR, MPPI, and a trapezoidal speed-profile module. These controllers take a reference path plus the current vehicle state and output steering/speed commands for closed-loop motion following.

8. Perception is represented by `src/components/detection` and parts of `src/components/sensors`. The detection package focuses on L-shape/rectangle fitting from point clouds, while sensor modules model GNSS and omni-directional lidar, scan points, and sensor-parameter calibration. This subsystem bridges raw synthetic sensor output to obstacle estimates and calibration outputs.

9. Search and course-generation are supporting subsystems. `src/components/search/kd_tree` provides nearest-neighbor queries used by point-cloud and sampling-based algorithms, while `src/components/course/cubic_spline_course` generates smooth reference trajectories used by planners and trackers. These are shared algorithmic dependencies rather than standalone end-user features.

10. `src/simulations` is the integration layer. Each subdirectory is a standalone scenario runner that wires together one or more components, loads scenario data such as `map.json`/`path.json`, executes the algorithm, and renders results as plots or GIFs. The simulations are grouped by domain: localization, mapping, path planning, path tracking, perception, and course visualization.

11. The `doc/` tree contains design documents and small visualization scripts that mirror the main subsystems. These are explanatory/educational artifacts rather than runtime dependencies, but they help define the intended module boundaries and data flow for each algorithm family.

12. Tests in `test/` cover nearly every component and simulation category, which suggests the repo is structured for algorithm verification rather than deployment. CI is run across Linux, Windows, and macOS, and the project is packaged for a containerized dev environment, but the architectural center remains the algorithm modules and the simulation harness around them.

Main entry points: [`src/components/mapping/binary/binary_grid_mapper.py`](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/mapping/binary/binary_grid_mapper.py) (Mapping), [`src/components/plan/astar/astar_path_planner.py`](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/plan/astar/astar_path_planner.py) (Planning), [`src/components/control/pure_pursuit/pure_pursuit_controller.py`](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/control/pure_pursuit/pure_pursuit_controller.py) (Control), [`src/simulations/path_planning/astar_path_planning/astar_path_planning.py`](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/simulations/path_planning/astar_path_planning/astar_path_planning.py) (Sim runners)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core models"]
  node_array["Array utils<br/>helper<br/>[xy_array.py]"]
  node_math["Math utils<br/>helper<br/>[angle_lib.py]"]
  node_state["State model<br/>[state.py]"]
  node_vehicle["Vehicle model"]
  node_obstacle["Obstacles<br/>model<br/>[obstacle_list.py]"]
  node_sensors["Sensors<br/>model<br/>[sensors.py]"]
  node_visualization["Viz support"]
  node_source(("Sensor source<br/>[gnss.py]"))
end

subgraph group_algo["Algorithms"]
  node_search["KD tree<br/>search<br/>[kd_tree.py]"]
  node_course["Spline course<br/>trajectory"]
  node_mapping["Mapping"]
  node_localization["Localization<br/>estimator"]
  node_planning["Planning<br/>planner"]
  node_control["Control"]
  node_detection["Detection<br/>perception"]
  node_pathflow{{"Path flow<br/>pipeline"}}
end

subgraph group_sim["Simulations"]
  node_simulations["Sim runners<br/>integration"]
end

subgraph group_docs["Docs"]
  node_docv["Docs<br/>[DESIGN_DOCUMENT.md]"]
end

node_math -->|"geometry"| node_vehicle
node_math -->|"grid math"| node_mapping
node_state -->|"state input"| node_localization
node_vehicle -->|"motion model"| node_localization
node_source -->|"point clouds"| node_detection
node_source -->|"sensed space"| node_mapping
node_obstacle -->|"obstacles"| node_mapping
node_search -->|"neighbor queries"| node_planning
node_course -->|"smooth refs"| node_planning
node_mapping -->|"environment"| node_planning
node_detection -->|"obstacle estimates"| node_mapping
node_planning -->|"reference path"| node_control
node_localization -->|"pose feedback"| node_control
node_vehicle -->|"actuation model"| node_control
node_sensors -->|"measurements"| node_localization
node_sensors -->|"scan data"| node_detection
node_simulations -->|"runs"| node_planning
node_simulations -->|"runs"| node_control
node_simulations -->|"runs"| node_localization
node_simulations -->|"runs"| node_mapping
node_simulations -->|"runs"| node_detection
node_docv -.->|"explains"| node_vehicle
node_docv -.->|"explains"| node_sensors
node_docv -.->|"explains"| node_control
node_pathflow -.->|"input"| node_mapping
node_pathflow -.->|"plan"| node_planning
node_pathflow -.->|"track"| node_control

click node_array "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/array/xy_array.py"
click node_math "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/common/angle_lib.py"
click node_state "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/state/state.py"
click node_vehicle "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/vehicle/four_wheels_vehicle.py"
click node_obstacle "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/obstacle/obstacle_list.py"
click node_sensors "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/sensors/sensors.py"
click node_visualization "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/visualization/global_xy_visualizer.py"
click node_search "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/search/kd_tree/kd_tree.py"
click node_course "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/course/cubic_spline_course/cubic_spline_course.py"
click node_mapping "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/mapping/binary/binary_grid_mapper.py"
click node_localization "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/localization/kalman_filter/extended_kalman_filter_localizer.py"
click node_planning "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/plan/astar/astar_path_planner.py"
click node_control "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/control/pure_pursuit/pure_pursuit_controller.py"
click node_detection "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/detection/l_shape_fitting/l_shape_fitting_detector.py"
click node_simulations "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/simulations/path_planning/astar_path_planning/astar_path_planning.py"
click node_docv "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/doc/DESIGN_DOCUMENT.md"
click node_source "https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/sensors/gnss/gnss.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_array,node_math,node_state,node_vehicle,node_obstacle,node_sensors,node_visualization,node_source toneBlue
class node_search,node_course,node_mapping,node_localization,node_planning,node_control,node_detection,node_pathflow toneAmber
class node_simulations toneMint
class node_docv toneRose
```

## Components

### Core models

Shared math, state, vehicle, obstacle, sensor, and visualization primitives.

- [Array utils](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/array/xy_array.py): helper · Array and XY helper routines used across algorithms. · `src/components/array/xy_array.py`
- [Math utils](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/common/angle_lib.py): helper · Angle, matrix, and plotting helpers shared by many components. · `src/components/common/angle_lib.py`
- [State model](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/state/state.py): model · Vehicle pose and state representation. · `src/components/state/state.py`
- [Vehicle model](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/vehicle/four_wheels_vehicle.py): model · Four-wheel vehicle abstraction with chassis, axles, tires, and specification. · `src/components/vehicle/four_wheels_vehicle.py`
- [Obstacles](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/obstacle/obstacle_list.py): model · Obstacle and obstacle-list containers. · `src/components/obstacle/obstacle_list.py`
- [Sensors](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/sensors/sensors.py): model · GNSS, lidar, scan points, and sensor calibration parameters. · `src/components/sensors/sensors.py`
- [Viz support](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/visualization/global_xy_visualizer.py): support · Global plotting, bounds, and time-parameter helpers. · `src/components/visualization/global_xy_visualizer.py`
- [Sensor source](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/sensors/gnss/gnss.py): sensor · GNSS and lidar data feed into perception, localization, and mapping. · `src/components/sensors/gnss/gnss.py`

### Algorithms

Planning, control, localization, mapping, perception, and search modules.

- [KD tree](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/search/kd_tree/kd_tree.py): search · Nearest-neighbor search used by point-cloud and sampling algorithms. · `src/components/search/kd_tree/kd_tree.py`
- [Spline course](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/course/cubic_spline_course/cubic_spline_course.py): trajectory · Cubic-spline trajectory generation for planners and trackers. · `src/components/course/cubic_spline_course/cubic_spline_course.py`
- [Mapping](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/mapping/binary/binary_grid_mapper.py): map · Binary, cost, NDT, and potential-field map builders and grid maps. · `src/components/mapping/binary/binary_grid_mapper.py`
- [Localization](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/localization/kalman_filter/extended_kalman_filter_localizer.py): estimator · Kalman-filter and particle-filter localization variants. · `src/components/localization/kalman_filter/extended_kalman_filter_localizer.py`
- [Planning](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/plan/astar/astar_path_planner.py): planner · Graph-search, sampling-based, and optimization-based path planners. · `src/components/plan/astar/astar_path_planner.py`
- [Control](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/control/pure_pursuit/pure_pursuit_controller.py): controller · Path-tracking controllers and speed-profile generation. · `src/components/control/pure_pursuit/pure_pursuit_controller.py`
- [Detection](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/components/detection/l_shape_fitting/l_shape_fitting_detector.py): perception · Point-cloud rectangle and obstacle fitting from sensed data. · `src/components/detection/l_shape_fitting/l_shape_fitting_detector.py`
- **Path flow**: pipeline · Representative execution flow from maps and planners to tracking control.

### Simulations

Standalone scenario runners that exercise the algorithms.

- [Sim runners](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/src/simulations/path_planning/astar_path_planning/astar_path_planning.py): integration · Scenario scripts for localization, mapping, planning, tracking, perception, and course visualization. · `src/simulations/path_planning/astar_path_planning/astar_path_planning.py`

### Docs

Design and visualization artifacts that explain the architecture.

- [Docs](https://github.com/shisatoyano/autonomousvehiclecontrolbeginnersguide/blob/main/doc/DESIGN_DOCUMENT.md): doc · Design documents and small visualization scripts mirroring the main subsystems. · `doc/DESIGN_DOCUMENT.md`

## Connections

- Math utils → Vehicle model: geometry · Vehicle geometry and motion helpers depend on shared math utilities.
- Math utils → Mapping: grid math · Mapping uses matrix and angle helpers for grid and field operations.
- State model → Localization: state input · Estimators consume and update vehicle pose/state.
- Vehicle model → Localization: motion model · Localization uses the vehicle model for prediction and state propagation.
- Sensor source → Detection: point clouds · Lidar and sensor outputs feed obstacle/shape fitting.
- Sensor source → Mapping: sensed space · Sensor data is transformed into occupancy, cost, and NDT maps.
- Obstacles → Mapping: obstacles · Map builders ingest obstacle containers or obstacle-like data.
- KD tree → Planning: neighbor queries · Sampling-based planners rely on nearest-neighbor search.
- Spline course → Planning: smooth refs · Spline courses provide smooth reference trajectories and waypoints.
- Mapping → Planning: environment · Planners operate over maps and collision information.
- Detection → Mapping: obstacle estimates · Detected shapes can be turned into map inputs or scene abstractions.
- Planning → Control: reference path · Planners produce paths consumed by tracking controllers.
- Localization → Control: pose feedback · Controllers use estimated pose/state for closed-loop tracking.
- Vehicle model → Control: actuation model · Controllers output commands for the vehicle abstraction.
- Sensors → Localization: measurements · Localization consumes GNSS and lidar-derived measurements.
- Sensors → Detection: scan data · Point-cloud fitting and obstacle detection are built on lidar scans.
- Sim runners → Planning: runs · Scenario runners execute planner variants against maps and paths.
- Sim runners → Control: runs · Tracking simulations wire controllers to reference paths and vehicle state.
- Sim runners → Localization: runs · Localization simulations compare estimator families under scenarios.
- Sim runners → Mapping: runs · Mapping simulations construct and visualize map variants.
- Sim runners → Detection: runs · Perception simulations exercise point-cloud fitting and sensing.
- Docs → Vehicle model: explains · Documentation mirrors the vehicle-model boundary.
- Docs → Sensors: explains · Documentation mirrors sensor and lidar model concepts.
- Docs → Control: explains · Documentation includes controller-focused examples.
- Path flow → Mapping: input · Representative flow starts from maps or environmental context.
- Path flow → Planning: plan · The planning stage generates a path from the environment.
- Path flow → Control: track · Tracking consumes the planned path and vehicle state.
