# XACRO Macro Noetic not working

Hi, I'm facing issues with xacro macros in ROS noetic. I have the following robot description (or a simplified version) containing one xacro macro. After the definition of the macro it is called by <robot_macro/>

Normally i have this macro defined in an other file and include it in a main xacro file, where i include a lot of macros and then build up the robot using those macros.

<?xml version="1.0"?>
<robot name="robot1" xmlns:xacro="http://ros.org/wiki/xacro">
<xacro:macro name="robot_macro">
<inertial>
<origin xyz="0.40 0 0.02" rpy="0 0 0" />
<mass value="2" />
<inertia ixx="0.003" ixy="0" ixz="0" iyy="0.09" iyz="0" izz="0.09" />
</inertial>
<visual>
<origin xyz="0 0 0" rpy="0 0 0" />
<geometry>
</geometry>
<material name="white">
<color rgba="1 1 1 1"/>
</material>
</visual>
<collision>
<origin xyz="0.4 0 0.02" rpy="0 0 0" />
<geometry>
</geometry>
</collision>
<joint name="beam_joint" type="fixed">
<origin xyz="0 0 0" rpy="0 0 0" />
<axis xyz="0 0 0" />
</joint>
</xacro:macro>
<robot_macro/>
</robot>


If i load the robot description in Gazebo, i get the error message No link elements found in urdf. At first i thought it could be that the mesh files can not be found. So i decided to switch to a simple conversion from xacro to urdf for debugging my problem. But if i convert this xacro file to a urdf file using rosrun xacro xacro -o model.urdf model.xacro the resulting urdf contains no links and joint:

<?xml version="1.0" ?>
<!-- =================================================================================== -->
<!-- |    This document was autogenerated by xacro from mira3d.xacro                   | -->
<!-- |    EDITING THIS FILE BY HAND IS NOT RECOMMENDED                                 | -->
<!-- =================================================================================== -->
<robot name="robot1">
<robot_macro/>
</robot>


If i remove the two xacro macro lines around the links and joint (and the call of the macro), its working as expected. I am pretty sure, i used the xacro description like it is in Kinetic and Melodic before and had no problems with it. I also think the macro looks like the example on http://wiki.ros.org/urdf/Tutorials/Us...

Can you see any issue with it or is there any change in xacro macros in noetic?

edit retag close merge delete

Sort by » oldest newest most voted
<robot [..]>
[..]
<robot_macro/>
</robot>


I don't believe this is supposed to work like this.

Shouldn't it be at least:

<robot [..]>
[..]
<xacro:robot_macro/>
</robot>

more

This must have changed in Noetic. In Melodic, I had macros that worked without the xacro namespace, but I needed to add them when I went to Noetic.

( 2021-02-28 23:48:48 -0500 )edit

Actually, this has been deprecated since at least Jade. See wiki/xacro - Deprecated Syntax.

And ros/xacro#79. That's from 2015.

( 2021-03-01 02:27:17 -0500 )edit