Need help with find error in this urdf
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 ...
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?
I will try and let you know.
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.
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.
I have just added the full Urdf file. This is come from tutorial ex8 Using Xacro to Clean Up a URDF File
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.
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) orgz sdf -p MODEL.urdf
(Gazebo 3+)@Inounx: Does it check xacro macro? Or I have to convert to urdf first?
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 rungzsdf
.@Inounx: I tried with
rosrun xacro xacro 08-macroed.urdf.xacro > 08-macroed.urdf
then usingcheck_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.I don't know, I have never used check_urdf. Did you try to use the file
08-macroed.urdf
(output ofrosrun xacro xacro...
) where before you had an error ?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?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
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.
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.
Could you please tell me about the xacro version to install to?
You're welcome ;). I don't understand why you ask this, the version you have is not ok ?
I installed base package so there is no gazebo in it.
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.