Skip to content

Latest commit

 

History

History
143 lines (114 loc) · 4.69 KB

README.md

File metadata and controls

143 lines (114 loc) · 4.69 KB

License: MIT Poetry Docker

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

pathtracking demonstraion

swinging up pendulum demonstraion

swinging up pendulum demonstraion

Dependency

  • python

    • version 3.10 or higher is recommended.
  • poetry

    • setting up python environment easily and safely.
    • only numpy, matplotlib, notebook are needed to run all scripts in this repository.
  • ffmpeg

    • mp4 movie writer

    • installation details
      • For Ubuntu Users
        • sudo apt-get update
        • sudo apt-get -y install ffmpeg
      • For Windows Users
        • Install scoop
        • scoop install ffmpeg
      • For macOS Users
      • Check the official website if necessary

Setup

[Option 1] Native environment

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.

  2. Clone the project repository.

    cd <path to your workspace>
    git clone https://github.com/MizuhoAOKI/python_simple_mppi.git
    
  3. Run for the first time setup to build the docker image. Building the image might take a few minutes.

    cd <path to your workspace>/python_simple_mppi
    docker build -t dev_mppi:v0.0 -f docker/Dockerfile .
    
  4. Launch the docker container and get into the bash inside.

    cd <path to your workspace>/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

pendulum

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

  • 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

  • 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

  1. G. Williams et al. "Information-Theoretic Model Predictive Control: Theory and Applications to Autonomous Driving"