Skip to content

We compare the gradients calculated by different differentiable contact model implementations.

License

Notifications You must be signed in to change notification settings

DesmondZhong/diff_sim_grads

Repository files navigation


Differentiable Physics Simulations with Contacts: Do They Have Correct Gradients w.r.t. Position, Velocity and Control?

Yaofeng Desmond Zhong, Jiequn Han, Georgia Olympia Brikis | 2022

Conference Paper

This repository contains scripts to reproduce results in our paper.

Reproducibility

All experiments do not require GPUs.

To install all dependencies:

pip install -r requirements.txt
# or to install the exact versions of packages as done in this work. 
pip install -r requirements_freeze.txt

Please check out the README files in the task folders for how to reproduce the results shown in the paper.

Overview

In this work, we compare the gradients calculated by different differentiable contact models as shown in the following table.

Differentiable contact models Implementations
Linear complementarity problems (LCPs) NimblePhysics
Convex optimization DiffCoSim
Compliant models Warp and Brax
Position-based dynamics (PBD) Warp and Brax
Direct Velocity Impulse DiffTaichi

We apply these implementations to three tasks.

Task 1. Gradients with a Simple Collision Task 2. Optimize the Initial Velocity of a Bouncing Ball to Hit a Target Task 3. Learning Optimal Control with a Two-ball Collision
drawing drawing drawing

Our results show that gradients calculated by different implementation do not agree. Some implementations fail to achieve the optimization tasks. Please check out our paper for more details.

Task 3 Results

In this tasks, we are able to derive the analytical gradients and the analytical optimal control. Here we plot the analytical optimal loss along with the learning curves as well as the analytical optimal control and learned optimal controls. We observe that some differentiable simulators learn zero control sequences and fail to achieve the optimization task.

drawing

Citation

If you find this work helpful, please consider citing our paper using the following Bibtex.

@article{zhong2022differentiable,
  title={Differentiable Physics Simulations with Contacts: Do They Have Correct Gradients w.r.t. Position, Velocity and Control?},
  author={Zhong, Yaofeng Desmond and Han, Jiequn and Brikis, Georgia Olympia},
  journal={arXiv preprint arXiv:2207.05060},
  year={2022}
}

About

We compare the gradients calculated by different differentiable contact model implementations.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published