python_simple_mppi
python_simple_mppi copied to clipboard
Python implementation of MPPI (Model Predictive Path-Integral) controller to understand the basic idea. Mandatory dependencies are numpy and matplotlib only.
Simple MPPI Implementation with Python
Model Predictive Path-Integral (MPPI) Control [G. Williams et al., 2018] is a promising sampling-based optimal control algorithm.
This repository is for understanding the basic idea of the algorithm.
![pathtracking and obstacle avoidance demonstraion](https://github.com/MizuhoAOKI/python_simple_mppi/raw/master/media/pathtracking_obav_demo.gif)
![pathtracking demonstraion](https://github.com/MizuhoAOKI/python_simple_mppi/raw/master/media/pathtracking_demo.gif)
![swinging up pendulum demonstraion](https://github.com/MizuhoAOKI/python_simple_mppi/raw/master/media/pendulum_swingup_demo.gif)
![swinging up pendulum demonstraion](https://github.com/MizuhoAOKI/python_simple_mppi/raw/master/media/cartpole_demo.gif)
Dependency
-
- version 3.10 or higher is recommended.
-
- seting up python environment easily and safely.
- only
numpy
,matplotlib
,notebook
are needed to run all scripts in this repository.
-
-
mp4 movie writer
-
Setup
git clone https://github.com/MizuhoAOKI/python_simple_mppi.git
cd python_simple_mppi
poetry install
Usage
Path Tracking
![pendulum](https://github.com/MizuhoAOKI/python_simple_mppi/raw/master/media/pathtracking.png)
Simple Path Tracking
-
Run simulation
cd python_simple_mppi poetry run python scripts/mppi_pathtracking.py
-
Run jupyter notebook if you would like to check mathematical explanations on the algorithm.
cd python_simple_mppi poetry run jupyter notebook notebooks/mppi_pathtracking.ipynb
Path Tracking with Obstacle Avoidance
-
Run simulation
cd python_simple_mppi poetry run python scripts/mppi_pathtracking_obav.py
-
Run jupyter notebook if you would like to check mathematical explanations on the algorithm.
cd python_simple_mppi poetry run jupyter notebook notebooks/mppi_pathtracking_obav.ipynb
Pendulum
![pendulum](https://github.com/MizuhoAOKI/python_simple_mppi/raw/master/media/pendulum.png)
-
Run simulation to swing up a pendulum.
cd python_simple_mppi poetry run python scripts/mppi_pendulum.py
-
Run jupyter notebook if you would like to check mathematical explanations on the algorithm.
cd python_simple_mppi poetry run jupyter notebook notebooks/mppi_pendulum.ipynb
CartPole
![cartpole](https://github.com/MizuhoAOKI/python_simple_mppi/raw/master/media/cartpole.png)
-
Run simulation of cartpole
cd python_simple_mppi poetry run python scripts/mppi_cartpole.py
-
Run jupyter notebook if you would like to check mathematical explanations on the algorithm.
cd python_simple_mppi poetry run jupyter notebook notebooks/mppi_cartpole.ipynb
References
- G. Williams et al. "Information-Theoretic Model Predictive Control: Theory and Applications to Autonomous Driving"
- URL : https://ieeexplore.ieee.org/document/8558663
- PDF : https://arxiv.org/pdf/1707.02342.pdf