Features of Xacro
Xacro is the XML macro language for ROS. Xacro provides a set of macro operations to replace some repetitive statements with shorter, concise macros that will expand into full XML statements when processed. Xacro can be used with any XML document, but is most useful with long, complex URDF files. Xacro allows you to create shorter and more readable XML files for the robot URDF. Xacro provides advantages in many different areas:
- Property and property blocks: If repeated information is used in a URDF/SDF file, the
<property>
tag can be used to specify these constant values in a central location. These are typically parameters that can be changed later. Properties are usually identified at the beginning of the file, but they can be found anywhere in the XML file at any level. It does not matter whether the property declaration is before or after its use.Here is an example of how to implement a property:
- Define as
<xacro:property name="my_name" value ="...
- Define as