No link elements found in urdf file
Hello. I am struggling with getting simple xacro macros to work. I have checked the other answers on this question but I can't get it to work. I'm using ROS1 Noetic distribution. My issue occurs when I try to create a link using a macro in a Xacro file, upon launching rviz I get the error: 'no link elements found in urdf file'. I have tried launching the same file without the macro and the link is made in rviz. Below is the code.
<?xml version="1.0" encoding="utf-8"?>
<robot name = quadruped xmlns:xacro="http://www.ros.org/wiki/xacro">
<xacro:macro name = "link_shoulder" params= "name">
<link name="caster_${name}">
</link>
</xacro:macro>
<xacro:link_shoulder name="asd">
</xacro:link_shoulder>
</robot>
Again if I remove the macro and simply use:
<?xml version="1.0" encoding="utf-8"?>
<robot name = quadruped xmlns:xacro="http://www.ros.org/wiki/xacro">
<link name="some_name">
</link>
</robot>
It works just fine. The launch file I'm using is:
<launch>
<arg
name="model" />
<param
name="robot_description"
textfile="$(find urdf_dummy)/urdf/base_link.xacro" />
<node
name="joint_state_publisher_gui"
pkg="joint_state_publisher_gui"
type="joint_state_publisher_gui" />
<node
name="robot_state_publisher"
pkg="robot_state_publisher"
type="robot_state_publisher" />
<node
name="rviz"
pkg="rviz"
type="rviz"
/>
</launch>