[ERROR] ModelLoader :: loadModelFromFile : Error in parsing model from URDF.
[ERROR] Model :: computeFullTreeTraversal : requested traversalBase is out of bounds
[ERROR] Model :: getLinkIndex : Impossible to find link root in the Model
[ERROR] Model :: computeFullTreeTraversal : requested traversalBase is out of bounds
This is because model_path does not end with a /. In fact, changing the pseudo-code as follows:
Consider the following pseudo-code in Matlab:
This will fail with an error like:
This is because
model_path
does not end with a/
. In fact, changing the pseudo-code as follows:fixes the issue.
Though, we could make it more robust against this type of errors changing the way paths are concatenated in https://github.com/robotology/idyntree/blob/f4df648372a33b5471a78cbec5874931004dc0ef/bindings/matlab/%2BiDynTreeWrappers/loadReducedModel.m#L47C5-L47C5.
I suggest to use the built-in function fullfile of Matlab.