Robotics StackExchange | Archived questions

Error with xacro.py [robot_description]

Hi, I am trying to get through a tutorial "Building a Visual Robot Model with URDF from Scratch". I got a problem like this:

Invalid <param> tag: Cannot load command parameter [robot_description]: command [/opt/ros/indigo/share/xacro/xacro.py urdf/01-myfirst.urdf] returned with code [1]. 

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

everytime if I want to launch urdf file like this:

roslaunch urdf_tutorial display.launch model:=urdf/01-myfirst.urdf

I have checked the xacro.py file (at least I think so) and this is what i get:

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/indigo/share/xacro/xacro.py", line 62, in <module>
    xacro.main()
  File "/opt/ros/indigo/lib/python2.7/dist-packages/xacro/__init__.py", line 676, in main
    doc = parse(f)
  File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, 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: not well-formed (invalid token): line 1, column 1

Could anyone help me? I would be very grateful.

Asked by Cayero on 2016-11-15 15:43:05 UTC

Comments

Oh, I used to get similar errors. Please, check this (link). Maybe it is helpful.

Asked by Abdul Mannan on 2016-11-16 00:03:05 UTC

What is on "line 1, column 1" in 01-myfirst.urdf?

Asked by gvdhoorn on 2016-11-16 04:58:45 UTC

This is on line 1 in that file.

<?xml version="1.0"?>

Without quotation marks and spaces

Asked by Cayero on 2016-11-16 17:11:57 UTC

If you can make the urdf available somewhere (Github gist, somewhere else) we can take a look. Could be an encoding issue or something else.

Just to get it out of the way: the current working directory when you roslaunch .. is the urdf_tutorial package, right?

Asked by gvdhoorn on 2016-11-17 03:02:58 UTC

I took the urdf file from this github https://github.com/ros/urdf_tutorial/tree/master/urdf

Yes that's right.

Asked by Cayero on 2016-11-17 14:54:50 UTC

And how exactly did you download it? git clone .. or some other way?

Asked by gvdhoorn on 2016-11-17 15:51:33 UTC

I just created urdf file and then copied the code

Asked by Cayero on 2016-11-19 10:36:51 UTC

Did you include the line numbers? Or did you copy the raw file?

Asked by gvdhoorn on 2016-11-19 10:59:22 UTC

No I didn't. Just copied that xml code to my file

Asked by Cayero on 2016-11-19 14:37:21 UTC

Well, without seeing the actual file that you have I'm afraid I can't help you. Could you either add it to your question (use the edit button/link) or use something like Github gist / pastebin.

Asked by gvdhoorn on 2016-11-20 02:02:17 UTC

Answers

I think that the launch file should be launched on the urdf_tutorial directory.

Asked by MOYMOY on 2019-06-27 01:32:53 UTC

Comments

It worked. Thank you.

Asked by iceberg on 2022-06-17 00:03:55 UTC