ami-iit / adam

adam implements a collection of algorithms for calculating rigid-body dynamics in Jax, CasADi, PyTorch, and Numpy.
https://adam-docs.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
123 stars 19 forks source link

Question: Differentiability w.r.t what exactly? #58

Open JonathanKuelz opened 9 months ago

JonathanKuelz commented 9 months ago

Dear ADAM developers,

I just stumbled across your package and it looks amazing! However, there's a question I couldn't find an answer to in your examples and the README: If I am not mistaken, a JAX/PyTorch-implementation of the algorithms you included in ADAM should allow to compute gradients not only with respect to the joint configuration (as far as I understand, that's what you do in your examples), but leverage autograd to do so w.r.t any model parameter (e.g. joint offsets (aka link length) or inertial parameters).

Is that something that is supported by ADAM and if so, would you be so kind to provide me a pointer on where to start with something like that?

traversaro commented 9 months ago

cc @Giulero @CarlottaSartore

Giulero commented 9 months ago

Hi @JonathanKuelz! Thanks for your interest and for opening the issue :) You're right! This feature has been just introduced by @CarlottaSartore in #49. We introduced a new module, adam.parametric.casadi/pytorch/etcetc, that computes rigid body algorithms using parametrized body information. You can start to have a look at the tests, by checking the parametric tests folder to see how the methods are called. Also, I'd warn that the pytorch/jax interfaces are not really stressed: if you have some doubts or spot bugs don't hesitate to come to us!

Btw, @CarlottaSartore will tell you more about the rationale behind the parametric module!