This repository contains a Whole-Body Nonlinear Model Predictive Controller (NMPC) for humanoid loco-manipulation control. This approach enables to directly optimize through the full-order torque-level dynamics in realtime to generate a wide range of humanoid behaviors building up on an updated version of ocs2
Interactive Velocity and Base Height Control via Joystick:
It contains the following MPC fromulations to be applied to any humanoid robot.
The centroidal MPC optimizes over the whole-body kinematics and the center off mass dynamics, with a choice to either use a single rigid
body model or the full centroidal dynamics. It's functionality is contained in humanoid_centroidal_mpc
.
The whole-body dynamics MPC optimized over the contact forces and joint accelerations with the option to compute the joint torques for
each step planned accross the horizon. It's functionality is contained in humanoid_wb_mpc
.
The project supports the following robot examples:
- Unitree G1
- 1X Neo (Comming soon)
Create a colcon workspace and clone the repository into the src folder:
mkdir -p humanoid_mpc_ws/src && cd humanoid_mpc_ws/src
git clone https://github.com/1x-technologies/wb-humanoid-mpc.git
Then initialize all submodules using:
cd wb-humanoid-mpc
git submodule update --init --recursive
The project supports both Dockerized workspaces (recommended) or a local installation for developing and running the humanoid MPC.
Dockerized Workspace
We provide a Dockerfile to enable running and devloping the project from a containerized environment. Check out the devcontainer.json for the arguments that must be supplied to the docker build
and docker run
commands.
For working in Visual Studio Code, we recommend to install the Dev Containers extension. Then, with the root of this repository as the root of your VS Code workspace, enter Ctrl + Shift + P
and select Dev Containers: Rebuild and Reopen in Container
at the top of the screen. VS Code will then automatically handle calling the docker build
and docker run
commands for you and will reopen the window at the root of the containerized workspace. Once this step is completed, you are ready to build and run the code.
Install Dependencies Locally
Make sure you have ros2 installed on your system as e.g specified for jazzy in the installation guide.
Then install all dependencies using:
envsubst < dependencies.txt | xargs sudo apt install -y
make build-all
Once you run the NMPC a window with Rviz will appear for visualization. The first time you start the MPC for a certain robot model the auto differentiation code will be generated which might take up to 5-15 min depending on your system. Once done the robot appears and you can control it via an xbox gamepad or the controls in the terminal.
On the top level folder run:
For the Centroidal Dynamics MPC
make launch-g1-dummy-sim
For the Whole-Body Dynamics MPC
make launch-wb-g1-dummy-sim
Command a desired base velocity and root link height via Robot Base Controller GUI and XBox Controller Joystick. For the joystick it is easiest to directly connect via USB. Otherwise you need to install the required bluetooth Xbox controller drivers on your linux system. The GUI application automatically scanns for Joysticks and indicates whether one is connected.
To cite the Whole-Body Humanoid MPC in your academic research, please consider citing the following web BibTeX entry:
@misc{wholebodyhumanoidmpcweb,
author = {Manuel Yves Galliker},
title = {Whole-body Humanoid MPC: Realtime Physics-Based Procedural Loco-Manipulation Planning and Control},
howpublished = {https://github.com/1x-technologies/wb_humanoid_mpc},
year = {2024}
}
This project was developed at 1X Technologies and is primarily authored and maintained by Manuel Yves Galliker.
Further acknowledgement for their contributions, insights, discussion and support goes to Michael Purcell, Jesper Smith, Simon Zimmermann, Joel Filho, Paal Arthur Schjelderup Thorseth, Varit (Ohm) Vichathorn, Sjur Grønnevik Wroldsen, Armin Nurkanovic, Charles Khazoom, Farbod Farshidian, Eric Jang, Bernt Børnich and everyone at 1X Technologies.