需 Python 3.13.x,MPC 路径跟踪还要额外安装 CasADi 和 do-mpc;Docker 方案需先配置 X11(Linux 执行 xhost +local:,Windows/macOS 需 WSLg 或 XQuartz)才能看到动画;README 主要面向 Linux,Windows 无 Docker 时单元测试改用 run_test_suites.bat。
AutonomousVehicleControlBeginnersGuide
ShisatoYanoMIT活跃维护用 Python 仿真加开源教材一步步搭建自动驾驶系统,可在同一框架里替换对比定位、规划与控制算法,适合入门学习。
Learn autonomous driving by building it: Python simulations and an open textbook where the system grows one stage at a time. Swap and compare localization, planning and control algorithms in the same system.
git clone https://github.com/ShisatoYano/AutonomousVehicleControlBeginnersGuide
cd AutonomousVehicleControlBeginnersGuide
pip install -r requirements.txt
python src/simulations/localization/extended_kalman_filter_localization/extended_kalman_filter_localization.pyREADME 未说明显存或 GPU 要求;仿真基于 Python 与 Matplotlib,在原生或虚拟机 Linux 上运行,Docker 方案需通过宿主机 X11 显示动画。
用 Python 仿真和开源教材逐阶段搭建自动驾驶系统,可替换对比各环节算法
用 Python 仿真加开源教材一步步搭建自动驾驶系统,可在同一框架里替换对比定位、规划与控制算法,适合入门学习。
核心能力
- 每个算法都是带单命令动画仿真的小型 Python 程序
- 覆盖定位、建图、路径规划、路径跟踪、感知与控制
- 用统一接口在同一系统中替换并对比各阶段算法
- 配套免费在线教材,讲理论、代码位置与实验
- 提供架构文档说明各阶段间数据传递与真值分离
容易踩的坑
暂无 release 数据(可能没有发版,或尚未同步)。
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
AutonomousVehicleControlBeginnersGuide
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 that connects them into one autonomous driving system. The system grows one stage at a time, and you can swap and compare the algorithms of each stage in the same system.
Read the book · See all simulations · Quick start
Table of Contents
- About this project
- Requirements
- Quick Start
- Examples of Simulation
- The book
- License
- Citing
- Use Case
- Contribution
- Author
About this project
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 project shows how they work together: how the stages of an autonomous driving system pass data to each other, why the true state and the estimates are kept apart, and how small interfaces let you swap one algorithm for another. The architecture and roadmap explain the design, which the code is moving toward step by step (see the roadmap issue).
Requirements
Please satisfy with the following requirements on native or VM Linux in advance.
For running each sample codes:
- Python 3.13.x
- Matplotlib
- NumPy
- SciPy
- CasADi (for MPC path tracking)
- do-mpc (for MPC path tracking)
For development:
- pytest (for unit tests)
For setting up the environment with Docker (see Quick Start):
- Docker
- VS Code with the Dev Containers extension (only for option A)
Quick Start
1. Clone this repository
$ git clone https://github.com/ShisatoYano/AutonomousVehicleControlBeginnersGuide
$ cd AutonomousVehicleControlBeginnersGuide
2. Set up the environment
Choose 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.
A. VS Code + Docker (Dev Container)
- 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
B. Docker only
- 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
C. Local (without Docker)
- Install Python 3.13.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:
3. Run a simulation
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.py
You can find all simulations in doc/EXAMPLES.md.
4. (Optional) Run unit tests
You can confirm that the environment is set up correctly by running the unit tests.
$ . run_test_suites.sh
On Windows without Docker, run run_test_suites.bat instead.
Add star to this repository if you like it!!
Examples of Simulation
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 book
The explanations are published as a free web book: https://shisatoyano.github.io/AutonomousVehicleControlBeginnersGuide/. Each chapter adds one stage to the system, and explains the theory with equations and figures, where each equation lives in the code, and 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.
License
MIT
Citing
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.
Use Case
I started this project to study an algorithm and software development for Autonomous Vehicle system by myself. You can also use this repo for your own studying, education, researching and development.
If this project helps your task, please let me know in Show and tell.
Any paper, animation, video as your output, always welcome!! It will encourage me to continue this project.
Your comment and output is added to this list of user comments.
Contribution
Any contribution by creating an issue or sending a pull request is welcome!! Please check this document about how to contribute.
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.