XACRO

Xacro generates robot descriptions; it is not the final robot model consumed by most tools.

Xacro adds reusable macros, properties, includes, arguments and conditional generation to XML robot-description workflows. In common ROS usage, Xacro source is expanded into URDF before downstream tools consume the model.

MATURITYREFERENCE EXPLAINER
LAST VERIFIED16 Oct 2026
SOURCE VERSIONCurrent ROS 2 / xacro documentation
EVIDENCE BOUNDARYXacro is a preprocessing and macro layer commonly used to generate URDF; downstream tools generally consume the expanded robot description.

WHY XACRO

Large descriptions need reuse and parameterization.

01

Properties

Reuse constants instead of repeating values throughout the model.

02

Macros

Generate repeated links, joints, sensors and subsystems from templates.

03

Includes

Compose a robot from files owned by different packages or subsystems.

04

Arguments

Generate variants from explicit inputs such as prefixes, grippers or simulation mode.

05

Conditions

Include or omit portions of the generated model based on configuration.

06

Expressions

Calculate values during generation instead of hand-authoring every derivative.

PIPELINE

A Xacro file is source code for a description build.

01Xacro source→
02Macros + includes + args→
03Expansion→
04URDF XML→
05ROS / simulator / importer

For provenance, keep both the inputs and the expanded artifact. Includes, arguments and conditions can change the final robot description, so counts or claims extracted from raw Xacro are not automatically claims about the generated URDF.

OPENRGD

Expand first, then import the artifact that was actually consumed.

The canonical OpenRGD importer consumes URDF evidence, not the Xacro macro language itself. A reproducible pipeline records Xacro source and parameters, expands it deterministically, then imports the resulting URDF while keeping the generation provenance.

PRIMARY SOURCES