Gazebo | Ignition | Community
Ask Your Question

How to create a model(.sdf) file that can be inserted at will in Gazebo?

asked 2020-06-06 03:08:14 -0500

pumpkin gravatar image

Hello there,

Im trying to import some model from 3dwarehouse, and I have created a .world file following this. But now,I realized if I want to insert this model to other world, I must convert it to a .sdf file which I have failed so many times. Can anyone help me? This is my .world file:

<?xml version="1.0"?>
<sdf version="1.4">
  <world name="default">
    <model name="clock">
      <pose>0 0 0.49  0 1.57079 0</pose>
      <link name="up">
        <visual name="visual">

And I have created the model.sdf, model.config and other files, but it still doesnt work.

├── materials
│   ├── scripts
│   │   └── clock.materials
│   └── textures
│       └── material_22.png
├── meshes
│   └── model.dae
├── model.config
└── model.sdf

The .sdf file:

<?xml version='1.0'?>
<sdf version='1.6'>
  <model name='clock'>
    <link name='up'>
      <pose frame=''>0 0 0 0 -0 0</pose>
      <visual name='visual'>
          <shader type='pixel'/>
        <pose frame=''>0 0 0 0 -0 0</pose>

The scripts:

material clock
        texture material_22.png
    scale 1 1
edit retag flag offensive close merge delete


Fix the mesh uri. <uri>model://clock/meshes/model.dae</uri>

nlamprian gravatar imagenlamprian ( 2020-06-08 23:22:40 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-06-08 15:42:31 -0500

chapulina gravatar image

The bit you're missing is probably setting the GAZEBO_MODEL_PATH environment variable. Do it like this:

export GAZEBO_MODEL_PATH=<path to parent directory of clock>:$GAZEBO_MODEL_PATH

Also make sure that your model's directory is called clock.

What Gazebo does is substitute model:// with <path to parent directory of clock>. So it will load:

<mesh><uri><path to parent directory of clock>/clock/model.dae</uri></mesh>

edit flag offensive delete link more


I have put the files in the ~/.gazebo/models/ directory, and I can find the model's name in the side navigation bar but cant add the model to world.

pumpkin gravatar imagepumpkin ( 2020-06-08 19:31:26 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-06-06 03:08:14 -0500

Seen: 82 times

Last updated: Jun 08 '20