Gazebo | Ignition | Community
Ask Your Question

What's up with SDF, URDF, model and world files? How do I convert URDF to SDF?

asked 2017-06-05 21:48:26 -0600

Andrew Hundt gravatar image

updated 2017-06-05 21:53:29 -0600

When would you use each of the file types and how do you convert between them?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2017-06-05 21:50:57 -0600

Andrew Hundt gravatar image

updated 2017-06-05 21:54:15 -0600

Loading things up in gazebo isn't exactly a walk in the park it seems they need things to be in a very specific layout which I detail below.

└── simple_box
    ├── model.config
    ├── simple_box.dae
    ├── simple_box.sdf
    └── simple_box.urdf

The following gazebo command will convert files, provide warnings about what is wrong, and print a converted file out on the command line:

gz-8.1.1 sdf -p ~/src/bullet3/data/kuka_iiwa/kuka_with_gripper.urdf

The printout which can be redirected to overwrite the original sdf file, for example:

gz-8.1.1 sdf -p ~/src/bullet3/data/kuka_iiwa/kuka_with_gripper.urdf >  ~/src/bullet3/data/kuka_iiwa/kuka_with_gripper.sdf


Here are some very simple models I've compressed for convenience, plus an updated, these all load in both gazebo and V-REP except V-REP doesn't seem to support textures: - your simple_box updated to load in gazebo and V-REP - should be dark gray, has a material definition (a V-REP option), and is otherwise very simple - includes a texture and is composed of several simple boxes - includes a collada mesh

The materials spec they have also seems to be important if there is to be a shelf made of wood: ```



And gazebo won't load model/mesh files next to the sdf file unless it is specified with model://model_folder_name/model_mesh_file.dae, as you can see in this working version of simple_box.dae:

<sdf version='1.6'>
  <model name='cube'>
    <link name='baseLink'>
      <pose frame=''>0 0 0 0 -0 0</pose>
        <pose frame=''>0 0 0 0 -0 0</pose>
      <collision name='baseLink_collision'>
        <pose frame=''>0 0 0 0 -0 0</pose>
            <size>1 1 1</size>
      <visual name='baseLink_visual'>
        <pose frame=''>0 0 0 0 -0 0</pose>
            <scale>1 1 1</scale>

It seems part of the solution is that the models don't need to define the world, they can simply be a model like the files above. An additional requirement for gazebo is the model.config file, which specifies the name of the object and the path to the sdf file. Gazebo also requires model file (like collada).

Simulations aka World

The world definition is what has all those extra requirements such as specifying gravity, light sources, simulation refresh rate, etc. You may want to support simulation definitions, but it should likely not be used for simple model definitions.

Here is everything needed for a basic simulation world definition but note that there seems to be a small bug in the saved vs loaded dimensions as specified in gazebo 8.1.1.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-06-05 21:48:26 -0600

Seen: 2,831 times

Last updated: Jun 05 '17