Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iDynTree and CasADi MATLAB bindings install different files with the same name in the MATLAB path #865

Closed
traversaro opened this issue May 11, 2021 · 4 comments

Comments

@traversaro
Copy link
Member

iDynTree install the following files in the MATLAB path:

  • SwigGet.m
  • SwigMem.m
  • SwigRef.m

Differently from the rest of MATLAB files that are installed as part of the project-specific +iDynTree namespace, these three files are not project specific, and so are installed with the same name by other projects, such as CasADi. This would not be a problem if the files installed by the different projects were exactly the same. Unfortunately, for iDynTree/YARP And CasADi this is not the case, as iDynTree/YARP have a modified version of SwigRef.m since robotology-dependencies/swig#2 . As it is not simple to make sure that the CasADi version of SwigRef.m does not shadows the one of iDynTree introducing subtle bugs, probably the easier option is to ensure that iDynTree creates a iDynTreeSwigRef.m file, to avoid any conflict.

@traversaro
Copy link
Member Author

@CarlottaSartore if you have the setup in which you have installed both CasADi and iDynTree, can you please report here the output of which SwigRef.m in your MATLAB environment? Thanks!

@CarlottaSartore
Copy link

I have done which SwigRef.m in my MATLAB env and I have got the following output

>> which SwigRef.m
/home/csartore/personal_ws/Casadi/casadi_install/casadi/SwigRef.m  % SwigRef constructor

So I would say I am using the Casadi one rather than the iDynTree.

If I remove casadi from the matlab path I got instead the following output

>> which SwigRef.m
/home/csartore/iit_ws/robotology-superbuild/build/install/mex/SwigRef.m  % SwigRef constructor

I have tried also to remove from the Path both Casadi and the mex folder of the robotology. I have then added back them to the path first Casadi and then mex and I have got the following output

>> which SwigRef.m
/home/csartore/iit_ws/robotology-superbuild/build/install/mex/SwigRef.m  % SwigRef constructor

So I would say that in my configuration I use the Casadi SwigRef.m because I add to the path Casadi after robotology (Casadi is indeed automatically added to the path when I launch a Simulink model that depends on casadi )

@traversaro Let me know if you need any other information form my environment!

@traversaro
Copy link
Member Author

traversaro commented May 14, 2021

Apparently, exactly this bug caused problem recently when executing this script:

estimator = iDynTree.ExtWrenchesAndJointTorquesEstimator();
estimator.loadModelAndSensorsFromFile([modelPath,modelName]);
estimator.model().toString()
 
linkNetExtWrenches = iDynTree.LinkWrenches(estimator.model());
wrench = linkNetExtWrenches(estimator.model().getLinkIndex('l_sole_link'));
 
wrench.toMatlab()

raising this error:

Index exceeds the number of array elements (1).

Error in test (line 10)
wrench = linkNetExtWrenches(estimator.model().getLinkIndex('l_sole_link'));

@traversaro
Copy link
Member Author

Fixed by #868 and released in 3.2.0 for iDynTree .

Fixed by robotology/yarp-matlab-bindings#65 and released in 3.4.4 fo yarp-matlab-bindings .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants