Closed hammoudbilal closed 4 years ago
Actually at the time of writing I didn't know Pinocchio had a built-in method to do that. I wonder whether they do something more than Cholesky. Maybe they exploit sparsity?
Anyway computing directly the product J M_inv, rather than computing M_inv and then multiplying times J, is in general faster, especially if J has less rows than columns.
yes, they actually compute it by using a modified ABA. I will time both approaches before closing this issue
here are some results to close this issue,
computation time:
-using pinocchio built in Minv: for a point mass time to compute M(6,6) is 1 us. For solo8 where M(14,14) it takes 6 us.
-using eigen inverse method: for a point mass time to compute M(6,6) is 2 us. For solo8 where M(14,14) it takes 6 us same as pinocchio.
accuracy:
using pinocchio built in method shows a closer match to the euler simulator, here is the base height from the sinusoid motion using TSID, first figure is using pinocchio's method, the second one is using Eigen::MatrixXd::inverse()
for now I will keep using the pinocchio provided method
It's really weird that you get significantly different results. I was expecting to see just different computation times, but same numerical results. What if you multiply M times its inverse? How close is the result to the identity matrix in the two cases?
I will reopen it until I check this and post some results
These results are a bit weird to me. It seems that both Euler and Exponential are rather independent of the time step, and they give different results regardless of how much you decrease the time step. In theory the two integration methods should converge to the ground truth as you decrease the time step, as it was the case for the point-mass simulation.
I agree, I tried decreasing integration time step for both simulators as a sanity check, things start to diverge. I will write proper unit testing to explore this issue
I've run some tests in Python comparing the approaches for computing the forward dynamics:
The first two give exactly the same result. The last two do not work. I've opened an issue to ask which approach should be the best: https://github.com/stack-of-tasks/pinocchio/issues/1215
I actually had a bug in my script. Now also pin.computeMinverse gives the same results as the first two methods (I haven't tested the pin.cholesky approach yet).
I'm gonna close this issue and open a new one trying to make it clean
is there a reason (numeric/algorithmic) for computing the inverse of the inertia matrix here
https://github.com/andreadelprete/consim/blob/master/script/robot_simulator_exponential_integrator.py#L302
using Cholesky decomposition instead of the in pinocchio built-in methods ?