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.83k stars 383 forks source link

Possible unnecessary computation in computeMinverse #2171

Closed alpylmz closed 6 months ago

alpylmz commented 6 months ago

Hi, I am using Pinocchio to calculate inverse inertia matrix for my robot arm, and I am working on the computeMinverse function for research purposes. In include/pinocchio/algorithm/aba.hxx line 310, there is a computation that I couldn't exactly understand.

typedef typename SizeDepType<JointModel::NV>::template ColsReturn<typename Data::Matrix6x>::Type ColsBlock;
ColsBlock J_cols = jmodel.jointCols(data.J);
J_cols = data.oMi[i].act(jdata.S());

It seems it doesn't do anything useful, and if I delete this part my compuations for the Panda arm seems unaffected. Is there anyone who can verify that?

jcarpent commented 6 months ago

What do you want to do exactly (could you provide full details)?

alpylmz commented 6 months ago

It seems that this computation may only be necessary for certain types of robots. Perhaps we could encapsulate this computation within an if condition to check if it's required. If you think that could be useful, I can provide test cases for different robots to show it, and maybe someone who understands this can help us.

jcarpent commented 6 months ago

My question was rather oriented towards your need: why do you need to compute the mass matrix inverse ?

alpylmz commented 6 months ago

I have an optimal control based robot controller. I am using Minv in the constraints of the system. Currently I am only using a robot arm, but I'll use different robots in the future. Why do you ask?

jcarpent commented 6 months ago

My guess is that you might not be obliged to compute this quantity.