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

Computation of the combined, full-body inertia (SRBD) #1287

Closed oliwiermelon closed 4 years ago

oliwiermelon commented 4 years ago

Hi,

I am trying to use Pinocchio to calculate the combined, full-body inertia of an articulated body which accounts for the floating base and the end-effectors, in their nominal configuration from a URDF for a Single Rigid Body Dynamics (SRBD) model.

I am aware of the CRBA algorithm which produces the joint-space inertia matrix (n x n). I am looking for a function/approach that:

jcarpent commented 4 years ago

Hi @oliwiermelon,

The best solution would be:

  1. call crba(model,data,q)
  2. retrieve the total spatial inertia with data.Ycrb[1], which is expressed in the base coordinate system (assuming you are working with a free floating system).
  3. data.Ycrb[1].inertia() is the quantity you are looking for.
oliwiermelon commented 4 years ago

Thank you @jcarpent, it is exactly what I needed! Note: data.Ycrb[1].inertia

jcarpent commented 4 years ago

Note: data.Ycrb[1].inertia

In Python ;). In C++, data.Ycrb[1].inertia().