0
$\begingroup$

Rosanswers logo

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?


Originally posted by mjcarroll on ROS Answers with karma: 6414 on 2011-02-14

Post score: 7

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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.


Originally posted by David Lu with karma: 10932 on 2011-02-14

This answer was ACCEPTED on the original site

Post score: 15

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by hsu with karma: 5780 on 2011-02-16

This answer was NOT ACCEPTED on the original site

Post score: 5

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.