When I loaded URDF with old transmission (PR2Transmission) by latest ros-melodic-urdfdom-py, I got an error.
>>> from urdf_parser_py.urdf import URDF
>>> robot = URDF.from_xml_string("<?xml version=\"1.0\"?><robot name=\"myrobot\"><transmission name=\"mytransmission\" type=\"pr2_mechanism_model/SimpleTransmission\"><actuator name=\"mymotor\"/><joint name=\"myjoint\"/><mechanicalReduction>1 </mechanicalReduction></transmission></robot>")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 616, in from_xml_string
return cls.from_xml(node, path)
File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 610, in from_xml
return cur_type.from_xml(node, path)
File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 232, in from_xml
obj.read_xml(node, path)
File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 598, in read_xml
self.XML_REFL.set_from_xml(self, node, path)
File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 513, in set_from_xml
element.add_from_xml(obj, child, element_path)
File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 390, in add_from_xml
value = self.value_type.from_xml(node, path)
File "/opt/ros/melodic/lib/python2.7/dist-packages/urdf_parser_py/xml_reflection/core.py", line 283, in from_xml
raise ParseError(Exception(out), path)
urdf_parser_py.xml_reflection.core.ParseError: ParseError in /robot[@name='myrobot']/transmission[@name='mytransmission']:
Could not perform duck-typed parsing.
Value Type: <class 'urdf_parser_py.urdf.Transmission'>
Exception: ParseError in /robot[@name='myrobot']/transmission[@name='mytransmission']/joint[@name='myjoint']:
no hardwareInterface defined
When I loaded URDF with old transmission (PR2Transmission) by latest
ros-melodic-urdfdom-py
, I got an error.This error is caused by this commit https://github.com/ros/urdf_parser_py/commit/22f3a60ae683a24a1372368dbcc739c01eb41b64 .
In
xml_children
ofxml_reflection/basics.py
, raw list of children is returned. (not copied one). This destroys the node here, and destroyed node causes the error above. https://github.com/ros/urdf_parser_py/blob/b6a9726c976933fb8cec0b5b872101984ec131dd/src/urdf_parser_py/xml_reflection/core.py#L520After this commit https://github.com/ros/urdf_parser_py/commit/b6a9726c976933fb8cec0b5b872101984ec131dd , this error will be fixed. I would appreciate it if you could release it as soon as possible.