Gazebo | Ignition | Community
Ask Your Question

URI for meshes not working in Fortress?

asked 2023-05-19 15:29:44 -0500

slim71 gravatar image

updated 2023-05-19 15:30:14 -0500

So, I'm trying to spawn a model in a running Ignition Fortress world (any will do, it doesn't change anything), through ROS2 Humble.

The model I'm using is this one, which as you can see uses <uri>model://X3/meshes/led.dae</uri> to load meshes and other stuff from the same folder in which model.sdf is located. The overall relevant structure is this:

|- src   
   |- pkg1
      |- description
         |- X3
            |- meshes_folder
            |- model.sdf
      |- launch
   |- pkg2

Of course both package have the conventional structure and the package.xml file; they still have only a launch file, but will be cmake_ament packages.

I can start Ignition with no problem, loading the desired world with the launch file from pkg2. I then use another launch file from pkg1 to load the X3 model, which is indeed found and loaded into Ignition but without meshes, as the terminal issues multiple lines like

Unable to find file with URI [model://X3/meshes/x3.dae]
Could not resolve file [model://X3/meshes/x3.dae]
Unable to find file[model://X3/meshes/x3.dae]
Mesh manager can't find mesh named [model://X3/meshes/x3.dae]
Cannot load null mesh [model://X3/meshes/x3.dae]
Failed to get Ogre item for [model://X3/meshes/x3.dae]
Failed to load geometry for visual: base_link_inertia_visual

and so on. I can't seem to understand how to get it working. I've seen multiple posts (like this one) about using

<gazebo_ros gazebo_model_path="${prefix}" />
<gazebo_ros gazebo_media_path="${prefix}" />

(or similar) being sure to also add <exec_depend>gazebo_ros</exec_depend> to the package.xml file and to install the directory in the package's share folder, like

    DIRECTORY config description launch

Even though I do this, I can't get it working.

Anyone has any suggestion?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-05-20 04:11:46 -0500

slim71 gravatar image

After another 12 hours, I've found an "alternate" solution, or the real one maybe.
Everything started from seeing this stuff about environment variables . In case the link breaks, the relevant part is

Gazebo will find your model as long as its parent path is listed on the environment variable GAZEBO_MODEL_PATH

(beware: in the link GAZEBO_MODEL_PATH is mentioned, but for me for Ignition Fortress the right one is IGN_GAZEBO_RESOURCE_PATH. You can find out yours by using ign help gazebo or similar, depending on your Gazebo/Ignition version)

Instead of the above, I've used environment hooks, found in this GitHub issue.
In the package loading the model (pkg1 in the example above) I added a folder env-hooks with a file <project_name>, in which I've put


adding every possible path I might need.
Then I made sure to hook it up adding


For reference, everything is also explained in the issue I've linked above, which points at this and this as examples. I bit of exaplanation on environment hooks is here, with more in depth explanations in the ColCon docs.

If anyone has good info for the package.xml solution, please feel free to add them here! I'll try it out to have a good reference point for both methods!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2023-05-19 15:29:44 -0500

Seen: 37 times

Last updated: May 20