Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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>.dsv.in, in which I've put

prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share/@PROJECT_NAME@/models
prepend-non-duplicate;IGN_GAZEBO_RESOURCE_PATH;share/@PROJECT_NAME@/worlds

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

ament_environment_hooks("${CMAKE_CURRENT_SOURCE_DIR}/env-hooks/${PROJECT_NAME}.dsv.in")

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!