ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

xacro property names not recognised by roslaunch

asked 2019-10-06 10:56:19 -0600

GPPWalton gravatar image

updated 2019-10-08 05:19:05 -0600

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="" 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">
    <mass value="${mass}"/>
              izz="${(1/12)*mass*(width+depth)}" />

  <link name = "wheel_base">
        <box size = "${wb_w} ${wb_d} ${wb_h}"/>
        <box size = "${wb_w} ${wb_d} ${wb_h}"/>
    <xacro:wb_inertial mass="${wb_m}" depth="${wb_d*wb_d}" width="${wb_w*wb_w}" height="${wb_h*wb_h}"/>


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)


I have included the launch file below:


  <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" />



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
edit retag flag offensive close merge delete



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 gravatar image Choco93  ( 2019-10-07 04:56:35 -0600 )edit

@Choco93 Im struggling to see the typo in that tag, could you point it out?

GPPWalton gravatar image GPPWalton  ( 2019-10-07 10:10:48 -0600 )edit

width="${wb_w*wb*w}" should be width="${wb_w*wb_w}"

Choco93 gravatar image Choco93  ( 2019-10-08 02:09:04 -0600 )edit

@Choco93 Thanks, I can't believe I missed that, I'll fix the typo and see what that does.

GPPWalton gravatar image GPPWalton  ( 2019-10-08 03:07:20 -0600 )edit

@Choco93 I've fixed the typo but it has not solved the error.

GPPWalton gravatar image GPPWalton  ( 2019-10-08 03:16:17 -0600 )edit

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 to urdf the parsing is correctly done (at leat when i tried and I've the same error using check_urdf).

Delb gravatar image Delb  ( 2019-10-08 04:22:12 -0600 )edit

Can you show your launch file ?

Delb gravatar image Delb  ( 2019-10-08 04:36:08 -0600 )edit

I had similar issue, but I was parsing through yaml and it has some restrictions there, but your xacro seems fine to me.

Choco93 gravatar image Choco93  ( 2019-10-08 04:56:33 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-10-08 07:20:02 -0600

Delb gravatar image

updated 2019-10-08 07:20:38 -0600

Your error is due to how you load the parameter robot_description, you don't actually call xacro to parse the file when using this :

<param name="robot_description" textfile="$(find omni_description)/urdf/omni.urdf" />

What it should be is :

  <arg name="model" default="$(find omni_description)/urdf/omni.urdf.xacro"/>
  <param name="robot_description" command="$(find xacro)/xacro --inorder $(arg model)" />
edit flag offensive delete link more

Question Tools



Asked: 2019-10-06 10:56:19 -0600

Seen: 3,405 times

Last updated: Oct 08 '19