Gazebo | Ignition | Community
Ask Your Question

How to structure a model database for Gazebo Ignition

asked 2022-06-09 10:07:09 -0500

Clement gravatar image


I'd like to create a model/world database for my Gazebo Ignition projects.
I've created the following folder structure for my database:

├─ gazebo-database/
 │   ├─ models/
 │   │   ├─ model1/
 │   │   ├─ model2/
 │   ├─ worlds/
 │   │   ├─ world1/
 │   │   │   ├─ world1.sdf
 │   │   ├─ world2/

I'd like to be able to open a world (let's say world1.sdf) using:

ros2 launch ros_ign_gazebo ign_args:="-v -r world1.sdf"

I tried to set IGN_GAZEBO_RESOURCE_PATH env variable to /gazebo-database but it didn't work.
It seems that the database is not parsed to find the model.
It only works if I set the IGN_GAZEBO_RESOURCE_PATH to /gazebo-database/worlds/world1/
I don't want to have to add all the path to the worlds manually...

Can someone explain me how to do ?

edit retag flag offensive close merge delete


Do the worlds really need to be in their own subdirectories?

azeey gravatar imageazeey ( 2022-06-11 00:15:40 -0500 )edit

No not really, but it would be cleaner to have everything related to a world in its directory.
In this repository, they create a folder for each world:

Clement gravatar imageClement ( 2022-06-13 04:20:36 -0500 )edit

The folders in the gazebo_models repo are models, not worlds. There's a difference between the two. What you have for the models in your original example should work, but you'd set IGN_GAZEBO_RESOURCE_PATH to /gazebo-detabase/models. More info here:

azeey gravatar imageazeey ( 2022-06-13 11:22:19 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2022-06-13 04:31:33 -0500

Clement gravatar image

And here: they use python to add the full path to the worlds in IGN_GAZEBO_RESOURCE_PATH.
I'll do something similar then.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2022-06-09 10:07:09 -0500

Seen: 29 times

Last updated: Jun 09