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

how to convert xacro file to urdf file?

asked 2011-06-27 01:34:33 -0500

mhossameldin gravatar image

i wanna know the command used to convert xacro file to pure urdf file ,

Thanks for ur help

edit retag flag offensive close merge delete

Comments

1

Hi. How to do the same with ROS2?

dds gravatar image dds  ( 2020-07-27 11:08:52 -0500 )edit
2

In case somebody need it:

ros2 run xacro xacro -o robot.urdf robot.urdf.xacro

robot.urdf is the output file and robot.urdf.xacro is the file you want to convert

Youssef_Lah gravatar image Youssef_Lah  ( 2021-05-18 22:30:45 -0500 )edit

5 Answers

Sort by ยป oldest newest most voted
17

answered 2014-10-09 14:54:22 -0500

fivef gravatar image

updated 2017-03-20 11:03:45 -0500

VictorLamoine gravatar image

Better use the command as intendet:

rosrun xacro xacro --inorder -o model.urdf model.urdf.xacro

A proper xml will be generated with a banner saying that the file was auto generated and should not be edited.

edit flag offensive delete link more

Comments

Could you please provide an example? This is not very clear to me!

Mr.7th gravatar image Mr.7th  ( 2019-11-14 05:47:53 -0500 )edit
23

answered 2011-06-27 01:45:08 -0500

rosrun xacro xacro.py model.xacro > model.urdf
edit flag offensive delete link more
5

answered 2017-07-03 04:29:13 -0500

In the most recent versions, xacro.py is deprecated, so something like the following works:

rosrun xacro xacro --inorder model.urdf.xacro > model.urdf
edit flag offensive delete link more
2

answered 2021-07-12 04:50:37 -0500

pmuthu2s gravatar image

For Noetic:

rosrun xacro xacro model.xacro > model.urdf

edit flag offensive delete link more
0

answered 2011-06-28 20:50:39 -0500

amix gravatar image

Hello,

I tried this command but nothing happened. A file is created on the same directories.

rosrun xacro xacro.py arm.urdf.xacro > arm.urdf

is their something wrong with this command

edit flag offensive delete link more

Comments

1
there is nothing wrong with your command. If arm.urdf.xacro contains the xacro macros, arm.urdf should have the corresponding expanded xml's. If you have more detailed question, please post arm.urdf.xacro and the resulting arm.urdf.
hsu gravatar image hsu  ( 2011-06-29 05:45:47 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2011-06-27 01:34:33 -0500

Seen: 46,708 times

Last updated: Jul 12 '21