Differentiable Simulation of Hard Contacts with Soft Gradients for Learning and Control

Anselm Paulus, A. René Geist, Pierre Schumacher, Vít Musil, Simon Rappenecker +1 more
6/17/2025
cs.ROcs.LGeess.SY

No confident code implementation found for this paper.

Abstract

Contact forces introduce discontinuities into robot dynamics that severely limit the use of simulators for gradient-based optimization. Penalty-based simulators such as MuJoCo, soften contact resolution to enable gradient computation.

Show full abstract

However, realistically simulating hard contacts requires stiff solver settings, which leads to incorrect simulator gradients when using automatic differentiation. Contrarily, using non-stiff settings strongly increases the sim-to-real gap. We analyze penalty-based simulators to pinpoint why gradients degrade under hard contacts. Building on these insights, we propose DiffMJX, which couples adaptive time integration with penalty-based simulation to substantially improve gradient accuracy. A second challenge is that contact gradients vanish when bodies separate. To address this, we introduce contacts from distance (CFD) which combines penalty-based simulation with straight-through estimation. By applying CFD exclusively in the backward pass, we obtain informative pre-contact gradients while retaining physical realism.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{paulus2025differentiable,
  title  = {Differentiable Simulation of Hard Contacts with Soft Gradients for Learning and Control},
  author = {Anselm Paulus and A. René Geist and Pierre Schumacher and Vít Musil and Simon Rappenecker and Georg Martius},
  year   = {2025},
  eprint = {2506.14186},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.14186v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.14186.svg)](https://codeofpaper.com/paper/2506.14186)

Discussion