robotology / idyntree

Multibody Dynamics Library designed for Free Floating Robots
BSD 3-Clause "New" or "Revised" License
171 stars 67 forks source link

Compute partial derivatives of jacobian columns w.r.t. to joint positions AKA Hessians #464

Open traversaro opened 6 years ago

traversaro commented 6 years ago

@S-Dafarra asked about this. This derivative have the nice properties that everything boils down to a lot of 6D cross product between all the joint motion subspace vectors.

References on this:

Also check the iKin implementation of Hessians: https://github.com/robotology/icub-main/blob/master/src/libraries/iKin/src/iKinFwd.cpp#L1124 .

S-Dafarra commented 6 years ago

What about the floating base part? Should we consider a 6dof joint there? Also, is there any possibility to use these computations also for the matrix mapping base velocity and joints velocity to the robot momentum?

S-Dafarra commented 6 years ago

Just to provide another source, Equation 13 of https://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=240619 corresponds to Equation 37 of https://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=1554272

traversaro commented 6 years ago

It depends what you need to compute for the floating base part. Depending on the choice of the frame velocity representation, the joint part of the jacobian may or may not depend on the floating base position/orientation, while for the derivatives of the adjoint transform (i.e. that may be the base part of the jacobian, again depending on the velocity representation) the procedure is a bit more complicated. If you write down formally the quantity you want to derive, I think it will be easier to explain. For the robot momentum it is a bit more complicated because you have to account for all the composite rigid body inertia present in the formula of the momentum jacobian.

traversaro commented 6 years ago

FYI @mpbos This is a bit hard to understand know, but it is definitely related to your master thesis work.

traversaro commented 6 years ago

Related code in Pinocchio:

Related code in DART (warning: time derivative):

Related code in KDL (warning: time derivative):

S-Dafarra commented 6 years ago

Aren't those related to time derivative? :thinking:

traversaro commented 6 years ago

Yep, but if you expand the use of any velocity with $\mathrm{v} = J \nu$, you almost obtain the partial derivatives w.r.t. to the joint positions.

jcarpent commented 6 years ago

Dear iDynTree developers,

I have implemented such kind of derivatives here: https://github.com/stack-of-tasks/pinocchio/blob/devel/src/algorithm/kinematics-derivatives.hxx

I never explicitly compute the tensor H of dimension 6 x nv x nv (where nv is the dimension of the tangent vector - aka joint velocity) but rather H*v (v being the joint velocity). If you have any question on the code, I will be pleased to help you.

Best,

Justin

traversaro commented 6 years ago

Thanks @jcarpent for the useful insight and references.

S-Dafarra commented 6 years ago

Thanks @jcarpent! I will definitely go though that. I updated the above comment to have the references all together.

By any chance, do you have any document about the mathematical derivation you implemented?

jcarpent commented 6 years ago

A bit is explained here: https://hal.laas.fr/hal-01790971 When deriving RNEA derivatives, you can get for free the derivatives of the kinematics too. I will try to make these things clearer in a companion document that I need to write.

If you have any questions, I will be pleased to answer them.

S-Dafarra commented 6 years ago

Thanks again!

DanielePucci commented 5 years ago

I think that sooner or later we have to implement the Hessian. Let's discuss this in view of the current lab activities, and understand a possible timeline

CC @S-Dafarra

traversaro commented 5 years ago

Related issue in pinocchio: https://github.com/stack-of-tasks/pinocchio/issues/867 .