stack-of-tasks / pinocchio

A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
http://stack-of-tasks.github.io/pinocchio/
BSD 2-Clause "Simplified" License
1.78k stars 375 forks source link

Add options to separate algorithms #384

Closed proyan closed 6 years ago

proyan commented 7 years ago

Currently, some algorithms are duplicated in others. For example:

Would it be possible to explicitly specify the duplicated algorithm in the argument list to avoid recomputations? For example, computeJacobians could also take a parameter asking for forwardKinematics, and so on

jcarpent commented 7 years ago

computeAllTerms do all the computation once. You should use this one if your need all the dynamics term.

If you really want to avoid internal recomputations, the idea is to write a personalized algo by yourself.

proyan commented 7 years ago

computeAllTerms do all the computation once. You should use this one if your need all the dynamics term.

That would mean additional computations even if they are not needed. My basic argument is to avoid these.

If you really want to avoid internal recomputations, the idea is to write a personalized algo by yourself.

In that case, I would be reimplementing the same algorithms already done in pinocchio, which beats the purpose.

I did the jacobian time test: Over hundred iterations, current computeJacobians algorithm takes 2.9 us, and if we add a flag for forward kinematics, the time is 3.1us for computeJacobians(forwardKinematics=true)

jcarpent commented 7 years ago

The idea is to compute once all the terms and then to call for example getJacobian to recover the desired Jacobian from the current values in data.

proyan commented 7 years ago

Currently the call to computeJacobians implies a call to forwardKinematics. In my opinion, it would be better to make this call explicit.