Open osrf-migration opened 4 years ago
Original comment by Diego Ferigo (Bitbucket: dgferigo).
Original comment by Louise Poubel (Bitbucket: chapulina, GitHub: chapulina).
suspect that, since the conversion happens inside sdformat code, the folder where the original urdf code is located is somehow ignored and it is not included in the search path for meshes.
That is correct. The URDF is first converted into a string and then passed to the SDF parser, so we lose it's file location on the way. Supporting relative paths inside URDF files would require propagating that file location somehow.
I have been encountering this issue when trying to load URDF/SDF files. The parser should simply ignore these tags in that case?
The parser should simply ignore these tags in that case?
This sounds dangerous; it seems non-trivial to predict what will be lost in the process (it would depend on the model), and silently ignoring tags with paths that can't be resolved may yield very unpredictable and surprising behavior on the user side.
Would adding a new attribute called source=""
that is added to <include>
-ed tags help? This way, there would always be a reference to where the tag originated from, which can be used downstream to resolve relative paths.
Is this fixed by https://github.com/gazebosim/sdformat/pull/1213 ?
Original report (archived issue) by Diego Ferigo (Bitbucket: dgferigo).
Description
If an urdf file has meshes defined with relative path wrt the model file (support introduced in sdformat#558), the meshes are not found.
The setup is the following:
<include><uri>
of the model file (the model’s parent folder is part ofSDF_PATH
). The world file is in an external folder far away from the model / mesh files.meshes
subfolder of the model’s directory).model.config
file in the same folder of the urdf model that loads the urdf with:<sdf>icub.urdf</sdf>
.Opening the world with
ign gazebo /path/to/include_model.world
fails producing errors about meshes not found:However, if I convert the urdf to sdf with
ign sdf -p model.urdf > model.sdf
, and modify themodel.config
to load the sdf, the meshes are found correctly.Versions
I’m on ubuntu 18.04 with sdformat and ign-gazebo compiled from sources.
sdf9@
8ba6c75 (ec4769ca8047b1484baa79ce5d3fcaaa96267ab1)ign-gazebo3@
d42d5baAdditional Information
The meshes folder is not on purpose inside
IGN_FILE_PATH
. If I add the folder to the env variable, meshes are found also in the urdf case (but the main point is that is should work also without this env var).It seems to me that the relative path support for meshes works only if the model is already a sdf model. If, instead, the model is an urdf that needs to be converted, the link to the meshes cannot be resolved. I suspect that, since the conversion happens inside sdformat code, the folder where the original urdf code is located is somehow ignored and it is not included in the search path for meshes.
cc @chapulina