mahaarbo / urdf2casadi

Python library for getting a casadi function for the forward kinematics of a URDF chain
MIT License
95 stars 32 forks source link

get_coriolis_rnea returns inaccurate values when non-zero off-diagonal inertial values present #2

Closed neemoh closed 3 years ago

neemoh commented 4 years ago

Hi, I noticed when the urdf links contain non-zero ixz, ixy or iyz values, the C vector starts to deviate from what I get from KDL and other other libraries. You might wanna check this.

mahaarbo commented 4 years ago

Hi, sorry for the late reply. Do you have an example URDF that this occurs for?

neemoh commented 4 years ago

Hi, so it turned out it was not only coriolis but also M deviates from what you get from KDL, when there's a non-zero off-diaginal inertia. You can see this by using any of the example URDFs in your lib. Just change one of the zero off-diagonal inertia elements to some large value and compare for example for_dyn to that of KDL at high joint velocities. Unfortunately, I don't remember now, but something like changing the signs where you build the inertia tensor solved the issue..

mahaarbo commented 3 years ago

I still haven't gotten around to look at this since it works fine for diagonal inertia matrices. I think maybe the implementation from Featherstone assumes that the frames are attached in such a way that it aligns with the principal axes and a fast workaround would be to just move the frames to that location. Sorry for the long delay and lack of response.