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

Need help with find error in this urdf

asked 2016-11-09 01:08:29 -0600

Thang Nguyen gravatar image

updated 2016-11-10 00:09:42 -0600

Hi, I am learning the tutorial about urdf. I am at the exercise 8 now. The error I have when run the launch file is:

[ERROR] [1478674779.727709696]: length [${bodylen}] is not a valid float
[ERROR] [1478674779.727814955]: Could not parse visual element for Link [base_link]
[ERROR] [1478674779.727917245]: radius [${width}] is not a valid float: bad lexical cast: source type value could not be interpreted as target
[ERROR] [1478674779.727969693]: Could not parse visual element for Link [head]

.....

I will include here to the code from start to base_link. Please help me point out the issue. I cannot find out what is wrong.

   <?xml version="1.0"?>
    <robot name="macroed" xmlns:xacro="http://ros.org/wiki/xacro">
    <!-- Convert to xacro-->
    <robot xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
              xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
              xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
              xmlns:xacro="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface" name="macroed">

        ...

Edit 1: I found the problem. I missed the 4 rows below the link but I got a new error and I don't understand what it is:

...
process[rviz-4]: started with pid [7571]
[ERROR] [1478753950.661833770]: Error reading end tag.
[robot_state_publisher-3] process has died [pid 7563, exit code -11, cmd /opt/ros/indigo/lib/robot_state_publisher/state_publisher __name:=robot_state_publisher __log:=/home/ubuntu/.ros/log/6a4eafd8-a702-11e6-98d1-00044b581868/robot_state_publisher-3.log].
log file: /home/ubuntu/.ros/log/6a4eafd8-a702-11e6-98d1-00044b581868/robot_state_publisher-3*.log
Traceback (most recent call last):
  File "/opt/ros/indigo/lib/joint_state_publisher/joint_state_publisher", line 343, in <module>
    jsp = JointStatePublisher()
  File "/opt/ros/indigo/lib/joint_state_publisher/joint_state_publisher", line 26, in __init__
    robot = xml.dom.minidom.parseString(description).getElementsByTagName('robot')[0]
  File "/usr/lib/python2.7/xml/dom/minidom.py", line 1928, in parseString
    return expatbuilder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 940, in parseString
    return builder.parseString(string)
  File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 223, in parseString
    parser.Parse(string, True)
xml.parsers.expat.ExpatError: no element found: line 239, column 0
[joint_state_publisher-2] process has died [pid 7555, exit code 1, cmd /opt/ros/indigo/lib/joint_state_publisher/joint_state_publisher __name:=joint_state_publisher __log:=/home/ubuntu/.ros/log/6a4eafd8-a702-11e6-98d1-00044b581868/joint_state_publisher-2.log].
log file: /home/ubuntu/.ros/log/6a4eafd8-a702-11e6-98d1-00044b581868/joint_state_publisher-2*.log
[ERROR] [1478753953.368324386]: No link elements found in urdf file

Edit 2: Full urdf xacro.

<?xml version="1.0"?>
<robot name="macroed" xmlns:xacro="http://ros.org/wiki/xacro">
<robot xmlns:sensor="http://playerstage.sourceforge.net/gazebo/xmlschema/#sensor"
xmlns:controller="http://playerstage.sourceforge.net/gazebo/xmlschema/#controller"
xmlns:interface="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface"
xmlns:xacro="http://playerstage.sourceforge.net/gazebo/xmlschema/#interface" name="macroed">
<!-- Convert to xacro-->

    <xacro:property name="width" value="0.2" /> 
    <xacro:property name="leglen" value="0.6" />
    <xacro:property name="polelen" value="0.2" />
    <xacro:property name="bodylen" value="0.6" />
    <xacro:property name="baselen" value="0.4" />
    <xacro:property name="wheeldiam" value="0.07" />
    <xacro:property name="pi" value="3.1415" />

    <material name="blue">
        <color rgba="0 0 0.8 ...
(more)
edit retag flag offensive close merge delete

Comments

I'm not quite sure, but I don't think that this substitution stuff actualy works with floats without leading 0. Can you try with adding this?

mgruhler gravatar image mgruhler  ( 2016-11-09 02:02:46 -0600 )edit

I will try and let you know.

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-09 09:35:31 -0600 )edit

I found the issue. I missed the 4 lines after . But then I got the new error and I cannot understand what it is. I added Edit 1.

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-09 23:09:21 -0600 )edit

Perhaps it would help if you post the full urdf, the tutorial you are using and how you fixed the previous error. From the error you are getting now I would suspect some of the tags are not being closed properly.

rbbg gravatar image rbbg  ( 2016-11-09 23:39:34 -0600 )edit

I have just added the full Urdf file. This is come from tutorial ex8 Using Xacro to Clean Up a URDF File

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-10 00:07:50 -0600 )edit

The problem is the error didn't tell where it found the problem. With a long urdf file, I have no idea how to find the issue.

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-10 00:10:45 -0600 )edit
1

You can use gzsdf to help debug your urdf file see here Gazebo ROS urdf, "Verifying the Gazebo Model Works"

You need gazebo installed, and then : gzsdf print MODEL.urdf (gazebo2) or gz sdf -p MODEL.urdf (Gazebo 3+)

Inounx gravatar image Inounx  ( 2016-11-10 04:08:26 -0600 )edit

@Inounx: Does it check xacro macro? Or I have to convert to urdf first?

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-10 17:57:52 -0600 )edit

Yes, you will need to convert to urdf your files (and this is maybe a part of your problem: I think you cannot use a raw xacro urdf, you have to convert to urdf first) try this : rosrun xacro xacro.py -o model_out.urdf model_in.urdf.xacro And then run gzsdf.

Inounx gravatar image Inounx  ( 2016-11-11 04:27:43 -0600 )edit

@Inounx: I tried with rosrun xacro xacro 08-macroed.urdf.xacro > 08-macroed.urdf then using check_urdf 08-macroed.urdf and got a good result. This makes me confused. Do you think gazebo gzsdf will return better result? I am trying to install gazebo but I have error.

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-11 06:26:53 -0600 )edit

I don't know, I have never used check_urdf. Did you try to use the file 08-macroed.urdf (output of rosrun xacro xacro...) where before you had an error ?

Inounx gravatar image Inounx  ( 2016-11-11 10:35:02 -0600 )edit

I have not tried to use 08-macroed.urdf since I want to use the xacro instead. Maybe I should try it. Since I cannot install full package, I have to install gazebo separately. I am using Ubuntu 14.04 with Indigo. What version of Gazebo should I install?

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-11 10:59:46 -0600 )edit

AFAIK you need to convert your xacro to urdf in order to be able to use it. Xacro is just a way to clean your urdf. See here: Using Xacro to clean urdf file, first paragraph. Test your converted urdf if it's ok

Inounx gravatar image Inounx  ( 2016-11-11 13:28:29 -0600 )edit

If you convert your xacro when you load it into a ROS param in your launch file like they say, your urdf model will always be up to date, and when you will modify the xacro, the modifications will be applied on next launch.

Inounx gravatar image Inounx  ( 2016-11-11 13:32:53 -0600 )edit

lnounx: Thanks lnounx, I ddin't read it carefully. Thanks for your help. If you change this to answer, I will mark this as answer.

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-11 14:02:09 -0600 )edit

Could you please tell me about the xacro version to install to?

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-11 14:02:38 -0600 )edit

You're welcome ;). I don't understand why you ask this, the version you have is not ok ?

Inounx gravatar image Inounx  ( 2016-11-12 04:16:37 -0600 )edit

I installed base package so there is no gazebo in it.

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-12 22:36:35 -0600 )edit

I have the same environment than yours (Ubuntu 14.04 / ROS Indigo) and to install Gazebo, I just installed the version provided with ROS. I currently have ros-indigo-gazebo-msgs ros-indigo-gazebo-plugins ros-indigo-gazebo-ros ros-indigo-gazebo-ros-control ros-indigo-gazebo-ros-pkgs installed.

Inounx gravatar image Inounx  ( 2016-11-14 03:26:34 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2016-11-12 04:12:23 -0600

Inounx gravatar image

updated 2018-01-05 19:13:50 -0600

130s gravatar image

How to check your Xacro / urdf model

To be able to check your model, you have to convert your xacro file to plain urdf:

rosrun xacro xacro.py -o model_out.urdf model_in.urdf.xacro

Then you can use:

How to use your Xacro model

To use your xacro model, you have to convert it first to plain urdf. The best way is to convert it at the time you load you model into a ros parameter, so your urdf model will always be up to date, as any modifications on the xacro will be applied on next launch.

See here: Using Xacro to clean urdf file, first paragraph.

edit flag offensive delete link more

Question Tools

3 followers

Stats

Asked: 2016-11-09 01:08:29 -0600

Seen: 7,912 times

Last updated: Jan 05 '18