Skip to content

Repository files navigation

AutonomousVehicleControlBeginnersGuide

Linux_CI Windows_CI MacOS_CI CodeFactor

Python sample codes and documents about Autonomous vehicle control algorithm. This project can be used as a technical guide book to study the algorithms and the software architectures for beginners.

Table of Contents

What is this?

This is a sample codes collections about Autonomous vehicle control algorithm. Each source codes are implemented with Python to help your understanding. You can fork this repository and use for studying, education or work freely.

Goal of this project

I want to release my own technical book about Autonomous Vehicle algorithms in the future. The book will include all of codes and documents in this repository as contents.

Requirements

Please satisfy with the following requirements on native or VM Linux in advance.
For running each sample codes:

For development:

For setting up the environment with Docker:

How to use

  1. Clone this repository

    $ git clone https://github.com/ShisatoYano/AutonomousVehicleControlBeginnersGuide
  2. Set up the environment for running each codes

    • Set up with Docker on WSL:
      • Before cloning thi repo, install Docker in advance
      • Clone this repo following the above Step 1
      • Open this repo's folder by VSCode
      • Create Dev Container
      • And then, all required libraries are installed automatically
  3. Execute unit tests to confirm the environment were installed successfully

    $ . run_test_suites.sh
  4. Execute a python script at src/simulations directory

    • For example, when you want to execute localization simulation of Extended Kalman Filter:
      $ python src/simulations/localization/extended_kalman_filter_localization/extended_kalman_filter_localization.py
  5. Add star to this repository if you like it!!

Code completion / import resolution in your editor

Each simulation script adds its own module search paths at runtime with sys.path.append(...), since this project doesn't use a standard Python package layout. Static analysis tools (Pylance/pyright) can't see those runtime sys.path.append(...) calls, so without extra configuration your editor will show false "import could not be resolved" errors and code completion won't work for these modules.

To fix this, pyrightconfig.json (for pyright/Pylance, e.g. Neovim or VS Code without Dev Containers) and .devcontainer/devcontainer.json's python.analysis.extraPaths (for VS Code + Dev Containers) list every directory under src/components and src/simulations that directly contains a .py file.

Whenever you add a new module (a new directory under src/components or src/simulations), regenerate both files by running:

$ python generate_pyrightconfig.py

This scans the project and rewrites both files automatically, so you don't need to edit them by hand.

Run this script on your host machine, not inside the container. It only uses the Python standard library (json, pathlib), and since the project directory is bind-mounted into the container as-is, the files it writes are the same on both sides either way. Running it on the host is simplest since it doesn't depend on the container's Python environment at all.

Examples of Simulation

Every algorithm has a runnable simulation with an animated demo, organized into these categories:

  • Localization
  • Mapping
  • Path Planning
  • Path Tracking
  • Perception
  • Course

The full list with demo GIFs is generated from src/simulations — see doc/EXAMPLES.md.

Documents

Design documents of each Python programs are prepared here. The documents are still not completed. They have been being updated. If you found any problems in them, please tell me by creating an issue.
Documents link

License

MIT

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 by creating a issue.
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.

Author

Shisato Yano

About

Python sample codes and documents about Autonomous vehicle control algorithm. This project can be used as a technical guide book to study the algorithms and the software architectures for beginners.

Topics

Resources

Stars

1.7k stars

Watchers

31 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages