Gazebo | Ignition | Community
Ask Your Question

URDF to SDF conversion using gzsdf

asked 2014-09-19 04:14:22 -0600

Felix gravatar image

updated 2014-09-19 04:21:05 -0600

Dear all,

As I'm currently trying to tune the dynamic behaviour of my robot modelled in a urdf(.xacro) file, I investigated the various urdf and gazebo tags available in order to see their effect to the simulation respectively.

This thread mainly deals with the conversion from urdf to sdf format using the gzsdf tool. So this thread is probably the first of several threads.

In the following I state my observations and would kindly ask someone to confirm them...or give explanations otherwise ;-)

I use the following setup: Trusty, Indigo, gazebo2_2.2.3-1~trusty_amd64 The robot I'm trying to tune is the Schunk lwa4p_extended. URDFs can be found here URDFs and launch files.
Other related links: gazebo-urdf-tutorial and sdf1.4.

I will number the questions so that answers can be referenced accordingly.

General questions

  1. The SDF version used in my setup (trusty, indigo, gazebo2) is SDF1.4?
  2. Where is SDF1.5 used? With gazebo3? Or gazebo4?
  3. You can convert a urdf.xacro file to sdf uding the following commands

    rosrun xacro robotlwa4pextended.urdf.xacro > robotlwa4pextended.urdf
    gzsdf print robotlwa4pextended.urdf > robotlwa4pextended.sdf

  4. When spawning a robot in gazebo using gazebo_ros/spawn_model the same gzsdf is used to convert the parameter /robot_description to sdf format which is then used in gazebo?

  5. Within a urdf gazebo tag (referencing a link or joint), I can use all tags listed in the gazebo-urdf-tutorial? I.e.:

    • material, gravity, dampingFactor, maxVel, minDepth, mu1, mu2, fdir1, kp, kd, selfCollide, maxContacts, laserRetro for links
    • kp, kd, stopCfm, stopErp, provideFeedback, cfmDamping, fudgeFactor for joints
  6. Within a urdf gazebo tag (referencing a link or joint), I can also use sdf tags from sdf1.4 directly?

Tag specific questions

  1. gravity, selfCollide and self_collide (gazebo tag for links)
    Adding one of the tags above for a link, an additional tag is added to the resulting sdf file, i.e. there are then two gravity tags for the same link in the sdf file where the first is always set to true (1) and the second sdf tag holds the value set in the urdf. I assume that when gazebo parses the sdf file, it always finds the first tag using their value, thus always neglecting what has been set in the urdf.
  2. kp, kd, mu1, mu2, maxVel, minDepth, fdir1, maxContacts, laserRetro, dampingFactor (gazebo tag for links)
    All those tags seem to be converted to sdf correctly.
  3. damping and friction (urdf tag for joints)
    friction is currently ignored, i.e. it's value is not even converted into the sdf file?
  4. Empty gazebo tag referencing a joint

    <gazebo reference="${name}_1_joint">
    is converted into 
  5. stopCfm, stopErp (gazebo tag for joint)

    <gazebo reference="${name}_1_joint">
    is converted into 
  6. cfmDamping, implicitSpringDamper, cfm_damping, implicit_spring_damper (gazebo tag ...

edit retag flag offensive close merge delete


Note that in newer versions of Gazebo, the tool used to convert from URDF to SDF has changed, and it is now `gz sdf -p my_urdf.urdf > my_sdf.sdf`

Kukanani gravatar imageKukanani ( 2017-10-12 13:48:51 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2016-09-22 05:42:44 -0600

Franzisdrak gravatar image

updated 2016-09-22 05:55:36 -0600

Hi there,

i know this feed is a little outdated but i currently have issues when trying to go from xacro->urdf->sdf into gazebo. I have a fairly complex setup and need to change friction of models in my simulation.

Currently in my xacro i set up a wheel like this:

>   <link name="wheel_f_l">
>     <collision name="collision">
>       <geometry>
>         <cylinder radius="${wheel_radius}"
>              length="${wheel_length}"/>
>       </geometry>
>     </collision>
>     <visual name="visual">
>       <geometry>
>         <cylinder radius="${wheel_radius}"
>           length="${wheel_length}"/>
>       </geometry>
>     </visual>
>     <xacro:solid_cylinder_inertial
>       radius="${wheel_radius}" height="${wheel_length}"
>       mass="${wheel_mass}" gcx="${0}" gcy="${0}" gcz="${0}"/>   
>     </link>

I then create a reference like this:

<gazebo reference="wheel_r_l">

but for some reason my parameters dont survive the conversion to sdf via. gz sdf -p test.urdf > test.sdf. I use Gazebo6.

Help would very much be appreciated!

edit flag offensive delete link more

answered 2014-09-19 11:17:45 -0600

nkoenig gravatar image

Great questions. I like the organization. Below are responses.

General Question Responses

  1. Yes.

  2. Gazebo 4.0

  3. Yes

  4. The sdformat library is used. This library is used in both gz sdf and the ros spawn mechanism

  5. You should be able to. If you notice a problem, then we have bug. Please let us know if that is the case.

  6. Same answer as number 5.

Tag specific responses

  1. This sounds like a bug. Here is an issue to track this problem.

  2. Great.

  3. Joint friction is under development. See this pull request. We will add in joint friction support once Gazebo is able to process it.

  4. Those are the default values for cfm and erp.

  5. Not sure if this is a question.

  6. implicit_sping_damper replaces cfm_damping. Both are set to make sure it's compatible with old and new versions of Gazebo.

  7. This is a bug, see this issue.

edit flag offensive delete link more


Thank you, Nate, for the clarification!

General.6: As to "Using SDF tags in URDF (gazebo extension) directly?" see also this new thread (

Specific.4: Does it make a difference whether those tags are included in the converted SDF or not? I assume default values are used also if the tags are not set in the SDF file.

Felix gravatar imageFelix ( 2014-09-20 06:23:48 -0600 )edit

General.6: I'll respond in that question thread. Specific.4: Default values will be used, even if the values are not present in the SDF file.

nkoenig gravatar imagenkoenig ( 2014-09-22 17:48:48 -0600 )edit
Login/Signup to Answer

Question Tools


Asked: 2014-09-19 04:14:22 -0600

Seen: 8,634 times

Last updated: Sep 22 '16