diff --git a/src/urdf_parser_py/urdf.py b/src/urdf_parser_py/urdf.py
index 41fa2b7..dbd03ad 100644
--- a/src/urdf_parser_py/urdf.py
+++ b/src/urdf_parser_py/urdf.py
@@ -149,12 +149,14 @@ def write_xml(self, node, obj):
class Collision(xmlr.Object):
- def __init__(self, geometry=None, origin=None):
+ def __init__(self, geometry=None, origin=None, name=None):
self.geometry = geometry
+ self.name = name
self.origin = origin
xmlr.reflect(Collision, tag='collision', params=[
+ xmlr.Attribute('name', str, False),
origin_element,
xmlr.Element('geometry', 'geometric')
])
@@ -194,13 +196,15 @@ def check_valid(self):
class Visual(xmlr.Object):
- def __init__(self, geometry=None, material=None, origin=None):
+ def __init__(self, geometry=None, material=None, origin=None, name=None):
self.geometry = geometry
self.material = material
+ self.name = name
self.origin = origin
xmlr.reflect(Visual, tag='visual', params=[
+ xmlr.Attribute('name', str, False),
origin_element,
xmlr.Element('geometry', 'geometric'),
xmlr.Element('material', LinkMaterial, False)
diff --git a/test/test_urdf.py b/test/test_urdf.py
index b78432d..09fad45 100644
--- a/test/test_urdf.py
+++ b/test/test_urdf.py
@@ -163,6 +163,20 @@ def test_link_multiple_visual(self):
'''
self.parse_and_compare(xml)
+ def test_visual_with_name(self):
+ xml = '''
+
+
+
+
+
+
+
+
+
+'''
+ self.parse_and_compare(xml)
+
def test_link_multiple_collision(self):
xml = '''
@@ -181,6 +195,19 @@ def test_link_multiple_collision(self):
'''
self.parse_and_compare(xml)
+ def test_collision_with_name(self):
+ xml = '''
+
+
+
+
+
+
+
+
+'''
+ self.parse_and_compare(xml)
+
def test_version_attribute_not_enough_dots(self):
xml = '''