Efficient Differentiable Simulation of Articulated Bodies (ICML2021)

Overview

Efficient Differentiable Simulation of Articulated Bodies

Yi-Ling Qiao, Junbang Liang, Vladlen Koltun, Ming C. Lin

[Paper] [Video] [Slides] [Code]

Setup

  1. This project is still work-in-progress. It can be built with gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04), cmake 3.17.3, and CUDA 10.2 (only required for MBPO).
  2. Clone this repo and setup the python environment.
git clone [email protected]:YilingQiao/diffarticulated.git
cd diffarticulated
conda env create -f gpu-env.yml
conda activate diffarti_36
export LD_LIBRARY_PATH="$CONDA_PREFIX/lib:$LD_LIBRARY_PATH"
  1. Compile this library.
mkdir build
cd build
cmake ..
make -j
cd ..
python setup.py install

If you do not have the uuid lib, you may install it by apt-get install uuid-dev. We will add uuid to the third_party directory shortly.

  1. Run the examples

Examples

Start visualization

We use meshcat to visualize the simulation. Please run the following command to start a session before runing the simulation.

meshcat-server --open

Run the simulation code

An exmaple of solving inverse physics using the differentiable physics is python/exp_throw.py. Please run

python python/exp_throw.py

and it will optimize the control input in 60 episodes.

Simulation results

  1. When you want to export the simulation results in one frame, you can call world.sync_visual_meshcat(sim_step) in the python code. An example can be found in python/exp_throw.py
  2. By default, simulation records are stored in meshcat/his/. This path can be customized by modifying the sync_visual_transforms() function in examples/meshcat_urdf_visualizer.h.
  3. To convert the simulation records into obj meshes, please run
cd python/results
cp -r ../../meshcat/* ./
python convert_history.py
cd ../..

Before generating new records for conversion, please clean the cache in meshcat/his and meshcat/obj

Learn to throw a marble

To run the demo of throwing a marble,

python python/exp_throw.py

Learn to hit a golf ball

python python/exp_punch.py

Learn the frictional coefficient

python python/exp_car.py

Enhance RL with differentiable physics

We place the RL code in another seperate repo.

  1. Clone the submodule for RL.
git submodule init
git submodule update
  1. Install the packages for MBPO.
cd diffarti_mbpo/
git checkout master
pip install -e viskit
pip install -e .
  1. Run the experiments.

Policy Enhancement

In diffarti_mbpo/, run the command

chmod +x ./run_mbpo.sh
./run_mbpo.sh 8_7 pendulumours

Sample Enhancement

In diffarti_mbpo/, run the command

./run_mbpo.sh final_3 antours

Acknowledgments

Thanks for the great open-source project tiny-differentiable-simulatior. This repo is derived from tinydiffsim. You might want to try the original tinydiffsim for its templatized auto-differentiation.

Bibtex

@inproceedings{Qiao2021Efficient,
author  = {Qiao, Yi-Ling and Liang, Junbang and Koltun, Vladlen and Lin, Ming C.},
title  = {Efficient Differentiable Simulation of Articulated Bodies},
booktitle = {ICML},
year  = {2021},
}
You might also like...
PPLNN is a high-performance deep-learning inference engine for efficient AI inferencing.
PPLNN is a high-performance deep-learning inference engine for efficient AI inferencing.

PPLNN, which is short for "PPLNN is a Primitive Library for Neural Network", is a high-performance deep-learning inference engine for efficient AI inferencing.

An Efficient Implementation of Analytic Mesh Algorithm for 3D Iso-surface Extraction from Neural Networks
An Efficient Implementation of Analytic Mesh Algorithm for 3D Iso-surface Extraction from Neural Networks

AnalyticMesh Analytic Marching is an exact meshing solution from neural networks. Compared to standard methods, it completely avoids geometric and top

Triton - a language and compiler for writing highly efficient custom Deep-Learning primitives.
Triton - a language and compiler for writing highly efficient custom Deep-Learning primitives.

Triton - a language and compiler for writing highly efficient custom Deep-Learning primitives.

A hierarchical parameter server framework based on MXNet. GeoMX also implements multiple communication-efficient strategies.

Introduction GeoMX is a MXNet-based two-layer parameter server framework, aiming at integrating data knowledge that owned by multiple independent part

Provide sample code of efficient operator implementation based on the Cambrian Machine Learning Unit (MLU) .

Cambricon CNNL-Example CNNL-Example 提供基于寒武纪机器学习单元(Machine Learning Unit,MLU)开发高性能算子、C 接口封装的示例代码。 依赖条件 操作系统: 目前只支持 Ubuntu 16.04 x86_64 寒武纪 MLU SDK: 编译和

LineFS: Efficient SmartNIC Offload of a Distributed File System with Pipeline Parallelism

LineFS repository for the Artifact Evaluation of SOSP 2021 1. System requirements (Tested environment) 1.1. Hardware requirements 1.1.1. Host machine

An efficient C++17 GPU numerical computing library with Python-like syntax
An efficient C++17 GPU numerical computing library with Python-like syntax

MatX - Matrix Primitives Library MatX is a modern C++ library for numerical computing on NVIDIA GPUs. Near-native performance can be achieved while us

Efficient training of deep recommenders on cloud.
Efficient training of deep recommenders on cloud.

HybridBackend Introduction HybridBackend is a training framework for deep recommenders which bridges the gap between evolving cloud infrastructure and

Comments
  • How to visualize the experiments

    How to visualize the experiments

    Hi,

    Thank you for releasing the code for this amazing project.

    When I tried to run some of the python simulation code like python exp_throw.py, MeshCat world was empty and did not have any robot or marble. I can convert the experiments records to 3d obj mesh files using the convert_history.py script, but I still have to visualize those records separately. What is the expected way to visualize these experiments?

    image

    I am running on Ubuntu 18.04. The code is compiled with 3.21.3 with gcc 8.4.0 and cuda 10.2

    Thank you.

    opened by philip-huang 7
  • Simulation-free implementation and exp_ant?

    Simulation-free implementation and exp_ant?

    Hi,

    Thanks for your excellent work and contribution! I have two questions:

    1. Since I'm using google colab, it seems I can't open the meshcat-server before running the training code. So I disable simulation by world = pd.TinyWorld(do_vis=False). Unfortunately, both the exp_punch.py and the exp_throw.py codes get stuck at convert_tool.convert2(urdf_structures, world, mb_gripper) when urdf_structures are './data/punch/p2.urdf' or './data/franka_panda/panda.urdf', './data/franka_panda/sphere2.urdf'. However, exp_ant.py works after setting do_vis=False.
    2. What is the purpose of the exp_ant.py task?
    opened by yesiam-png 0
Owner
YilingQiao
YilingQiao
Official PyTorch Code of GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Monocular 3D Object Detection (CVPR 2021)

GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Monocular 3D Object Detection GrooMeD-NMS: Grouped Mathematically Differentiable NMS for Mo

Abhinav Kumar 76 Jan 2, 2023
ADOP: Approximate Differentiable One-Pixel Point Rendering

ADOP: Approximate Differentiable One-Pixel Point Rendering

Darius Rückert 1.9k Dec 28, 2022
A CUDA implementation of Lattice Boltzmann for fluid dynamics simulation

Lattice Boltzmann simulation I am conscious of being only an individual struggling weakly against the stream of time. But it still remains in my power

Long Nguyen 17 Mar 1, 2022
OpenAI GYM environment for 6-DOF Helicopter simulation

heli-gym ?? OpenAI GYM environment for 6-DOF Helicopter simulation. This is GYM environment package for reinforcement learning for helicopter flight t

Uğurcan Özalp 8 Jun 10, 2022
A c++ neural simulation based off of david miller's biosim4

NEURALSIM A C++ neural evolution simulator This program simulates neural evolution over generations through the goal of survival. Please Note: This wa

Oxi 7 Nov 2, 2022
Faiss is a library for efficient similarity search and clustering of dense vectors.

Faiss is a library for efficient similarity search and clustering of dense vectors. It contains algorithms that search in sets of vectors of any size, up to ones that possibly do not fit in RAM. It also contains supporting code for evaluation and parameter tuning. Faiss is written in C++ with complete wrappers for Python/numpy.

Facebook Research 18.7k Jan 1, 2023
A hierarchical parameter server framework based on MXNet. GeoMX also implements multiple communication-efficient strategies.

Introduction GeoMX is a MXNet-based two-layer parameter server framework, aiming at integrating data knowledge that owned by multiple independent part

null 86 Oct 21, 2022
This is the code of our paper An Efficient Training Approach for Very Large Scale Face Recognition or F²C for simplicity.

Fast Face Classification (F²C) This is the code of our paper An Efficient Training Approach for Very Large Scale Face Recognition or F²C for simplicit

null 33 Jun 27, 2021
Deploy SCRFD, an efficient high accuracy face detection approach, in your web browser with ncnn and webassembly

ncnn-webassembly-scrfd open https://nihui.github.io/ncnn-webassembly-scrfd and enjoy build and deploy Install emscripten

null 42 Nov 16, 2022
An Efficient Implementation of Analytic Mesh Algorithm for 3D Iso-surface Extraction from Neural Networks

AnalyticMesh Analytic Marching is an exact meshing solution from neural networks. Compared to standard methods, it completely avoids geometric and top

Jiabao Lei 45 Dec 21, 2022