# mppi
**Repository Path**: wenb11/mppi
## Basic Information
- **Project Name**: mppi
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2025-02-10
- **Last Updated**: 2025-02-10
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
[](https://opensource.org/licenses/MIT)
[](https://python-poetry.org/)
[](https://www.docker.com/)
# Simple MPPI Implementation with Python
Model Predictive Path-Integral (MPPI) Control [[G. Williams et al., 2018]](#references) is a promising sampling-based optimal control algorithm.
This repository is for understanding the basic idea of the algorithm.
## Dependency
- [python](https://www.python.org/)
- version 3.10 or higher is recommended.
- [poetry](https://python-poetry.org/)
- setting up python environment easily and safely.
- only `numpy`, `matplotlib`, `notebook` are needed to run all scripts in this repository.
- [ffmpeg](https://ffmpeg.org/)
- mp4 movie writer
-
installation details
- For Ubuntu Users
- `sudo apt-get update`
- `sudo apt-get -y install ffmpeg`
- For Windows Users
- Install [scoop](https://scoop.sh/)
- `scoop install ffmpeg`
- For macOS Users
- Install [homebrew](https://brew.sh/)
- `brew install ffmpeg`
- Check the official website if necessary
- https://ffmpeg.org/
## Setup
### [Option 1] Native environment
```sh
git clone https://github.com/MizuhoAOKI/python_simple_mppi.git
cd python_simple_mppi
poetry install
```
### [Option 2] Docker environment
CLICK HERE TO EXPAND
1. Install [docker](https://docs.docker.com/engine/install/).
1. Clone the project repository.
```
cd
git clone https://github.com/MizuhoAOKI/python_simple_mppi.git
```
1. Run for the first time setup to build the docker image. Building the image might take a few minutes.
```
cd /python_simple_mppi
docker build -t dev_mppi:v0.0 -f docker/Dockerfile .
```
1. Launch the docker container and get into the bash inside.
```
cd /python_simple_mppi
docker run -it -v .:/dev_ws/python_simple_mppi --name dev_mppi_container dev_mppi:v0.0 bash
```
Once the container starts, any changes made in the local repository on the host will be reflected inside the container, and vice versa.
## Usage
### Path Tracking
#### Simple Path Tracking
- Run simulation
```sh
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.
```sh
cd python_simple_mppi
poetry run jupyter notebook notebooks/mppi_pathtracking.ipynb
```
#### Path Tracking with Obstacle Avoidance
- Run simulation
```sh
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.
```sh
cd python_simple_mppi
poetry run jupyter notebook notebooks/mppi_pathtracking_obav.ipynb
```
### Pendulum
- Run simulation to swing up a pendulum.
```sh
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.
```sh
cd python_simple_mppi
poetry run jupyter notebook notebooks/mppi_pendulum.ipynb
```
### CartPole
- Run simulation of cartpole
```sh
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.
```sh
cd python_simple_mppi
poetry run jupyter notebook notebooks/mppi_cartpole.ipynb
```
## References
1. 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