ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

# Problem with python parser URDF

Hi everyone,

I'm having some troubles extracting the information of a URDF file from the parameter server. In the launch file I load the robot in the parameter server with no problem or warning, in the usual way. The problem comes when I use the next instruction in my Python script:

self.urdf = URDF.from_parameter_server(key='robot_description')


Then in the terminal raises the following exception and the node dies:

[INFO] [WallTime: 1437558450.270437] [0.000000] Starting [jt_cartesian_controller] node
Material has neither a color nor textureMaterial has neither a color nor textureMaterial has neither a color nor textureMaterial has neither a color nor textureMaterial has neither a color nor textureMaterial has neither a color nor textureTraceback (most recent call last):
File "/home/joaquin/CERN/TFM_WS/src/youbot-phantom-omni/cartesian_controllers/scripts/jt_cartesian_controller.py", line 101, in <module>
jtc = JTCartesianController()
File "/home/joaquin/CERN/TFM_WS/src/youbot-phantom-omni/cartesian_controllers/scripts/jt_cartesian_controller.py", line 34, in __init__
self.urdf = URDF.from_parameter_server(key='robot_description')
File "/opt/ros/indigo/lib/python2.7/dist-packages/urdf_parser_py/urdf.py", line 450, in from_parameter_server
return cls.from_xml_string(rospy.get_param(key))
File "/opt/ros/indigo/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 486, in from_xml_string
return cls.from_xml(node)
File "/opt/ros/indigo/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 481, in from_xml
return cur_type.from_xml(node)
File "/opt/ros/indigo/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 171, in from_xml
File "/opt/ros/indigo/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 474, in read_xml
self.XML_REFL.set_from_xml(self, node)
File "/opt/ros/indigo/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 406, in set_from_xml
File "/opt/ros/indigo/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 312, in add_from_xml
value = self.value_type.from_xml(node)
File "/opt/ros/indigo/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 220, in from_xml
raise Exception(out)
Exception: Could not perform duck-typed parsing.
Value Type: <class 'urdf_parser_py.urdf.Transmission'>
Exception: Required element not set in XML: hardwareInterface

Value Type: <class 'urdf_parser_py.urdf.PR2Transmission'>
Exception: Required attribute not set in XML: type


I have checked the URDF file, and also the xacro files where transmission is defined. And everything seems to be correct. Which could be the problem with the parsing of the robot?

Note: I'm using Ubuntu 14.04.02 and ROS Indigo. The robot loaded is the Schunk LWA4P, whose package can be found in these repositories: schunk_robots schunk_modular_robotics

edit retag close merge delete

Sort by » oldest newest most voted

A friend has helped me and it is due a bug in the python parser, where the type has to be defined twice in the xacro file, like this:

<transmission name="${name}_1_trans" type="transmission_interface/SimpleTransmission"> <type>transmission_interface/SimpleTransmission</type> <joint name="${name}_1_joint">
<hardwareInterface>PositionJointInterface</hardwareInterface>
<hardwareInterface>VelocityJointInterface</hardwareInterface>
</joint>
<actuator name="\${name}_1_motor">
<mechanicalReduction>1</mechanicalReduction>
</actuator>
</transmission>


But now it still comes out with other parsing errors, referred now to the mechanical reduction. I have tried to define it twice and change its position, but no better solution is achieved. Any help?

more

I guess multiple material tags have a problem:

[INFO] [WallTime: 1437558450.270437] [0.000000] Starting [jt_cartesian_controller] node
Material has neither a color nor textureMaterial has neither a color nor textureMaterial has neither a color nor textureMaterial has neither a color nor textureMaterial has neither a color nor textureMaterial has neither a color nor textureTraceback (most recent call last):


textureMaterial has neither a color nor textureMaterial

try removing that materials and see if that fixes your problem, maybe you have some empty material tags???

more