Ask Your Question

Please help, converting urdf.xacro to SDF

asked 2013-05-13 12:29:13 -0500

Gazer gravatar image

updated 2014-01-28 17:16:31 -0500

ngrennan gravatar image

Hello all.

I am having trouble to convert the urdf.xacro files to sdf format, which is used by the newest version of gazebo. Any help will be greatly appreciated.

Thank you All! @Norman_Hendrich @hsu, please help!!!!!

edit retag flag offensive close merge delete


If you can provide more information, like the error msg etc, it would be easy to help.

ChickenSoup gravatar image ChickenSoup  ( 2013-05-13 16:55:59 -0500 )edit

Ok. I am interested in opening up the file download from I followed the gazebo 1.5 tutorial from gazebosim's website, it's very clear in opening up the sdf. I am now using gazebo 1.7, according the forum, .urdf.xacro file is no

Gazer gravatar image Gazer  ( 2013-05-14 06:43:32 -0500 )edit

longer supported. So I am thinking of converting the urdf.xacro file unto the sdf format. But I have no idea how to do that.

Gazer gravatar image Gazer  ( 2013-05-14 06:46:30 -0500 )edit

did you run "rosrun xacro [your_file.urdf.xacro] > [name_for_new_urdf.urdf]" and then "gzsdf print [name_for_new_urdf.urdf] > [name_for_new_sdf.urdf]"? and what is the error msg you're getting?

ChickenSoup gravatar image ChickenSoup  ( 2013-05-14 18:30:04 -0500 )edit

very weird. There might be a problem with my rosrun xacro, when I ran it, it did convert xacro > urdf succesfully, but when I open the urdf it converts, it shows <root xmlns:xacro=""> <!-- Included URDF Files --> </root>

That urdf file is empty

Gazer gravatar image Gazer  ( 2013-05-15 13:33:10 -0500 )edit

can you tell what exactly you typed?

ChickenSoup gravatar image ChickenSoup  ( 2013-05-15 18:06:02 -0500 )edit

sorry, thank you for all of your help so far. For some unknown reason, I tried the same command on friend's computer, it works flawlessly. But when I tried the same command : rosrun xacro my.xacro.urdf > my.urdf

a file was created. But when I open my.urdf, that file was actually empty

Gazer gravatar image Gazer  ( 2013-05-16 07:27:17 -0500 )edit

I still haven't figure it out what went wrong, but I guess I would use friend's computer for now. PS: I was also following following the gazebo tutorial from ROS website, I was unable to "roslaunch gazebo_worlds empty_world.launch" and "rosrun gazebo gzsdf print" to convert a file. So I guess

Gazer gravatar image Gazer  ( 2013-05-16 07:30:38 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-10-17 08:22:48 -0500


Apologies for the delayed response. You are trying to convert the wrong file. You need to run xacro on the top level file as shown below:

rosrun xacro `rospack find segbot_description`/robots/segbot.urdf.xacro use_full_gazebo_model:=true
edit flag offensive delete link more


The following problems appeared: File "/opt/ros/groovy/lib/python2.7/dist-packages/roslaunch/", line 260, in _arg raise ArgException(arg_name) roslaunch.substitution_args.ArgException: use_full_gazebo_model

Lili Meng gravatar image Lili Meng  ( 2013-10-17 08:47:49 -0500 )edit

@Lili Meng: Groovy xacro has a bug in it. Download the hydro source here:

piyushk gravatar image piyushk  ( 2013-10-21 11:30:49 -0500 )edit
Lili Meng gravatar image Lili Meng  ( 2013-10-30 14:08:58 -0500 )edit

piyushk gravatar image piyushk  ( 2013-11-01 07:19:03 -0500 )edit

Try typing out the link, or paste it from above. the original link I posted has bad html tag attached in the link.

piyushk gravatar image piyushk  ( 2013-11-01 07:19:50 -0500 )edit

@piyushk: Thank you, I have downloaded the new xacro and rosmake it, and after that tried the rosrun xacro `rospack find segbot_description`/robots/segbot.urdf.xacro use_full_gazebo_model:=true, but it still has many problems. Traceback (most recent call last): File "/opt/ros/groovy/stacks/xacro/", line 35, in <module> xacro.main() File "/opt/ros/groovy/stacks/xacro/src/", line 563, in main eval_self_contained(doc) File "/opt/ros/groovy/stacks/xacro/src/", line 504, in eval_self_contained eval_all(doc.documentElement, macros, symbols) File "/opt/ros/groovy/stacks/xacro/src/", line 457, in eval_all eval_all(body, macros, scoped) File "/opt/ros/groovy/stacks/xacro/src/", line 457, in eval_all eval_all(body, macros, scoped) File "/opt/ros/groovy/stacks/xacro/src/", line 488, in eval_all result = eval_text(at[1], symbols) File "/opt/ros/groovy/stacks/xacro/src/", line ...(more)

Lili Meng gravatar image Lili Meng  ( 2013-11-30 10:19:17 -0500 )edit

The new xacro is a catkin package, and does not use rosbuild. I suspect you are seeing this error because it never built properly, and you are still using the system groovy version of xacro. See

piyushk gravatar image piyushk  ( 2013-11-30 13:13:15 -0500 )edit

answered 2013-10-17 07:37:12 -0500

Hi Gazer,

   I have the same problem with you. I typed:  rosrun xacro segbot_base.urdf.xacro > segbot_base.urdf  in the terminal. It indeed generated an urdf file, but it's empty inside of this urdf file.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2013-05-13 12:29:13 -0500

Seen: 1,858 times

Last updated: Oct 17 '13