andreadelprete / consim

GNU General Public License v3.0
14 stars 1 forks source link

Integration accuracy without contacts #21

Closed andreadelprete closed 4 years ago

andreadelprete commented 4 years ago

In theory I think that Euler and Exponential should be equivalent as long as the robot is in the air. However, according to a test I just did (with the c++ simulators) they are not. Exponential is much more accurate. I just initialize Solo12, 1 meter above the ground and let it fall with zero joint torques. These are the integration errors over time: solo_in_the_air For some reason, Euler gets a very large error in the first integration step, whereas Exponential does not. Unless there's something I am missing, I'd say this is a bug.

@hammoudbilal could you look into this? I am using the latest version of the c++ simulator in master. The python script you can use to reproduce these results is this. This script is supposed to be used for a trotting motion, but since results looked bad for trotting I've started simplifying things (in particular here and here) until I've found this issue.

hammoudbilal commented 4 years ago

yes I know why this issue appears, it is just that exponential solver still has pinocchio::aba() for integrating in the air here compare pinocchio::ComputeMInverse() here

andreadelprete commented 4 years ago

Maybe @jcarpent could help us with this. We are computing the forward dynamics with 3 different methods here. They should all give the same results, but they don't. For instance:

aba_chol_Minv

When I do the same in Python I get the same results, so clearly there's something wrong with the way we are using these methods in C++. Any idea what could be the problem?

andreadelprete commented 4 years ago

Thanks to the PR of @jcarpent now the Euler simulator gives consistent results when the robot is in the air. However, this is not the case for the ExponentialSimulator. Here some results: figure_1 Basically it seems that everything works except for Exp-Cholesky. But Cholesky works fine in the Euler simulator.

Moreover, what's really weird is that if I replace this line in the code with this:

dvMean_.noalias() = data_->Minv*mDv_; 

(as it was done in the PR by @jcarpent ) and recompile, then I get different results also for Exp-ABA, which shouldn't be affected by this change: figure_2 The line corresponding to Exp-ABA is a bit hard to spot, but it's basically overlapping with the one of Exp-Cholesky.

The only possible explanation I have for this is some memory issues. Any other idea?

hammoudbilal commented 4 years ago

hi @andreadelprete , there was a minor bug here that i fixed, could you confirm that his fixes the issue you see with Exp-Cholesky ?

andreadelprete commented 4 years ago

I confirm that this solves the problem. However, I am still worried about the result I reported above, because I am afraid there might be some issues with the memory. I don't know how to proceed to try and find them though.

jcarpent commented 4 years ago

Could we do a meeting to explain me in details the issue you have in mind?

andreadelprete commented 4 years ago

Let's close this issue for now