RobotLocomotion / drake

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

Unstable plane-on-plane contact when switching over to contact models Lagged / Similar #21514

Open jbinagia opened 1 month ago

jbinagia commented 1 month ago

What happened?

As discussed in this slack thread and reproduced in this deepnote notebook, I discovered an issue whereby unstable plane-on-plane contact was exhibit for two floating models stacked on top of one another when using the Lagged or Similar contact models. A video illustrating this behavior is shown below:

https://github.com/RobotLocomotion/drake/assets/30089571/81d11981-299e-49ab-8e9d-445cfb47524c

The hydroelastic moduli for the boxes are ~1e6 Pa. Because I do not see this instability for SAP, I expected Lagged and Similar to also be stable for this choice of moduli (i.e. I expect the same modulus value to be stable regardless of contact model choice). I believe this may be a result of the fact that SAP regularizes contact in the near-rigid regime, while Lagged and Similar models do not.

Version

No response

What operating system are you using?

No response

What installation option are you using?

No response

Relevant log output

No response

amcastro-tri commented 1 month ago

This is an animiation of the instability showing the contact patch between the boxes. This is the same typical problem we get with (multi) point contact at (large) discrete time steps. With kSap the problem is greatly minimized, however it does not go away, you just need to run for longer becase it's a slower frequiency (~1Hz for kSap and ~15Hz for kSimilar). The reason is that kSap overestimates the amount of regularization at large dissipation values (in this case 0.1 sec). This, as explained in the paper above, brings other problems we'd like to avoid. So regularization is only hiding a common problem, it is not the solution. I'll post later a solution that seems to work very well.

instability_with_similar Instability problem for kSimilar with E=1e6 Pa, d=20 s/m and dt=0.01 s.

amcastro-tri commented 1 month ago

All right, teaser progress on this. The sim below is run with kSimilar. Just to make it a "bit" more difficult, I am dropping the box from a far height, the hydro modulus is 1.0e8 Pa (there's nor regularization nor softening here, this is the real deal), no dissipation (to make it yet more difficult, so that any plaussible artifacts do not get damped out), the coefficient of friction is as before 0.4. Both boxes and the ground are compliant (with that very large modulus). As ou can see, there are no instabilitites. I run several initial conditions, orientatioins, etc and still I get this super nice stable sims.

I'll create a branch with the solution and link here shortly.

stable_with_similar

amcastro-tri commented 1 month ago

Solution implemented in #21528.

jbinagia commented 1 month ago

@amcastro-tri Just to confirm, this fix also works when using kLagged as well?

amcastro-tri commented 1 month ago

yes, this improves time coherence regardless of the contact approximation, so it makes things better for kSap, kSimilar, kLagged and even kTamsi.