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

Thang Nguyen gravatar image

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

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 -0500 )edit

I will try and let you know.

Thang Nguyen gravatar image Thang Nguyen  ( 2016-11-09 09:35:31 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )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 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
3

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

Inounx gravatar image

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

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

Seen: 7,655 times

Last updated: Jan 05 '18