I'm trying to include another sdf with , I can load it properly with an absolute path to the file but I want to make it a relative path. Structure is as follows:

  • package
    • src
    • models
    • worlds
      • model_1.sdf
      • model_2.sdf

For example I want to load model 2 inside of model 1. I can only find examples which are outdated, if anybody can point me in the right direction, that would be appreciated.

Using ROS2 humble with gazebo fortress


  • $\begingroup$ You wrote: "I'm trying to include another sdf with ," so... with what? $\endgroup$
    – cst0
    Oct 2, 2023 at 12:59

3 Answers 3


as I am not able to comment, I am writing my suggestion in answer section.

I am assuming that you want to add the same model in the sdf. You can include the models using the merge tag in sdf. Just for an example:

<!-- <include>
    https://fuel.gazebosim.org/1.0/OpenRobotics/models/Coke Can

    https://fuel.gazebosim.org/1.0/OpenRobotics/models/Coke Can
  <pose>0 0 1 0 0 0 </pose>
</include> -->

You can refer the sdformat documentation and different tags information here: http://sdformat.org/spec?ver=1.10&elem=model


To include models in the SDF file, you need to write the models directory path to the environment variable IGN_GAZEBO_RESOURCE_PATH, which would allow it to be visible. After which, you can reference models in your SDF with the following syntax:


Note: Your models have to be well-defined with a config file. For reference example you can check out this repository. It includes models defined in the repository in its world SDF.


you can post refer to this Post, if u need any help, let me know. I was able to do it.

Steps to Follow:

1.Create a Models Folder in your Directory(package file) and store the sdf file there. I have created a single Folder named Box inside the Models File

  • Models
    • Box
      • model.config
      • model.sdf
      • meshes(folder)
        • mesh1.dae
        • mesh2.stl
        • mesh3.stl

below is the info inside present in the all the files.

a. Model.config file

  <?xml version="1.0"?>
    <sdf version='1.6'>model.sdf</sdf>
<email>[email protected]</email>
<description>This is a box</description>
b. model.sdf
<?xml version="1.0" ?>
<sdf version="1.5">
<model name="Box">
<pose>0 0 0 0 0 0</pose>
<link name="link">
  <collision name="collision">
        <scale>0.25 0.25 0.25</scale>
  <visual name="visual">
        <scale>0.25 0.25 0.25</scale>

c. How to use the Launch File in python

spawn_entity = Node(package='gazebo_ros',
                    arguments=[ '-entity','Box','-file', LaunchConfiguration('sdf_model'),
                                '-z', '0.0',
                                ], output='screen')

return LaunchDescription([

I hope this will be useful for everyone!!

  • $\begingroup$ Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Nov 2, 2023 at 9:02
  • $\begingroup$ While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review $\endgroup$ Nov 2, 2023 at 12:58
  • $\begingroup$ I will add it below as an Answer $\endgroup$
    – Kedar
    Nov 3, 2023 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.