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

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

asked 2014-01-24 04:02:54 -0600

saina110 gravatar image

updated 2014-04-20 14:09:35 -0600

ngrennan gravatar image

Just like the topic I posed, when I try to use roslaunch command to run in the terminal, I met this problem (as followed):

Invalid <param> tag: Cannot load command parameter [robot_description]: command [/opt/ros/groovy/stacks/xacro/ '/home/viki/ros_workspace/smartcar_description/urdf/smartcar.urdf.xacro'] returned with code [1]. 

Param xml is <param command="$(arg urdf_file)" name="robot_description"/>

I have no idea how to solve this problem, I sincerely you could give the instructions about how to solve this problem.

Thanks so much for your time.

when I run the code rosrun xacro /home/viki/ros_workspace/smartcar_description/urdf/smartcar.urdf.xacro to check the xacro, there is the information showed as followed:

Expat parsing error.  Check that:
 - Your XML is correctly formed
 - You have the xacro xmlns declaration: xmlns:xacro=""

Traceback (most recent call last):
  File "/opt/ros/groovy/stacks/xacro/", line 35, in <module>
  File "/opt/ros/groovy/stacks/xacro/src/", line 542, in main
    doc = parse(f)
  File "/usr/lib/python2.7/xml/dom/", line 1920, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python2.7/xml/dom/", line 928, in parse
    result = builder.parseFile(file)
  File "/usr/lib/python2.7/xml/dom/", line 207, in parseFile
    parser.Parse(buffer, 0)
xml.parsers.expat.ExpatError: junk after document element: line 197, column 0

Can you give me some information about how to solve the problem?

Thanks so much!

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted

answered 2014-01-24 04:46:36 -0600

Your xacro file (smartcar.urdf.xacro) is invalid; just run the command that's mentioned above from the command line and look at the error messages in the output:

rosrun xacro /home/viki/ros_workspace/smartcar_description/urdf/smartcar.urdf.xacro

Once you've fixed your xacro file, everything should be fine.

If you can't find the bug, please update your question with a link to your xacro file (use the "edit" button).

edit flag offensive delete link more



when I use the command you recommended, it showed like above( I added in my question), but I don't quite know how to fix can I edit my xacro file?

saina110 gravatar image saina110  ( 2014-01-25 09:46:26 -0600 )edit

1. Open the file in a text editor. 2. Go to line 197 (as the error message said) and figure out why it's not valid XML. 3. If you want more help, upload that file somewhere.

Martin Günther gravatar image Martin Günther  ( 2014-01-26 21:10:44 -0600 )edit

thanks so much, I think I solved this problem, cause I didn't split my file into 3 parts...thanks again

saina110 gravatar image saina110  ( 2014-01-27 09:25:39 -0600 )edit

can you tell please what do you mean by "split my file into 3 parts"? because I have the same problem and don't know how to modify lines of codes where errors occured.

Tahir Miriyev gravatar image Tahir Miriyev  ( 2017-08-06 03:41:08 -0600 )edit

answered 2021-01-28 23:40:25 -0600

Ahmet Tıkna gravatar image

You might encounter such problems since you use a newer version of ROS. As far as I know, you should modify the launch file's relevant part as

<param name="robot_description" command="rosrun xacro xacro --inorder        ...
edit flag offensive delete link more



Great answer for Noetic users! --inroder is the default behavior since Melodic, so it looks even more simple (if your model comes from the arg):

<param name="robot_description" command="$(find xacro)/xacro $(arg model)" />
ddudas gravatar image ddudas  ( 2021-02-25 11:01:59 -0600 )edit

For Noetic users looks command is not working either, so alternatively load file using file path. For example:

  <arg name="model" default="$(find pcl_tester_description)/urdf/depth_camera.urdf.xacro"/>

  <param name="robot_description" textfile="$(arg model)" />
osilva gravatar image osilva  ( 2021-11-25 11:10:44 -0600 )edit

answered 2021-09-19 22:58:59 -0600

Just putting it here for future seekers. I encountered the same problem and no solutions worked, so I spent some time looking at my code and realized I missed xmlns:xacro="" in some of my xacro files. So check that too!

edit flag offensive delete link more

answered 2016-09-04 16:47:15 -0600

May be you need some packages. For example I have same error like you. But after installing turtlebot packages, this error is correct

edit flag offensive delete link more

Question Tools



Asked: 2014-01-24 04:02:54 -0600

Seen: 40,168 times

Last updated: Sep 04 '16