Robotics StackExchange | Archived questions

Gazebo: Invalid <param> tag: Cannot load command parameter [robot_description]:

Hi.

I'm using Ubuntu 14.04 ROS Indigo Gazebo2

I am quite new to ROS and Gazebo and I'm following this Tutorial link:here.

I did everything like in the tutorial, nut when I want to use roslaunch to launch my launchfile I get the following error:

 Invalid <param> tag: Cannot load command parameter [robot_description]: command [/opt/ros/indigo/share/xacro/xacro.py 
 /home/myuser/catkin_ws/src/mybot_description/urdf/mybot.xacro] returned with code [1]. 

 Param xml is <param command="$(find xacro)/xacro.py $(find mybot_description)/urdf/mybot.xacro"   name="robot_description"/>
 The traceback for the exception was written to the log file

When I enter

rosrun xacro xacro.py /home/myuser/catkin_ws/src/mybot_description/urdf/mybot.xacro 

I get

Traceback (most recent call last):
  File "/opt/ros/indigo/share/xacro/xacro.py", line 62, in <module>
    xacro.main()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/xacro/__init__.py", line 687, in main
    process_includes(doc, os.path.dirname(args[0]))
  File "/opt/ros/indigo/lib/python2.7/dist-packages/xacro/__init__.py", line 269, in process_includes
    % (filename, str(e)))
xacro.XacroException: included file "/home/myuser/catkin_ws/src/mybot_description/urdf/macros.xacro" generated an error during XML parsing: unbound prefix: line 2, column 0

My macro file looks like this

<xacro:macro name="box_inertia" params="m x y z">
  <inertia  ixx="${m*(y*y+z*z)/12}" ixy = "0" ixz = "0"
    iyy="${m*(x*x+z*z)/12}" iyz = "0"
    izz="${m*(x*x+z*z)/12}"
  />
 </xacro:macro>

And my mybot.xacro looks like this:

<?xml version="1.0"?>

<robot name="mybot" xmlns:xacro="http://www.ros.org/wiki/xacro">
    <!-- Put here the robot description -->

<xacro:property name="PI" value="3.1415926535897931"/>

<xacro:property name="chassisHeight" value="0.1"/>
<xacro:property name="chassisLength" value="0.4"/>
<xacro:property name="chassisWidth" value="0.2"/>
<xacro:property name="chassisMass" value="50"/>

<xacro:property name="casterRadius" value="0.05"/>
<xacro:property name="casterMass" value="5"/>

<xacro:property name="wheelWidth" value="0.05"/>
<xacro:property name="wheelRadius" value="0.1"/>
<xacro:property name="wheelPos" value="0.2"/>
<xacro:property name="wheelMass" value="5"/>

<xacro:property name="cameraSize" value="0.05"/>
<xacro:property name="cameraMass" value="0.1"/>                             


 <xacro:include filename="$(find mybot_description)/urdf/mybot.gazebo" />
 <xacro:include filename="$(find mybot_description)/urdf/materials.xacro" />
 <xacro:include filename="$(find mybot_description)/urdf/macros.xacro" />


    <link name="footprint" />

<joint name="base_joint" type="fixed">
  <parent link="footprint"/>
  <child link="chassis"/>
</joint>



    <link name='chassis'>
  <collision> 
    <origin xyz="0 0 ${wheelRadius}" rpy="0 0 0"/> 
    <geometry> 
      <box size="${chassisLength} ${chassisWidth} ${chassisHeight}"/> 
    </geometry> 
  </collision>
  <visual> 
    <origin xyz="0 0 ${wheelRadius}" rpy="0 0 0"/> 
    <geometry> 
      <box size="${chassisLength} ${chassisWidth} ${chassisHeight}"/> 
    </geometry> 
    <material name="orange"/>
  </visual>
  <inertial> 
    <origin xyz="0 0 ${wheelRadius}" rpy="0 0 0"/> 
    <mass value="${chassisMass}"/> 
    <box_inertia m="${chassisMass}" x="${chassisLength}" y="${chassisWidth}" z="${chassisHeight}"/>
  </inertial>
</link>



</robot>

Thanks for your help!

Asked by nikku on 2016-11-10 14:41:18 UTC

Comments

It looks like there is something wrong with your macros.xacro file. Can you edit your question and add the relevant xacro files (at least macros.xacro and mybot.xacro)?

Asked by jarvisschultz on 2016-11-10 14:58:30 UTC

I edited my comment

Asked by nikku on 2016-11-10 15:02:17 UTC

Cool... in the future, please use the code button (the 101010 button) to put snippets in code blocks

Asked by jarvisschultz on 2016-11-10 15:20:58 UTC

Answers

I believe the issue is that your macros.xacro file doesn't have a tag as the root element. So something like

<robot name="mybot_macros" xmlns:xacro="http://www.ros.org/wiki/xacro">
  <xacro:macro name="box_inertia" params="m x y z">
    <inertia  ixx="${m*(y*y+z*z)/12}" ixy="0" ixz="0"
              iyy="${m*(x*x+z*z)/12}" iyz="0"
              izz="${m*(x*x+z*z)/12}"/>
  </xacro:macro>
</robot>

should fix the issue.

Asked by jarvisschultz on 2016-11-10 15:36:44 UTC

Comments

Thanks a lot. Fixed it and I cant launch my world now. :D :D

Asked by nikku on 2016-11-10 15:41:27 UTC