Skip to content

Commit

Permalink
Merge pull request #6 from eacousineau/feature/groovy-bugfixes
Browse files Browse the repository at this point in the history
Small bugfixes for urdf_parser_py and xml_reflection
  • Loading branch information
thomas-moulard committed Jul 25, 2013
2 parents 35c22ec + 2942636 commit ba8d4de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions urdf_parser_py/src/urdf_parser_py/urdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __init__(self):
})

def from_xml(self, node):
children = node.getchildren()
children = xml_children(node)
assert len(children) == 1, 'One element only for geometric'
return self.factory.from_xml(children[0])

Expand Down Expand Up @@ -425,7 +425,7 @@ def from_parameter_server(cls, key = 'robot_description'):
xmlr.AggregateElement('link', Link),
xmlr.AggregateElement('joint', Joint),
xmlr.AggregateElement('gazebo', xmlr.RawType()),
xmlr.AggregateElement('transmission', Transmission),
xmlr.AggregateElement('transmission', Transmission),
xmlr.AggregateElement('material', Material)
])

Expand Down
Binary file removed xml_reflection/src/xml_reflection/__init__.pyc
Binary file not shown.
5 changes: 4 additions & 1 deletion xml_reflection/src/xml_reflection/basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def to_yaml(obj):
# Ordered dict: http://pyyaml.org/ticket/29#comment:11
if obj is None or type(obj) in [str, unicode]:
out = str(obj)
elif type(obj) in [int, float]:
elif type(obj) in [int, float, bool]:
return obj
elif hasattr(obj, 'to_yaml'):
out = obj.to_yaml()
Expand All @@ -52,6 +52,9 @@ def to_yaml(obj):
out = {}
for (var, value) in obj.iteritems():
out[str(var)] = to_yaml(value)
elif hasattr(obj, 'tolist'):
# For numpy objects
out = to_yaml(obj.tolist())
elif isinstance(obj, collections.Iterable):
out = [to_yaml(item) for item in obj]
else:
Expand Down

0 comments on commit ba8d4de

Please sign in to comment.