Skip to content

stephane-caron/mpc_balancer

Repository files navigation

MPC balancer

upkie

Make an Upkie to stand upright by closed-loop model predictive control.

Installation

We recommend using Anaconda to install the agent and all its dependencies in a clean environment:

conda env create -f environment.yaml
conda activate mpc_balancer

Alternatively, you should be able to install the packages listed in the environment file from PyPI.

Usage

To run in simulation, clone the upkie repository and run:

./start_simulation.sh

Activate your conda environment and run the agent by:

python run_agent.py

Solvers

This agent only works with QP solvers that support warm starting. At present we only support one solver:

Solver Algorithm License Warm-start
ProxQP Augmented Lagrangian BSD-2-Clause ✔️

You can take a peek at the ProxQP balancer (research code) for more solvers.

Export dependencies to your Upkie

This agent can export a pixi environment to your Upkie using pixi-pack. If you don't have pixi yet, you will need to install it first. Then, to pack an environment from your computer, run:

make pack_env

This will create an environment.tar archive in the current directory. You can upload it to your Upkie by make upload and unpack it from the agent's remote directory by:

your_user@your_upkie:~/mpc_balancer$ make unpack_env

If pixi-pack is not installed on your Upkie, you can download the pixi-pack-aarch64-unknown-linux-musl binary from the pixi-pack release page. Finally, activate the environment and run the agent:

conda activate mpc_balancer
python mpc_balancer/run.py

See also

  • PPO balancer: an MLP agent trained for the same task by reinforcement learning.
  • ProxQP balancer: prototype for this agent used in the code for the ProxQP paper. Currently supports more QP solvers.

About

Legacy model predictive controller to balance Upkie wheeled bipeds

Topics

Resources

License

Stars

Watchers

Forks