Learn autonomous driving by building it. Python simulations and an open textbook of self-driving car algorithms (localization, mapping, path planning, path tracking, perception and control), and of the software architecture designed to connect them into one autonomous driving system.
PythonRobotics shows each robotics algorithm on its own. This project builds one self-driving system and swaps the algorithms inside it. You can already see the idea in localization, where EKF, UKF and a particle filter drive the same course side by side, with the same motion model and GNSS noise settings; the other stages are moving into one shared system step by step (see the roadmap).
Read the book · See all simulations · Quick start
![]() Localization: EKF vs UKF vs PF |
Path tracking: MPPI |
![]() Path planning: Hybrid A* |
![]() Mapping: NDT |
![]() Mapping: cost map |
![]() Perception: rectangle fitting |
Where to start
- To learn control, read Chapter 3: The Vehicle Model, then 4.2 Pure Pursuit and 4.3 Stanley.
- To learn estimation, read Chapter 3, then 6.2 Extended Kalman filter, and compare it with UKF and a particle filter in
ekf_ukf_pf_comparison. - To just run something, follow the Quick start, then pick any simulation from the gallery.
- About this project
- Requirements
- Quick Start
- Examples of Simulation
- The book
- License
- Citing
- Use Case
- Contribution
- Support this project
- Author
Every algorithm is a small Python simulation with an animation, written to be easy to read rather than fast or complete. You can run each one with a single command, change its parameters and see what happens. Fork it and use it for studying, teaching or your own work.
Beyond single algorithms, the architecture and roadmap describe where the code is heading: stages that pass data to each other through small interfaces, so that one algorithm can be swapped for another, with the true state kept apart from the estimates. The code is moving there step by step.
To run autonomous driving on real vehicles, look at Autoware, open-source autonomous driving software built on ROS 2. It has the same stages as this book, such as localization, perception, planning and control, and some of the algorithms here, such as Pure Pursuit and MPC, have counterparts there.
Choose one of the three setups in Quick Start:
- A. Dev Container: Install Docker and VS Code with the Dev Containers extension.
- B. Docker shell: Install Docker.
- C. Local Python: Install Python 3.14.x on Linux, Windows or macOS. Follow Quick Start to create a virtual environment and install the packages in requirements.txt.
For options A and B, also set up an X server to display the animations (see the note in Quick Start).
$ git clone https://github.com/ShisatoYano/AutonomousVehicleControlBeginnersGuide
$ cd AutonomousVehicleControlBeginnersGuideChoose one of the following options.
Note for options A and B: The container shows the animations through your host's X11 display.
- Linux: Allow local connections to your X server before starting the container. This setting is reset when you log out, so run it again after logging in (or run it automatically at login).
This allows any local process on your machine to connect to your X server, so be careful on a shared machine.
$ xhost +local:
- Windows / macOS: You need an X server that the container can connect to, such as WSLg on WSL2 or XQuartz on macOS.
- Install Docker and VS Code with the Dev Containers extension
- Open this repository's folder in VS Code
- Run
Dev Containers: Reopen in Containerfrom the Command Palette - All required libraries are installed automatically. Run the commands in the following steps in VS Code's terminal
- Install Docker
- Build and start the container, and then open a shell in it
$ docker compose up -d --build $ docker compose exec simulation bash - Run the commands in the following steps in this shell. To stop the container, run
docker compose downon your host
- Install Python 3.14.x
- Create a virtual environment and install the required libraries
- Linux / macOS:
$ python3 -m venv .venv $ source .venv/bin/activate $ pip install -r requirements.txt - Windows (PowerShell):
> python -m venv .venv > .venv\Scripts\Activate.ps1 > pip install -r requirements.txt
- Linux / macOS:
Each simulation runs with one command. For example, localization with an Extended Kalman Filter, where the vehicle estimates its position from sensor observations while following a course:
$ python src/simulations/localization/extended_kalman_filter_localization/extended_kalman_filter_localization.pyYou can find all simulations in doc/EXAMPLES.md.
To try one without installing anything, run the Pure Pursuit path tracking simulation in Google Colab:
You can confirm that the environment is set up correctly by running the unit tests.
$ . run_test_suites.shOn Windows without Docker, run run_test_suites.bat instead.
If this guide helped you understand an algorithm, consider giving the repository a star.
Every algorithm has a runnable simulation with an animated demo, in these categories: localization, mapping, path planning, path tracking, perception and course generation. The full list with the demo GIFs is generated from src/simulations: see doc/EXAMPLES.md.
The explanations are published as a free web book: https://shisatoyano.github.io/AutonomousVehicleControlBeginnersGuide/. Each chapter is planned to add one stage to the system and to explain the theory with equations and figures, show where each equation lives in the code, and suggest experiments to try. It is being written in the open (see the documentation roadmap). Comments and ideas are welcome in the Book category of Discussions, and anyone can help write a chapter: see the writing guide.
If you use this project in your research or teaching, please cite it. Click "Cite this repository" on the right side of the repository page to get the citation in APA or BibTeX format, or see CITATION.cff.
I started this project to teach myself how autonomous vehicles work by implementing their algorithms in Python. You can run the simulations to study an algorithm on your own, demonstrate it in class, or compare approaches for research and development.
- Vectioneer: an AGV path tracking demo by Philippe Piatkiewitz, built on the Pure Pursuit code with changes such as stopping and re-orienting at the last waypoint and driving backwards (video)
If you use the project, share your paper, animation or video in Show and tell.
- Robotics Coursework, under "Hands-on and Blogs", tagged Fundamental Knowledge (Curated)
- best-of-robot-simulators, under "Robotic simulators in 2D"
Contributions are welcome, through issues or pull requests. Please read how to contribute first.
Questions about the algorithms or the code are welcome in Q&A, and feedback on the book in Book.
If you are looking for a place to start, see the good first issues and the roadmap issue.
This project is free and will stay free. If it helps you, you can support it through GitHub Sponsors. Your sponsorship pays for:
- Time to write the web book (#165)
- Time to add algorithms and grow the code into a full navigation system (#131)
- Time to review pull requests and keep the project maintained
Sponsors are thanked by name on the book's acknowledgments page and, depending on the tier, also here in the README (corporate sponsors with their logo). Only public sponsors are listed; if you'd rather not be listed, just tell me. Sponsorship doesn't include individual support: questions are answered for everyone in Q&A.
No sponsors yet. Be the first one!
Development tools are provided free of charge by JetBrains through their open source program.




