Thanks to visit codestin.com
Credit goes to github.com

Skip to content

daniel9758/robotoc

 
 

Repository files navigation

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 algorithm for switching time optimization (STO) problems and efficient pure-state equality constraint handling.
  • 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. Can optimize the switching times and the trajectories simultaneously.
  • 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/.

Examples

Examples of these solvers are found in examples directory. Further explanations are found at https://mayataka.github.io/robotoc/page_examples.html.

Optimal control example with fixed contact timings

  • Configuration-space and task-space optimal control for a robot manipulator iiwa14 using UnconstrOCPSolver (iiwa14/config_space_ocp.cpp, iiwa14/task_space_ocp.cpp, or iiwa14/python/config_space_ocp.py):

 

  • Walking, trotting, pacing, and bounding gaits of quadruped ANYmal using OCPSolver (yellow arrows denote contact forces and blue polyhedrons denote linearized friction cone constraints) with fixed contact timings (e.g., anymal/walking.cpp or anymal/python/walking.py):

     

Switching time optimization (STO) examples

  • OCPSolver for the switching time optimization (STO) problem, which optimizes the trajectory and the contact timings simultaneously (anymal/python/jumping_sto.py and icub/python/jumping_sto.py):

 

Whole-body MPC examples

  • The following three example implementations of whole-body MPC are provided:
    • MPCCrawling : MPC with OCPSolver for the crawling gait of quadrupedal robots.
    • MPCTrotting : MPC with OCPSolver for the trotting gait of quadrupedal robots.
    • MPCJumping : MPC with OCPSolver for the jumping motion of quadrupedal or bipedal robots.
    • MPCWalking : MPC with OCPSolver for the walking motion of bipedal robots.
  • You can find the simulations of these MPC at a1/mpc, anymal/mpc, and icub/mpc (you need to install PyBullet, e.g., by pip install pybullet):

   

Citing robotoc

  • Citing the STO algorithm of OCPSolver:
@misc{katayama2021sto,
  title={Structure-exploiting {N}ewton-type method for optimal control of switched systems}, 
  author={Sotaro Katayama and Toshiyuki Ohtsuka},
  url={arXiv:2112.07232},
  eprint={2112.07232},
  archivePrefix={arXiv}
  year={2021}}
  • Citing OCPSolver without the switching time optimization (STO):
@misc{katayama2021liftedcd,
  title={Lifted contact dynamics for efficient 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, "Structure-exploiting Newton-type method for optimal control of switched systems," https://arxiv.org/abs/2112.07232, 2021
  • S. Katayama and T. Ohtsuka, Lifted contact dynamics for efficient 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, American Control Conference (ACC) (accepted), https://arxiv.org/abs/2102.09731, 2022
  • 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

About

Efficient optimal control solvers for robotic systems.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.1%
  • Python 1.2%
  • CMake 0.7%