Skip to content

C++/python codes for contact-rich trajectory optimization.

License

Notifications You must be signed in to change notification settings

YukiShirai/conpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CONPT (CONtact-rich trajectory oPTimization)

C++/python codes for contact-implicit trajectory optimization for locomotion and manipulation.

Dependencies

  • Ubuntu 20.04+
  • CMake 3.15+
  • Python 3.6+
  • C++11
  • pybind11
  • Eigen3
  • casadi (SHA "402fe583f0d3cf1fc77d1e1ac933f75d86083124"). Note that when you build casadi from source, make sure you do cmake -DWITH_IPOPT=true.
  • param, originally from here
  • matplotlib-cpp. Note that please install this package in your (native) environment.

Build and Installation

  • The easiest way to install is through CMake. We first install the dependencies:
sudo apt-get install python3-dev cmake libeigen3-dev
  • Then, you need to install casadi and param. For param installation, see this.
  • For casadi, you can also follow this. Note that if you are interested in using optimization solvers such as gurobi, which are not compiled as a default CMake setting of casadi, you need to recompile casadi. Or you can simply run the following commands:
git clone https://github.com/casadi/casadi.git
cd casadi; mkdir build; cd build
cmake ..
cmake --build .
sudo make install
  • Finally, we are ready to build and install ContactRichOpt. To do that, like how we installed casadi, we use CMake as follows:
git clone https://github.com/YukiShirai/ContactRichOpt.git
cd casadi; mkdir build; cd build
cmake ..
cmake --build .
sudo make install
  • and that's it! Note that if your CMake project complains during your cmake .. like:
/usr/bin/ld: cannot find -lContactRichOpt
  • then check where your libContactRichOpt.so was installed. It can be /usr/local/lib. If that's the case, crate symbolic link as follows:
sudo ln -s /usr/local/lib/libContactRichOpt.so /usr/lib/libContactRichOpt.so

Usage for your project in python (under construction)

conpt supports python binding, pyconpt, through pybind11.

  1. Set up virtual environment in conpt/build:
sudo pip3 install virtualenv
virtualenv -p /usr/bin/python3 env
source env/bin/activate
pip install numpy
  1. After you finish installing conpt from source, pyconpt should be ready to be used. For example,
from pyconpt import opt

cartpole = opt.CartPole()

Usage for your project in C++ (under construction)

The easiest way is using CMake.

  1. To call ContactRichOpt in your CMake project, you can do as follows:
find_package(ContactRichOpt REQUIRED)

target_link_libraries(BINARY_NAME
	                    PUBLIC
		                  ContactRichOpt)
  1. Then, in your c++ code,
#include "conpt/CartPole.h"

TODO

  • [] support other toy problems
  • [] support python bindings using pybind11.
  • [] support mixed-integer programming through gurobi
  • [] support stochastic optimization such as chance-constrained optimization.
  • [] integrate with simulator such as pybullet / drake.
  • [] support MPC
  • [] support bilevel optimization
  • [] improve customizability. user should be able to add any constraints through main.cpp.

Citation

@misc{shirai2023ContactRichOpt,
  author = {Yuki Shirai},
  title = {libContactRichOpt},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/YukiShirai/ContactRichOpt}}
}

Contact

If you have any questions, feel free to ask questions via issues or email.

@YukiShirai ([email protected])

Acknowledgements

@ColinTogashi for discussion about CMake and pybind11.

Reference

[1] Y. Shirai, D. K. Jha, A. U. Raghunathan, D. Romeres, "Chance-Constrained Optimization in Contact-Rich Systems for Robust Manipulation", ACC2023

[2] A. U. Raghunathan, D. K. Jha and D. Romeres, "PyROBOCOP: Python-based Robotic Control & Optimization Package for Manipulation", ICRA2022

[3] Y. Shirai, D. K. Jha, A. U. Raghunathan and D. Romeres, "Robust Pivoting: Exploiting Frictional Stability Using Bilevel Optimization", ICRA2022

[4] Y. Shirai et al., "Simultaneous Contact-Rich Grasping and Locomotion via Distributed Optimization Enabling Free-Climbing for Multi-Limbed Robots", IROS2022

[5] Y. Shirai, X. Lin, Y. Tanaka, A. Mehta and D. Hong, "Risk-Aware Motion Planning for a Limbed Robot with Stochastic Gripping Forces Using Nonlinear Programming", IEEE Robotics and Automation Letters, 2020