Ask Your Question
7

Using XACRO for Generating URDF Files

asked 2011-02-14 15:32:09 -0600

mjcarroll gravatar image

updated 2011-02-14 16:02:41 -0600

tfoote gravatar image

Generally, at what point does a project become large enough to justify the added time of writing a .xacro file (xml macro for generating URDF files) versus just using a hand-written URDF file?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
14

answered 2011-02-14 16:56:17 -0600

David Lu gravatar image

Writing a xacro file is more about making creating a maintainable file than an efficient one. The only ROS package (AFAIK) that reads xacro files is xacro, which converts them to macroless URDF. So you don't gain anything computationally from making a xacro. In fact, you lose some small bit of efficiency by dynamically generating from a xacro.

However, what you gain is maintainability. By creating macros and constants, you make it easier to edit and add to an existing model. If you're done creating your model, and are confident it won't change, then there's probably no need. Otherwise, you'll probably end up saving time in the long run if you create a xacro.

edit flag offensive delete link more
5

answered 2011-02-16 06:58:07 -0600

hsu gravatar image

Another motivation of xacro was to save us from retyping repeated URDF blocks. For example the PR2 caster xacro is defined once and referred to 4 times.

Also, if you find yourself working with subcomponents of a robot a lot, having xacro modules means not having to copy and paste the particular component you are working with from the master URDF file into your own project. Plus, by referring to xacros instead of copy/pasting URDF blocks, any updates to the master URDF is automatically reflected in your project.

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

Stats

Asked: 2011-02-14 15:32:09 -0600

Seen: 1,374 times

Last updated: Feb 16 '11