Rosanswers logo

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/xacro.py '/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 xacro.py /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="http://www.ros.org/wiki/xacro"

Traceback (most recent call last):
  File "/opt/ros/groovy/stacks/xacro/xacro.py", line 35, in <module>
  File "/opt/ros/groovy/stacks/xacro/src/xacro.py", line 542, in main
    doc = parse(f)
  File "/usr/lib/python2.7/xml/dom/minidom.py", line 1920, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 928, in parse
    result = builder.parseFile(file)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", 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!

Originally posted by saina110 on ROS Answers with karma: 107 on 2014-01-24

Post score: 10


2 Answers 2


Rosanswers logo

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 xacro.py /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).

Originally posted by Martin Günther with karma: 11816 on 2014-01-24

This answer was ACCEPTED on the original site

Post score: 9

Original comments

Comment by saina110 on 2014-01-25:
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 it......how can I edit my xacro file?

Comment by Martin Günther on 2014-01-26:\

  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.

Comment by saina110 on 2014-01-27:
thanks so much, I think I solved this problem, cause I didn't split my file into 3 parts...thanks again

Comment by Tahir Miriyev on 2017-08-06:
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.


Rosanswers logo

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        ...

Originally posted by Ahmet Tıkna with karma: 31 on 2021-01-29

This answer was NOT ACCEPTED on the original site

Post score: 3

Original comments

Comment by ddudas on 2021-02-25:
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)" />

Comment by osilva on 2021-11-25:
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)" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.