ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How can I transform an URDF file to an SDF file?

asked 2013-01-30 11:54:07 -0500

Jey_316 gravatar image

Hello, I want to know if there is any way to transform an URDF file to an SDF file. How can I transform an URDF file to an SDF file?

edit retag flag offensive close merge delete


it didnt work @Alexandr Buyval

john@john-K53SD:/opt/ros/fuerte/stacks/simulator_gazebo/gazebo/bin$ ./gzsdf print /home/john/ros/01-myfirstyo.urdf

bash: ./gzsdf: (the file or the directory doesnt exist)

Maybe it happens because I am using ros fuerte. What do you think?

Jey_316 gravatar image Jey_316  ( 2013-02-01 06:39:14 -0500 )edit

it's broken in fuerte, please ticket. Conversion works in groovy. Here's another way to source setup in groovy:

source rospack find gazebo/scripts/

then, you can run:

gzsdf print [your urdf file]

hsu gravatar image hsu  ( 2013-02-01 13:10:35 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-01-30 19:14:05 -0500

Alexandr Buyval gravatar image


You can use the following command:

$GAZEBO_PATH/Gazebo/Bin: ./gzsdf print your_urdf_file.urdf

and copy result to sdf-file.

I used this method in Groovy.

edit flag offensive delete link more


which sdf version please? because it is not working for sdf 1.4 :(

ChickenSoup gravatar image ChickenSoup  ( 2013-04-25 23:33:37 -0500 )edit

It seems I have used the version 1.3. But I don't sure that it is important. Which version of ROS have you used? What is your error?

Alexandr Buyval gravatar image Alexandr Buyval  ( 2013-04-26 19:16:59 -0500 )edit

@Alexandr Buyval I tried in both fuerte and groovy. The errors were: XML Element[turnGravityOff], child of element[link] not defined in SDF; Error reading element <link>,<model>,<sdf>. But, after modifying the tags according to the new sdf format manually I could convert the urdf to sdf. thanks

ChickenSoup gravatar image ChickenSoup  ( 2013-04-30 17:54:48 -0500 )edit

In newer versions of gazebo, the correct tool is now a flag on the gz executable: gz sdf -p my_urdf.urdf > my_sdf.sdf

Adam Allevato gravatar image Adam Allevato  ( 2017-10-12 14:22:18 -0500 )edit

Question Tools

1 follower


Asked: 2013-01-30 11:54:07 -0500

Seen: 5,266 times

Last updated: Jan 30 '13