Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Computing gradients and hessians #437

Closed
ghost opened this issue Feb 9, 2018 · 12 comments
Closed

Computing gradients and hessians #437

ghost opened this issue Feb 9, 2018 · 12 comments

Comments

@ghost
Copy link

ghost commented Feb 9, 2018

Is there an implementation to compute gradients and hessians of the dynamics ? i can find a finite-difference implementation in algorithms, will I be able to use this ?

@jcarpent
Copy link
Contributor

jcarpent commented Feb 9, 2018

Which derivatives do you need?

@ghost
Copy link
Author

ghost commented Feb 9, 2018

rearranged my dynamics into the form dx/dt = f(x,u), wondering if there is functions to compute df/dx, df/du etc .. or if there is a general way that these are computed when solving typical optimization problems

Thanks alot

@cmastalli
Copy link
Member

I would take this opportunity to open a discussion about automatic differentiation. I know that we can find analytical derivatives of some rigid body algorithms, but do you think we can do it for all the algorithms? In negative case, it would be nice to extend Pinocchio with CppAd

@jcarpent
Copy link
Contributor

jcarpent commented Feb 9, 2018

@Bilalhmd It really depends on the choice of your robot. Is a free floating base system or not.
I would really recommand you to first use finite differences for prototyping your codes.
We already provide some derivatives for doing such kind of computations.
We hope to be able to integrate the analytical derivates in Pinocchio, but it remains a work in progress.

@jcarpent
Copy link
Contributor

jcarpent commented Feb 9, 2018

@cmastalli It would be interested indeed, but AD does not solve all the problems. It is also a hard to make all the code compliant with operator overloading.
We let this task as a very low priority level.

@jcarpent
Copy link
Contributor

@Bilalhmd Do you need additional help for derivatives? I will close this issue.
Feel free to open it again if you have other questions.

@jcarpent
Copy link
Contributor

@Bilalhmd A while ago, you asked for computing derivatives in Pinocchio.
This message just to inform you that they are now available on the devel branch of Pinocchio.
There is a RSS paper which explains the computations: https://hal.laas.fr/hal-01790971

Best,

Justin

@hammoudbilal
Copy link

hammoudbilal commented Nov 6, 2018

Hi, this has been really helpful, it seems to me that the terms regarding the contact/external forces are not included in the code, for example in the forward dynamics derivative dFD/dq should i just simply add (dM_inv/dq).J^T.f_{ext} + M_inv.(dJ^T/dq).f_{ext} ?

best
Bilal

@jcarpent
Copy link
Contributor

jcarpent commented Nov 6, 2018

They are taken into account on the devel branch.

@hammoudbilal
Copy link

found it, thanks! it seems that only the python binding was missing for the extended version of the function, i will stop posting on this thread.

@jcarpent
Copy link
Contributor

jcarpent commented Nov 6, 2018

Do you need them?

@hammoudbilal
Copy link

no everything works fine, thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants