| Simulation | Real Robot | 
|---|---|
![]()  | 
![]()  | 
DWMPC is a library for distributed model predictive control (MPC) of quadruped robots. This repository includes the core MPC controller in cpp and example usage with the gym-quadruped environment in Python. The provided acados solver has been generated for aliengo. If you want to try with different robots check this Python file to generate a new C solver.
Before proceeding with the installation, ensure that the following dependencies are available on your system:
- CMake
 - GCC
 - Python 3 (along with development headers)
 - Eigen3
 - YAML-CPP
 - Pybind11
 - ndcurves
 - acados
 
To get started, clone the repository and initialize all submodules:
git clone https://github.com/iit-DLSLab/DWMPC.git
cd DWMPC
git submodule update --init --recursivesudo apt-get install -y cmake g++ python3 python3-dev python3-pip libeigen3-dev libyaml-cpp-dev pybind11-devFollow the instructions to install the ndcurves library from the official repository
Navigate to the acados directory and build the library:
cd third_party/acados
mkdir build && cd build
cmake ..
make install -j4After building, add acados to your LD_LIBRARY_PATH:
export LD_LIBRARY_PATH=<path_to_acados\lib>:$LD_LIBRARY_PATHFrom the main DWMPC repository, create a build directory and compile the project:
cd ../../
mkdir build && cd build
cmake ..
make -j8 && sudo make installAdd the DWMPC library to your environment:
export LD_LIBRARY_PATH=/usr/lib/dls2/controllers/dwmpc:$LD_LIBRARY_PATH
export PYTHONPATH=$PYTHONPATH:/usr/lib/dls2/controllers/dwmpcFor running the example scripts, install the gym-quadruped environment from the the official repository
To build a the controller for a different robot use generate_ocp.py. You just need to change the urdf path in:
and provide the joint names in sequence and end-effector name in :
joints_name_list,contact_frame_name_list (this is step is not neccesary if you are using one of the provided urdfs)
Changes in the config.yaml are provided for Go1 and Go2.
@INPROCEEDINGS{amatucciIROS2024,
      title={Accelerating Model Predictive Control for Legged Robots through Distributed Optimization}, 
      author={Lorenzo Amatucci and Giulio Turrisi and Angelo Bratta and Victor Barasuol and Claudio Semini},
       booktitle={2024 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
  year={2024}
}
