RobotLocomotion / drake

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

[bindings] Bind public APIs for hydroelastics in python #16212

Closed DamrongGuoy closed 2 years ago

DamrongGuoy commented 2 years ago

To make hydroelastic contact model useful for more users, we should have python bindings for relevant public APIs including:

Relates #15796.

I'm not sure yet how extensive the bindings should be. It might depend on the python examples that we want to create.

@hongkai-dai, please let us know if you have a list of specific bindings that you'd like to see. You have more experience as python users of hydroelastics.

@amcastro-tri, I only list the items from geometry. Please let us know if there are items from multibody too (you can add to the list above or add a comment below).

jwnimmer-tri commented 2 years ago

@DamrongGuoy is there any API that is still planned to be changed under the #15796 roadmap? From a quick skim of the issue, I don't see any.

DamrongGuoy commented 2 years ago

@jwnimmer-tri Thanks for asking. Most of the API should stay now with two variables:

jwnimmer-tri commented 2 years ago

Should we bind MeshFieldLinear (aka PolygonSurfaceMeshFieldLinear, TriangleSurfaceMeshFieldLinear) and the matching accessor functions (e.g., ContactSurface::poly_e_MN)?

DamrongGuoy commented 2 years ago

@jwnimmer-tri After checking with a number of stakeholders, we agree that the API like AddSoftHydroelasticProperties will change to AddCompliantHydroelasticProperties(). Still, we can take that as a separate issue from #16212 since AddSoftHydroelasticProperties is bound to python already in geometry_py_hydro.cc. I'll work on that as a follow-up to #16218.

jwnimmer-tri commented 2 years ago

Should we bind MeshFieldLinear ...

I'll presume "no", for now.

DamrongGuoy commented 2 years ago

I agree: "no" for MeshFieldLinear for now. I haven't heard anyone asking yet.

jwnimmer-tri commented 2 years ago

In general I think that every public (non-internal, non-dev, etc.) class and function from C++ should be bound in pydrake. Adding the binding only when people complain is an awkward development philosophy. However, for the purpose of this issue and the #15796 milestone, I think the current pull request is sufficient to close this issue, even without adding more bindings. Part of the post-milestone follow-up should be ensuring that all of multibody and geometry code is bound in pydrake.