vincekurtz / drake_ddp

Differential Dynamic Programming and Iterative LQR in Drake
MIT License
44 stars 11 forks source link

Confusion on how to get the partial gradient #1

Closed yj-Tang closed 11 months ago

yj-Tang commented 11 months ago

Hi, I am really interested in the whole-arm manipulation case you showed. While there comes confusion to me, how can you compute the dynamics partials if there is no continuous collision detection module in Drake? At each time step, the contact point will also change in this case. So I am interested in how do you compute the contact points. You introduced in the paper, it is computed by Drake's contact model. While this model is not continuous, then I am interested in why it is still possible to achieve the dynamics partial with a discontinuous contact module.

Looking forward to your kind reply. Best wishes, Yujie

vincekurtz commented 11 months ago

Hi Yujie, sorry for the late reply, I've been busy and traveling.

The dynamics partials are computed with Drake's autodiff. This code focuses on optimization through hydroelastic contact, which considers contact patches rather than contact points and is differentiable.

Under the hood, Drake's autodiff is just the forward-mode automatic differentiation provided by Eigen. It is not particularly fast, but it works well for a proof of concept like this.