ROAM-Lab-ND / spatial_v2_extended

Extended version of Featherstone's spatial_v2 package
51 stars 27 forks source link

Some functions are not compatible with CasADi #10

Open ziyonghan opened 3 months ago

ziyonghan commented 3 months ago

Hi, Dr.Pat

Recent days, I try to use CasADi's symbolic framework to generate code, and I find that some functions like pluho and CMM are not compatible because the skew function goto the CasADi's inside same name function.

The function ID add some code to solve compatible problem at line 59.

How to solve the compatible problem in these functions?

Best, Han

ziyonghan commented 3 months ago

I have solved this problem temporarily, but I don't know if it is the best solution.

I comment out the skew function in GenericMatrixCommon.m, hope it helps.

Best, Han

pwensing commented 3 months ago

Hello Han,

Excellent.

One of my students faced a similar issue -- the patch fix they used was to re-name all instances of skew with a duplicate function named skew2. I don't love the name change to skew2 and so have not adopted that solution on main, but you can find it here: https://github.com/ROAM-Lab-ND/spatial_v2_extended/tree/CasADiConflictFree

I suspect the best option might be to reconfigure spatial_v2 as an importable package (similar to casadi) so that users can import functions of their choosing. This would require some directory rework, and also likely additional imports in each function, but I think it would avoid the collision you are facing. If you have any feedback on that path, I'd be happy to hear it / consider it.

ziyonghan commented 3 months ago

Hi Dr.Pat,

My temporary solution may affect the nlp solving function of CasADi, which is what I want to try in the future.

However, it should be stated that if we want the spatial_v2 library to have better versatility on various robots, the skew function conflict problem needs to be solved.

Based on my limited knowledge, both package and class will be able to solve this function conflict problem, but this is a complex project that requires your professional knowledge to design the directory structure of the spatial_v2 library. However, if it can be done, it will indeed make this library more universal, extensible and compatible with other libraries.

Best, Han