C++/python codes for contact-implicit trajectory optimization for locomotion and manipulation.
- 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.
- 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
conpt supports python binding, pyconpt, through pybind11.
- Set up virtual environment in
conpt/build
:
sudo pip3 install virtualenv
virtualenv -p /usr/bin/python3 env
source env/bin/activate
pip install numpy
- After you finish installing conpt from source, pyconpt should be ready to be used. For example,
from pyconpt import opt
cartpole = opt.CartPole()
The easiest way is using CMake.
- To call ContactRichOpt in your CMake project, you can do as follows:
find_package(ContactRichOpt REQUIRED)
target_link_libraries(BINARY_NAME
PUBLIC
ContactRichOpt)
- Then, in your c++ code,
#include "conpt/CartPole.h"
- [] 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.
@misc{shirai2023ContactRichOpt,
author = {Yuki Shirai},
title = {libContactRichOpt},
year = {2023},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/YukiShirai/ContactRichOpt}}
}
If you have any questions, feel free to ask questions via issues or email.
@YukiShirai ([email protected])
@ColinTogashi for discussion about CMake and pybind11.