RobotLocomotion / drake

Model-based design and verification for robotics.
https://drake.mit.edu
Other
3.34k stars 1.27k forks source link

[geometry] AutoDiff support for hydroelastic contact #14136

Closed SeanCurtis-TRI closed 3 years ago

SeanCurtis-TRI commented 4 years ago

Although, much of the hydroelastic contact infrastructure has been coded with a templated scalar, it is not yet ready for computing contact with AutoDiff calculations. The primary reason for this is because the scalars haven't been properly applied.

For example, one long-lived comment discusses the fact that for a given soft mesh, there could be multiple different scalar types: the pose, field value, mesh vertex positions, etc. We currently load double-valued meshes (analogous to all of the "parameterized" geometries). But introducing AutoDiff-valued transforms would produce an AutoDiff-valued ContactSurface.

In addition, there is no value for a bounding volume hierarchy (Bvh) in being anything but double-valued. Other than being used for acceleration of the query, it doesn't contribute to numerical results. But we need to be able to build a Bvh for a T-valued mesh.

There are several possible solutions:

  1. Keep everything templated on a single scalar value and convert all properties to the T-values (rather than having double-valued properties in an otherwise AutoDiff-valued system).
  2. Revisit the templating so that scalar types that are conceptually independent remain independent.

The exact solution still needs to be determined. The proof that it is done, is that we can perform AutoDiff-valued hydroelastiic contact queries (with, at least, AutoDiff-valued pose data).

SeanCurtis-TRI commented 3 years ago

A solution has been implemented in the "leave meshes double-valued and let derivatives come in through mesh transforms" direction. The full solution will be a PR train:

SeanCurtis-TRI commented 3 years ago

@amcastro-tri You've got a checkbox up above for confirming derivatives on contact forces.

SeanCurtis-TRI commented 3 years ago

The initial effort (while still benefitting from some more elaborate tests -- see #15233), is basically complete. We have credible reason for someone to try working with the derivatives in hydroelastic contact.

fyi @hongkai-dai