Forked and heavily modified to use the worlds with ROS for SLAM simulations.
Initially the paths contained in the files were strange and hardcoded in a way that only allowed an execution using gazebo
from the original folder.
In order to untie the files the following operations have been performed:
-
first all the
models
folders have been gathered in a single one. The original ones are in the zip containing the world file too. For example, forsmall_house.world
the files are inDataset-of-Gazebo-Worlds-Models-and-Maps/worlds/small_house/small_house.zip
. Many of the worlds share the same models. -
the keyword
file://
has been modified when the patternfile://model/
was found, in order to avoid stange tricks with the path. Basically without modifying it the files expect the meshes to be inGAZEBO_MODEL_PATH/models
but sinceGAZEBO_MODEL_PATH
is already (normally, without touching anything)~/.gazebo/models/
then another nestedmodels
folder would be needed, and exporting folders causes troubles. Adjusting the folder structure to avoid touching paths has worked so far, with the inverse strategy being a total failure for every attempt. Again, I want to sleep at night, let's finish the project. -
all the instances of the keyword "file", that is used to source a file, have been replaced by "model", since the first one creates problems that have not been resolved yet. the urgencies of actually concluding the project deprived me of any will to investigate further, therefore just know that it works now, but changing anything would probably break it, for unknown reasons. The commands used are
find . -type f -name "*.config" -print0 | xargs -0 sed -i 's!file://models/!file://!g'
andfind . -type f -name "*.sdf" -print0 | xargs -0 sed -i 's!file://models/!file://!g'
executed in the models fodler, once they have been gathered. -
once the file paths are set, the other preoccupation is changing the path to the photos contained in the DAE files. assuming
models
andphotos
are on the same folder level, the path is changed by usingfind . -type f -name "*.DAE" -print0 | xargs -0 sed -i 's!../../../../photos!../../../photos!g'
To use the worlds copy the folders models
and photos
into ~/.gazebo
, and the worlds into $(find px4_tests)/worlds
so that they are usable though the launch files provided in the ros package.
export GAZEBO_MODEL_PATH=/home/<user_name>/.gazebo/models/small_house/models/
gazebo small_house.world