├── bindings ├── pycontact │ ├── jax │ │ ├── __init__.py │ │ └── solvers.py │ ├── torch │ │ ├── __init__.py │ │ └── solvers.py │ ├── utils │ │ ├── __init__.py │ │ ├── callbacks.py │ │ ├── bench.py │ │ └── pin_utils.py │ ├── __init__.py │ └── inverse_dynamics.py ├── contactbench.hh ├── context-cppad.hh ├── context.hh └── CMakeLists.txt ├── .gitignore ├── include └── contactbench │ ├── bindings │ └── context.hh │ ├── context.hpp │ ├── contact-problem.txx │ ├── delassus-wrapper.txx │ ├── solvers.txx │ ├── helpers.hpp │ ├── macros.hpp │ ├── fwd.hpp │ ├── math.hpp │ ├── delassus-wrapper.hxx │ ├── delassus-wrapper.hpp │ ├── contact-problem.hpp │ └── friction-constraint.hpp ├── .gitmodules ├── tests ├── python │ ├── data │ │ ├── 2cubes_t0.npz │ │ └── sliding_cube.npz │ ├── test_friction_constraint.py │ ├── test_collisions.py │ ├── test_jax_solvers.py │ ├── test_delassus_wrapper.py │ ├── test_contact_problem.py │ ├── test_solvers_grad.py │ └── test_pytorch_solvers.py ├── autodiff │ ├── CMakeLists.txt │ └── friction-constraints-cppad.cpp ├── CMakeLists.txt └── friction-constraints.cpp ├── src ├── contact-problem.cpp ├── delassus-wrapper.cpp └── solvers.cpp ├── setup.py ├── examples ├── utils │ └── visualize.py ├── ur5.py ├── humanoid.py ├── solve_ncp.py ├── 2cubes.py ├── hand.py ├── solo.py ├── ball.py └── cube.py ├── CITATION.cff ├── LICENSE ├── README.md └── CMakeLists.txt /bindings/pycontact/jax/__init__.py: -------------------------------------------------------------------------------- 1 | from . import solvers 2 | -------------------------------------------------------------------------------- /bindings/pycontact/torch/__init__.py: -------------------------------------------------------------------------------- 1 | from . import solvers 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | examples/log/ 2 | *.pyc 3 | build*/ 4 | compile_commands.json 5 | -------------------------------------------------------------------------------- /include/contactbench/bindings/context.hh: -------------------------------------------------------------------------------- 1 | /home/qlelidec/Documents/willow/diffcontact-bench/bindings/context.hh -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "cmake"] 2 | path = cmake 3 | url = https://github.com/jrl-umi3218/jrl-cmakemodules.git 4 | -------------------------------------------------------------------------------- /bindings/pycontact/utils/__init__.py: -------------------------------------------------------------------------------- 1 | from . import bench 2 | from . import callbacks 3 | from . import pin_utils 4 | -------------------------------------------------------------------------------- /tests/python/data/2cubes_t0.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simple-Robotics/ContactBench/HEAD/tests/python/data/2cubes_t0.npz -------------------------------------------------------------------------------- /tests/python/data/sliding_cube.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Simple-Robotics/ContactBench/HEAD/tests/python/data/sliding_cube.npz -------------------------------------------------------------------------------- /bindings/pycontact/__init__.py: -------------------------------------------------------------------------------- 1 | from .libpycontact import * 2 | from . import simulators 3 | from . import torch 4 | from . import jax 5 | from . import utils 6 | -------------------------------------------------------------------------------- /include/contactbench/context.hpp: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "contactbench/fwd.hpp" 4 | 5 | namespace contactbench { 6 | namespace context { 7 | 8 | using Scalar = double; 9 | 10 | } // namespace context 11 | } // namespace contactbench 12 | -------------------------------------------------------------------------------- /src/contact-problem.cpp: -------------------------------------------------------------------------------- 1 | #include "contactbench/contact-problem.hpp" 2 | 3 | namespace contactbench { 4 | 5 | template struct ContactProblem; 6 | template struct ContactProblem; 7 | 8 | } // namespace contactbench 9 | -------------------------------------------------------------------------------- /bindings/contactbench.hh: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "contactbench/bindings/context.hh" 4 | 5 | namespace contactbench { 6 | namespace context { 7 | 8 | void expose_contact_bench(); 9 | void expose_vector_types(); 10 | 11 | } // namespace context 12 | } // namespace contactbench 13 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name="contact-bench", 5 | version="1.0", 6 | description="A benchmark of contact solvers.", 7 | packages=["pycontact"], 8 | author="Quentin Le Lidec", 9 | author_email="quentin.le-lidec@inria.fr,", 10 | ) 11 | -------------------------------------------------------------------------------- /src/delassus-wrapper.cpp: -------------------------------------------------------------------------------- 1 | #include "contactbench/contact-problem.hpp" 2 | 3 | namespace contactbench { 4 | 5 | template struct DelassusBase; 6 | template struct DelassusDense; 7 | template struct DelassusPinocchio; 8 | 9 | } // namespace contactbench 10 | -------------------------------------------------------------------------------- /examples/utils/visualize.py: -------------------------------------------------------------------------------- 1 | def sub_sample(xs, duration, fps): 2 | nb_frames = len(xs) 3 | nb_subframes = int(duration*fps) 4 | if nb_frames; 8 | extern template struct ContactProblem; 9 | 10 | 11 | } // namespace contactbench 12 | -------------------------------------------------------------------------------- /include/contactbench/delassus-wrapper.txx: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "contactbench/delassus-wrapper.hpp" 4 | 5 | namespace contactbench { 6 | 7 | extern template struct DelassusBase; 8 | extern template struct DelassusDense; 9 | extern template struct DelassusPinocchio; 10 | 11 | } // namespace contactbench 12 | -------------------------------------------------------------------------------- /CITATION.cff: -------------------------------------------------------------------------------- 1 | cff-version: 1.0.0 2 | message: "If you use this software, please cite it as below." 3 | authors: 4 | - family-names: Le Lidec 5 | given-names: Quentin 6 | - family-names: Jallet 7 | given-names: Wilson 8 | - family-names: Montaut 9 | given-names: Louis 10 | - family-names: Schmid 11 | given-names: Cordelia 12 | - family-names: Laptev 13 | given-names: Ivan 14 | - family-names: Carpentier 15 | given-names: Justin 16 | title: "Contact Models in Robotics: a Comparative Analysis" 17 | version: 1.0.0 18 | date-released: 2021-08-11 19 | -------------------------------------------------------------------------------- /tests/autodiff/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | macro(add_cppad_contact_bench_unit_test name) 2 | include_directories(SYSTEM ${cppad_INCLUDE_DIR}) 3 | add_contact_bench_unit_test(${name} PACKAGES cppad) 4 | add_dependencies(test-cpp-cppad test-cpp-${name}) 5 | target_link_libraries(test-cpp-${name} PUBLIC ${cppad_LIBRARY}) 6 | endmacro(add_cppad_contact_bench_unit_test) 7 | 8 | if(BUILD_WITH_AUTODIFF_SUPPORT) 9 | add_custom_target(test-cpp-cppad) 10 | set_target_properties(test-cpp-cppad PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD True) 11 | 12 | add_cppad_contact_bench_unit_test(friction-constraints-cppad) 13 | add_cppad_contact_bench_unit_test(delassus-cppad) 14 | add_cppad_contact_bench_unit_test(contact-problem-cppad) 15 | add_cppad_contact_bench_unit_test(solvers-cppad) 16 | endif(BUILD_WITH_AUTODIFF_SUPPORT) 17 | -------------------------------------------------------------------------------- /bindings/context-cppad.hh: -------------------------------------------------------------------------------- 1 | #ifndef CONTACT_BENCH_BINDINGS_CONTEXT_CPPAD_H 2 | #define CONTACT_BENCH_BINDINGS_CONTEXT_CPPAD_H 3 | 4 | #include 5 | #include "contactbench/fwd.hpp" 6 | 7 | namespace contactbench { 8 | namespace context { 9 | 10 | using T = CppAD::AD; 11 | 12 | CONTACTBENCH_EIGEN_TYPEDEFS(T); 13 | 14 | using IceCreamCone = contactbench::IceCreamCone; 15 | template