Skip to content

bbokser/hopper-mpc-inertial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 

Repository files navigation

hopper-mpc-inertial

Table of Contents


Intro

This repository contains Python code for a simple simulation of a hopping rigid body with model predictive control. The simulator uses RK4 integration.


Setup

  1. Clone this directory wherever you want.
git clone https://github.com/bbokser/hopper-mpc-inertial.git
  1. Make sure both Python 3.8 and pip are installed.
sudo apt install python3.8
sudo apt-get install python3-pip
python3.8 -m pip install --upgrade pip
  1. I recommend setting up a virtual environment for this, as it requires the use of a number of specific Python packages.
sudo apt-get install python3.8-venv
cd hopper-mpc-inertial
python3.8 -m venv env

For more information on virtual environments: https://docs.python.org/3/library/venv.html

  1. Activate the virtual environment, and then install numpy, scipy, matplotlib, sympy, cvxpy, and argparse.
source env/bin/activate
python3.8 -m pip install numpy scipy matplotlib cvxpy argparse tqdm casadi transforms3d

Don't use sudo here if you can help it, because it may modify your path and install the packages outside of the venv.


Examples

Here is some example code:

cd hopper-mpc-inertial/src
source env/bin/activate
python3.8 run.py 2f --runtime=2000

This simulates the "robot" for 2 seconds with the y-axis body frame output force constraint to zero. The output is a set of plots tracking the behavior over time.

python3.8 run.py 3f --curve

This simulates the "robot" for 5 seconds (the default) without the y-axis force constraint. The --curve argument adds curvature to the reference trajectory.

About

Dynamic simulation and control of a floating body hopper.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages