Open diegoferigo opened 2 years ago
I had preliminary results of differentiating against the hardware parameters introduced in #101 (and refined in #120).
I created a simple toy problem of a box falling for 1 second over a compliant flat terrain. I designed an quick optimization pipeline that simulates two of such boxes: a nominal one with default parameters, and a training one with wrong parameters. Once I collect trajectories from both, I compute the RMS error between the two trajectory, get the gradient w.r.t. a set of hardware parameters, and with it update the parameters of the training model.
As first attempt, this seems promising. Of course, when dealing with quantities not belonging to $\mathbb{R}^n$, the optimization should be properly adapted. For $\text{SE}(3)$, I believe we can exploit jaxlie
. For the inertia tensor, probably we need to find a proper parameterization for symmetric positive-definite matrices that also meet triangular inequality. I would start looking at a principal axes decomposition together with the enforcement of positive principal moments of inertia (maybe storing them as logarithms).
cc @flferretti @CarlottaSartore @traversaro @S-Dafarra @DanielePucci
Super, important for many in @ami-iit/alpha-delta-tau
A good example that compares a derivative computed analytically w.r.t. the same quantity obtained by AD is:
Another example of using AD is the validation of $\dot{M}(\mathbf{q}) = C(\mathbf{q}, \boldsymbol{\nu}) + C^\top(\mathbf{q}, \boldsymbol{\nu})$ performed in:
JAXsim currently focuses only on sampling performance, exploiting
jax.jit
andjax.vmap
. Being written in JAX, the forward step of the simulation should be differentiable (also considering contact dynamics, since it is continuous), but it has not yet been investigated.Interesting resources: