xacro property names not recognised by roslaunch
Operating System: Ubuntu 18.04 LTS
ROS version: Melodic
I've been trying to implement xacro into a very simple robot to help tidy up and future-proof it, however when I use roslaunch to load the file into rviz it gives me the following error:
Unable to parse component [${wb_w}] to a double (while parsing a vector value)
Ive tried launching the file with the following commands with the same results:
roslaunch omni_description display.launch model:='$(find omni_description)/urdf/omni.urdf.xacro'
roslaunch omni_description display.launch model:='$(find omni_description)/urdf/omni.urdf'
The code in question is shown below (Only the sections where xacro has been implemented are shown as i have only tried it on one link so far, let me know if you need the rest.)
<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="omni">
<xacro:property name="wb_w" value="0.18"/>
<xacro:property name="wb_h" value="0.005"/>
<xacro:property name="wb_d" value="0.18"/>
<xacro:property name="wb_m" value="0.23"/>
<xacro:property name="w_r" value="0.18"/>
<xacro:property name="w_l" value="0.18"/>
<xacro:property name="w_m" value="0.60"/>
<xacro:property name="b_r" value="0.024"/>
<xacro:property name="b_m" value="0.60"/>
<xacro:macro name="wb_inertial" params="mass depth width height">
<inertial>
<mass value="${mass}"/>
<inertia
ixx="${(1/12)*mass*(width+height)}"
ixy="0.0"
ixz="0.0"
iyy="${(1/12)*mass*(depth+height)}"
iyz="0.0"
izz="${(1/12)*mass*(width+depth)}" />
</inertial>
</xacro:macro>
<link name = "wheel_base">
<visual>
<geometry>
<box size = "${wb_w} ${wb_d} ${wb_h}"/>
</geometry>
</visual>
<collision>
<geometry>
<box size = "${wb_w} ${wb_d} ${wb_h}"/>
</geometry>
</collision>
<xacro:wb_inertial mass="${wb_m}" depth="${wb_d*wb_d}" width="${wb_w*wb_w}" height="${wb_h*wb_h}"/>
</link>
EDIT 1:
The typos have been fixed and the same error has presented itself, when running via roslaunch the same error message is returned:
Unable to parse component [${wb_w}] to a double (while parsing a vector value)
EDIT 2
I have included the launch file below:
<launch>
<arg name="gui" default="true" />
<param name="robot_description" textfile="$(find omni_description)/urdf/omni.urdf" />
<param name="use_gui" value="$(arg gui)"/>
<node name="joint_state_publisher" pkg="joint_state_publisher" type="joint_state_publisher" />
<node name="robot_state_publisher" pkg="robot_state_publisher" type="state_publisher" />
<node name="rviz" pkg="rviz" type="rviz" args="-d $(find omni_description)/urdf.rviz" required="true" />
</launch>
EDIT 3
I have checked the file using check_urdf and recieved a slightly more detailed error:
Error: Unable to parse component [${wb_w}] to a double (while parsing a vector value)
at line 157 in /build/urdfdom-ACOcA8/urdfdom-1.0.0/urdf_parser/src/link.cpp
I see a typo in
<xacro:wb_inertial mass="${wb_m}" depth="${wb_d*wb_d}" width="${wb_w*wb*w}" height="${wb_h*wb_h}"/>
in width. Correct that and see if it works, because rest seems fine.@Choco93 Im struggling to see the typo in that tag, could you point it out?
width="${wb_w*wb*w}"
should bewidth="${wb_w*wb_w}"
@Choco93 Thanks, I can't believe I missed that, I'll fix the typo and see what that does.
@Choco93 I've fixed the typo but it has not solved the error.
That's indeed stange but that shouldn't prevent your launch file from running without errors (I mean the node not crashing) since when converting from
xacro
tourdf
the parsing is correctly done (at leat when i tried and I've the same error usingcheck_urdf
).Can you show your launch file ?
I had similar issue, but I was parsing through yaml and it has some restrictions there, but your xacro seems fine to me.