@@ -413,13 +413,13 @@ def parse_urdf(urdf_xml, mesh_path=None, package_dir=None, strict_check=True):
413413 # URDF XML schema:
414414 # https://github.com/ros/urdfdom/blob/master/xsd/urdf.xsd
415415
416- # If there is an XML namespace (xmlns=...) specified, this will break parsing as
417- # the root tag, and the tag of all elements underneath root, will have a {namespace}
418- # prefix. As such, normalize the namespace to the default (i.e. no namespace).
416+ # If there is an XML namespace (xmlns=...) specified, this will break
417+ # parsing as the root tag, and the tag of all elements underneath root,
418+ # will have a {namespace} prefix. As such, normalize the namespace to the
419+ # default (i.e. no namespace).
419420
420421 _normalize_namespace (root )
421422
422-
423423 if root .tag != "robot" :
424424 raise UrdfException ("Robot tag is missing." )
425425
@@ -470,6 +470,13 @@ def initialize_urdf_transform_manager(tm, robot_name, links, joints):
470470 _add_joints (tm , joints )
471471
472472
473+ def _normalize_namespace (root ):
474+ """Normalizes the namespace of the root node and all elements underneath."""
475+ root .tag = re .sub (r"\{.*?\}" , "" , root .tag )
476+ for element in root .iter ():
477+ element .tag = re .sub (r"\{.*?\}" , "" , element .tag )
478+
479+
473480def _parse_material (material ):
474481 """Parse material."""
475482 if "name" not in material .attrib :
@@ -754,15 +761,6 @@ def _add_joints(tm, joints):
754761 "fixed" ,
755762 )
756763
757- def _normalize_namespace (root ):
758- """Normalizes the namespace of the root node and all elements underneath it.
759- """
760-
761- root .tag = re .sub (r"\{.*?\}" , "" , root .tag )
762-
763- for element in root .iter ():
764- element .tag = re .sub (r"\{.*?\}" , "" , element .tag )
765-
766764
767765class Link (object ):
768766 """Link from URDF file.
0 commit comments