What's up with SDF, URDF, model and world files? How do I convert URDF to SDF?
When would you use each of the file types and how do you convert between them?
When would you use each of the file types and how do you convert between them?
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 simple_box.zip
, these all load in both gazebo and V-REP except V-REP doesn't seem to support textures:
- simple_box.zip your simple_box updated to load in gazebo and V-REP
- ball_bearing.zip should be dark gray, has a material definition (a V-REP option), and is otherwise very simple
- bookshelf.zip includes a texture and is composed of several simple boxes
- cinder_block.zip includes a collada mesh
The materials spec they have also seems to be important if there is to be a shelf made of wood: ```
<material>
<script>
<uri>file://media/materials/scripts/gazebo.material</uri>
<name>Gazebo/Wood</name>
</script>
</material>
```
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>
<inertial>
<pose frame=''>0 0 0 0 -0 0</pose>
<mass>1</mass>
<inertia>
<ixx>1</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>1</iyy>
<iyz>0</iyz>
<izz>1</izz>
</inertia>
</inertial>
<collision name='baseLink_collision'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
</collision>
<visual name='baseLink_visual'>
<pose frame=''>0 0 0 0 -0 0</pose>
<geometry>
<mesh>
<scale>1 1 1</scale>
<uri>model://simple_box/simple_box.dae</uri>
</mesh>
</geometry>
</visual>
</link>
</model>
</sdf>
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).
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.
Asked: 2017-06-05 21:48:26 -0500
Seen: 3,226 times
Last updated: Jun 05 '17
Convert .urdf to .sdf or load .urdf
Adding new fixed and rotating reference frames to robot URDF description
How to convert an URDF to SDF with Gazebo Ignition ?
How to simulate SDF model with Gazebo and ROS
Problems while parsing <gazebo> URDF elements with Gazebo7 and ROS Jade
How to convert *.urdf.xacro files to *.sdf for gazebo?
Gazebo crashes when SDF model is spawned through launch file
Why can't my UDFR be like my SDF in rviz? (REALLY LONG POST)