Ask Your Question
0

urdl and xacro files

asked 2020-04-24 14:07:39 -0500

jean01 gravatar image

Hello everyone

I have both quadrotor_base.urdf and quadrotor_base.urdf.xacro files in my directory. If I make any change in quadrotor_base.urdf.xacro file and save it, would it be enough? does the xacro file create a new urdf with the same name automatically or should I make anything else when I change a xacro file? As far as I know, urdf files can not be changed directly and we need to change the xacro file first.

Thank you very much for your help

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-04-25 07:24:33 -0500

gvdhoorn gravatar image

does the xacro file create a new urdf with the same name automatically or should I make anything else when I change a xacro file?

No, a .xacro file is just that: a file. It is not an active entity by itself. So it will not create any other files, or update other files.

If you want to keep the two "in sync" (ie: ensure that changes in the former appear in the latter), you'll have to convert the .xacro file to a .urdf. You can do that with the following command (after having sourced the appropriate setup.bash file):

xacro input.xacro > output.urdf

This would process the directives in the .xacro command, evaluate them and output corresponding URDF elements. That output is finally redirected into a file.

As far as I know, urdf files can not be changed directly and we need to change the xacro file first.

This is not quite true. You can edit .urdf files just as you can edit .xacros. It's all plain text.

What you may have read somewhere is that it would be advisable to never edit a .urdf which was generated by a call to xacro (ie: the tool I referenced earlier), as that would make managing the two files more difficult: if you ever run xacro input.xacro > output.urdf again, any changes you'd made to output.urdf but which are not part of input.xacro would be overwritten (ie: lost).

So in general, if there is a .xacro, it'd be better to edit the .xacro instead of the generated .urdf.

edit flag offensive delete link more

Comments

Thank you for the answer, conversion from xacro to urdf works

jean01 gravatar image jean01  ( 2020-04-25 11:51:14 -0500 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-04-24 14:07:39 -0500

Seen: 19 times

Last updated: Apr 25