How shisatoyano/autonomousvehiclecontrolbeginnersguide works
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: binary_grid_mapper.py Mapping · astar_path_planner.py Planning · pure_pursuit_controller.py Control · astar_path_planning.py Sim runners
Components 18
Core models
Shared math, state, vehicle, obstacle, sensor, and visualization primitives.
- Array utils · Array and XY helper routines used across algorithms.
src/components/array/xy_array.py - Math utils · Angle, matrix, and plotting helpers shared by many components.
src/components/common/angle_lib.py - State model · Vehicle pose and state representation.
src/components/state/state.py - Vehicle model · Four-wheel vehicle abstraction with chassis, axles, tires, and specification.
src/components/vehicle/four_wheels_vehicle.py - Obstacles · Obstacle and obstacle-list containers.
src/components/obstacle/obstacle_list.py - Sensors · GNSS, lidar, scan points, and sensor calibration parameters.
src/components/sensors/sensors.py - Viz support · Global plotting, bounds, and time-parameter helpers.
src/components/visualization/global_xy_visualizer.py - Sensor source · 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 · Nearest-neighbor search used by point-cloud and sampling algorithms.
src/components/search/kd_tree/kd_tree.py - Spline course · Cubic-spline trajectory generation for planners and trackers.
src/components/course/cubic_spline_course/cubic_spline_course.py - Mapping · Binary, cost, NDT, and potential-field map builders and grid maps.
src/components/mapping/binary/binary_grid_mapper.py - Localization · Kalman-filter and particle-filter localization variants.
src/components/localization/kalman_filter/extended_kalman_filter_localizer.py - Planning · Graph-search, sampling-based, and optimization-based path planners.
src/components/plan/astar/astar_path_planner.py - Control · Path-tracking controllers and speed-profile generation.
src/components/control/pure_pursuit/pure_pursuit_controller.py - Detection · Point-cloud rectangle and obstacle fitting from sensed data.
src/components/detection/l_shape_fitting/l_shape_fitting_detector.py - Path flow · Representative execution flow from maps and planners to tracking control.
Simulations
Standalone scenario runners that exercise the algorithms.
- Sim runners · 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 · Design documents and small visualization scripts mirroring the main subsystems.
doc/DESIGN_DOCUMENT.md
Connections 27
- 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.