Giter Club home page Giter Club logo

robotoc's Introduction

robotoc - efficient ROBOT Optimal Control solvers

build codecov

Features for efficient optimal control of robotic systems

  • Direct multiple-shooting method based on the lifted contact dynamics / inverse dynamics.
  • Riccati recursion / Parallel Newton's method (ParNMPC) for solving the KKT systems.
  • Efficient pure-state equality constraint handling in the Riccati recursion.
  • Primal-dual interior point method for inequality constraints.
  • Very fast computation of rigid body dynamics and its sensitivities thanks to Pinocchio.

Requirements

Installation

  1. Install the latest stable version of Eigen3 by
sudo apt install libeigen3-dev
  1. Install the latest stable version of Pinocchio by following the instruction
  2. Clone this repository and change the directory as
git clone https://github.com/mayataka/robotoc
cd robotoc 
  1. Build and install robotoc as
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release 
make install -j$(nproc)

NOTE: if you want to maximize the performance, use CMake option

cmake .. -DCMAKE_BUILD_TYPE=Release -DOPTIMIZE_FOR_NATIVE=ON
  1. If you want to visualize the solution trajectory with Python, you have to install gepetto-viewer-corba by
sudo apt update && sudo apt install robotpkg-py38-qt5-gepetto-viewer-corba -y

and/or meshcat-python by

pip install meshcat
  1. If you want to visualize the solution trajectory with C++, in addition to gepetto-viewer-corba, you have to install pinocchio-gepetto-viewer, e.g., by
git clone https://github.com/stack-of-tasks/pinocchio-gepetto-viewer.git --recursive && cd pinocchio-gepetto-viewer
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make install

and add the CMake option for robotoc as

cmake .. -DBUILD_VIEWER=ON
  1. If you do not want to install the Python bindings, change the CMake configuration as
cmake .. -DBUILD_PYTHON_INTERFACE=OFF

Usage

C++:

You can link your executables to robotoc by writing CMakeLists.txt, e.g., as

find_package(robotoc REQUIRED)

add_executable(
    YOUR_EXECTABLE
    YOUR_EXECTABLE.cpp
)
target_link_libraries(
    YOUR_EXECTABLE
    PRIVATE
    robotoc::robotoc
)
target_include_directories(
    YOUR_EXECTABLE
    PRIVATE
    ${ROBOTOC_INCLUDE_DIR}
)

Python:

Suppose that the Python version is 3.8. The Python bindings will then be installed at ROBOTOC_INSTALL_DIR/lib/python3.8/site-packages where ROBOTOC_INSTALL_DIR is the install directory of robotoc configured in CMake (e.g., by -DCMAKE_INSTALL_PREFIX). To use the installed Python library, it is convenient to set the environment variable as

export PYTHONPATH=ROBOTOC_INSTALL_DIR/lib/python3.8/site-packages:$PYTHONPATH 

e.g., in ~/.bashrc. Note that if you use another Python version than python3.8, please adapt it.

Solvers

The following three solvers are provided:

  • OCPSolver : Solves the OCP for rigid-body systems (possibly with contacts) by using Riccati recursion.
  • UnconstrOCPSolver : Solves the OCP for "unconstrained" rigid-body systems by using Riccati recursion.
  • UnconstrParNMPCSolver : Solves the OCP for "unconstrained" rigid-body systems by using ParNMPC algorithm.

where "unconstrained" rigid-body systems are systems without any contacts or a floating-base.

Documentation

More detailed documentation is available at https://mayataka.github.io/robotoc/.

Optimal control examples

Examples of these solvers are found in examples directory. The following animations are the solution trajectory of the UnconstrOCPSolver for a robot manipulator iiwa14.

  • Configuration-space and task-space optimal control (iiwa14/config_space_ocp.cpp, iiwa14/task_space_ocp.cpp, or iiwa14/python/config_space_ocp.py)

 

The following animations are the solution trajectory of the OCPSolver for a quadruped ANYmal (yellow arrows denote contact forces and blue polyhedrons denote linearized friction cone constraints).

  • Walking, trotting gaits (anymal/walking.cpp, anymal/trotting.cpp, or anymal/python/walking.py, anymal/python/trotting.py)

 

  • Pacing, bounding, jumping gaits (anymal/pacing.cpp, anymal/bounding.cpp, anymal/jumping.cpp, or anymal/python/pacing.py, anymal/python/bounding.py, anymal/python/jumping.py)

   

  • Running gait (anymal/running.cpp)

Whole-body MPC examples

The following two example implementations of whole-body MPC are provided:

  • MPCQuadrupedalWalking : MPC with OCPSolver for the walking gait of quadrupedal robots.
  • MPCQuadrupedalTrotting : MPC with OCPSolver for the trotting gait of quadrupedal robots.

You can run the simulations of these MPC with anymal/mpc/walking.py and anymal/mpc/trotting.py (you need to install PyBullet, e.g., by pip install pybullet).

 

Citing robotoc

@misc{katayama2021liftedcd,
  title={Lifted contact dynamics for efficient direct optimal control of rigid body systems with contacts}, 
  author={Sotaro Katayama and Toshiyuki Ohtsuka},
  url={arXiv:2108.01781},
  eprint={2108.01781},
  archivePrefix={arXiv}
  year={2021}}
@inproceedings{katayama2021idocp,
  title={Efficient solution method based on inverse dynamics for optimal control problems of rigid body systems},
  author={Sotaro Katayama and Toshiyuki Ohtsuka},
  booktitle={{IEEE International Conference on Robotics and Automation (ICRA)}},
  year={2021}}

Related publications

  • S. Katayama and T. Ohtsuka, Lifted contact dynamics for efficient direct optimal control of rigid body systems with contacts, https://arxiv.org/abs/2108.01781, 2021
  • S. Katayama and T. Ohtsuka, Efficient Riccati recursion for optimal control problems with pure-state equality constraints, https://arxiv.org/abs/2102.09731, 2021
  • S. Katayama and T. Ohtsuka, Efficient solution method based on inverse dynamics for optimal control problems of rigid body systems, IEEE International Conference on Robotics and Automation (ICRA), 2021
  • H. Deng and T. Ohtsuka, A parallel Newton-type method for nonlinear model predictive control, Automatica, Vol. 109, pp. 108560, 2019

robotoc's People

Contributors

mayataka avatar 6293 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.